0% found this document useful (0 votes)
15 views3 pages

Agent Team Composition and Student Advisor

The document contains a Jupyter Notebook with Python code that evaluates a team composition for a game based on agent roles and provides student advising based on course enrollment. It checks if the team has a perfect composition of agents and advises students on their course credits and requirements. The code includes classes and methods for handling agent roles and student details, along with sample outputs for both functionalities.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Agent Team Composition and Student Advisor

The document contains a Jupyter Notebook with Python code that evaluates a team composition for a game based on agent roles and provides student advising based on course enrollment. It checks if the team has a perfect composition of agents and advises students on their course credits and requirements. The code includes classes and methods for handling agent roles and student details, along with sample outputs for both functionalities.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

11/20/2020 ShammoFaiyazAhmed_20301054_07 - Jupyter Notebook

In [5]: dict= {"Breach" : "Initiator" , "Brim": "Controller", "Cypher": "Sentinel", "Jett


duelist_count = 0
sentinel_count = 0
controller_count = 0
initiator_count = 0

user_input=input("Enter names of agents: ")


final_input= user_input.split(" ")

for key in final_input:


value=dict[key]
if value=="Initiator":
initiator_count+=1
elif value=="Controller":
controller_count+=1
elif value=="Sentinel":
sentinel_count+=1
elif value=="Duelist":
duelist_count+=1
if duelist_count >= 2 and sentinel_count >= 1 and controller_count >= 1 and initi
print("We have a perfect team. Let’s win this game.")
else:
print("We don’t have a perfect team. It will be hard to win this match.")

Enter names of agents: Omen Jett Phoenix Reyna Sage Cypher Brim
We don’t have a perfect team. It will be hard to win this match.

localhost:8888/notebooks/ShammoFaiyazAhmed_20301054_07.ipynb 1/3
11/20/2020 ShammoFaiyazAhmed_20301054_07 - Jupyter Notebook

In [8]: class Student:


def __init__(self, name, id, department):
[Link] = name
[Link] = id
[Link] = department

def details(self):
return f"Name: {[Link]} \nID: {[Link]} \nDepartment: {[Link]}"

def advise(self, *courses):


c_string = ""
for c in courses:
c_string += c + ","

if len(courses) <3:
print ([Link] + " you have taken "+ str(len(courses) * 3)+ ".0 cre
print ("List of courses: "+ str(c_string[0:-1]))
print ("Status: You have to take at least",3-len(courses) ,"more cour
elif len(courses) == 3 or len(courses)==4:
print([Link] + " you have taken "+ str(len(courses) * 3)+ ".0 cred
print("List of courses: "+ str(c_string[0:-1]))
print ("Status: Ok")
elif len(courses)>4:
print([Link] + " you have taken "+ str(len(courses) * 3)+ ".0 cred
print("List of courses: "+(c_string[0:-1]))
print("Status: You have to drop at least",len(courses)-4,"course.")

s1 = Student("Alice", "20103012", "CSE")


s2 = Student("Bob", "18301254", "EEE")
s3 = Student("Carol", "17101238", "CSE")
print("##########################")
print([Link]())
print("##########################")
print([Link]())
print("##########################")
[Link]("CSE110", "MAT110", "PHY111")
print("##########################")
[Link]("BUS101", "MAT120")
print("##########################")
[Link]("MAT110", "PHY111", "ENG102", "CSE111", "CSE230")

##########################
Name: Alice
ID: 20103012
Department: CSE
##########################
Name: Bob
ID: 18301254
Department: EEE
##########################
Alice you have taken 9.0 credits.
List of courses: CSE110,MAT110,PHY111
Status: Ok
##########################
Bob you have taken 6.0 credits.
localhost:8888/notebooks/ShammoFaiyazAhmed_20301054_07.ipynb 2/3
11/20/2020 ShammoFaiyazAhmed_20301054_07 - Jupyter Notebook

List of courses: BUS101,MAT120


Status: You have to take at least 1 more course.
##########################
Carol you have taken 15.0 credits.
List of courses: MAT110,PHY111,ENG102,CSE111,CSE230
Status: You have to drop at least 1 course.

In [ ]:

localhost:8888/notebooks/ShammoFaiyazAhmed_20301054_07.ipynb 3/3

Common questions

Powered by AI

The agent role dictionary offers a basic level of flexibility, allowing updates by adding new entries for new agents or roles. However, this could be enhanced by implementing a more dynamic system where roles could be updated or defined externally (e.g., via a configuration file or database), reducing the need for hardcoding and facilitating easier updates aligned with game developments. Such modularity would improve maintainability and adaptability to frequent changes.

The team composition function's output messages effectively communicate whether the team is perfect or not with a concise statement. However, further improvements could include more detailed advisories, such as specifying which roles are lacking when the team is not perfect, or suggesting possible changes. This additional information could enhance user understanding and decision-making in forming a balanced team.

The advising system evaluates the number of courses a student is taking. If less than 3 courses (or fewer than 9 credits) are taken, the system advises the student to take more courses to meet the minimum requirement. For students taking between 3 to 4 courses, the system indicates their status as 'Ok.' If more than 4 courses are taken, it advises on dropping excess courses to avoid overload.

Carol needs to drop at least one course because she has enrolled in 15 credits, equivalent to 5 courses. The system's policy requires students to take no more than 4 courses at a time to avoid overloading. Therefore, the advising system flags her enrollment status and recommends dropping at least one course.

The code snippet illustrates object-oriented programming by defining a 'Student' class, which includes the constructor method '__init__' to initialize attributes like name, ID, and department. It also has methods like 'details' and 'advise' to encapsulate student information and decision-making logic about course enrollment. This encapsulation and method definition exemplify object-oriented principles such as encapsulation and abstraction.

In the given model, a team is considered 'perfect' if it includes at least two Duelists, one Sentinel, one Controller, and one Initiator. The program checks the composition of the team based on these criteria and prints a message declaring whether the team is perfect or not.

The advising program assumes that each course is worth 3.0 credits, simplifying the calculation of total credits based on course count. This assumption could impact functionality in different educational contexts where credit values per course vary significantly, potentially rendering the program's advisories inaccurate in such environments without adaptation to specific credit systems.

The program ensures data encapsulation by defining class attributes within the 'Student' class using the '__init__' method, keeping them protected within the class scope. To access these attributes, methods like 'details' are used which return formatted string representations, providing a controlled interface for interacting with the class data, thus preventing unauthorized modifications.

The 'Controller' role is represented in the function through a dictionary mapping and conditional logic that checks for its presence within the team composition. A 'Controller' is significant for a balanced team because it provides strategic management of the game environment, allowing other team members to focus on specific operational tasks, thus enhancing overall performance and adaptability of the team.

The agent role counting and team evaluation logic use dictionaries to map agents to their roles, loops to iterate over user inputs, and conditional statements (if-elif-else) to count and evaluate the roles based on the criteria required for a 'perfect' team. This structured approach allows for dynamic counting and printing outcomes based on team composition.

You might also like