Public Member Functions | |
def | updateScore |
def | getScore |
def | __init__ |
def | addMember |
def | addMembers |
def | removeMember |
def | removeMembers |
def | memberIn |
def | introduction |
def | catchingUp |
Static Public Member Functions | |
def | getTeamById |
def | getTeamByName |
Public Attributes | |
score | |
The Team's current score. | |
teamid | |
The identification number of a Team. | |
name | |
The Team's name. | |
members | |
A list of GameObjects that are members of the Team. | |
fscore | |
A function to calculate the Team's current score. | |
Static Public Attributes | |
list | teams = [] |
Static list with all the teams. |
Represents a Team of GameObjects
def Team.Team.__init__ | ( | self, | |
teamid, | |||
name, | |||
initialmembers, | |||
fscore = lambda members: sum( [member.score for member in members] ) |
|||
) |
Team.__init__(self, teamid, name, initialmembers = [], fscore = lambda t: sum( [p.score for p in t.members] ), initialscore = 0 ) Initialization function for a Team object teamid is an identification number for the team name is the team's name initialmembers is a initial list of team members (Character objects) fscore is a function to calculate the teams score. it MUST receive a Team object as its only parameter and return the teams score. It MUST NOT update the teams score internally.
def Team.Team.addMember | ( | self, | |
member | |||
) |
Team.addMember(self, member) Function to add a team member (Character object) to a Team object returns True if the member is inserted and False otherwise. Raises an assertionerror if member is not an instance of GameObject
def Team.Team.addMembers | ( | self, | |
members | |||
) |
Team.addMembers(self, members) Adds a list of members (Character object) to a Team object If the list contains objects already in the list, those objects will not be added
def Team.Team.catchingUp | ( | self | ) |
Generates a JSON friendly dictionary with all the object's attributes and values. This function is intended as a update on the object's state, sent to receivers that are already able to identify the object.
def Team.Team.getScore | ( | self | ) |
Team.getScore(self) The Team's current score
def Team.Team.getTeamById | ( | teamid | ) | [static] |
Team.getTeamById(teamid) Returns the team in Team.teams whose teamid matches the argument or None for no match.
def Team.Team.getTeamByName | ( | name | ) | [static] |
Team.getTeamByName(name) Returns the team in Team.teams whose name matches the argument or None for no match.
def Team.Team.introduction | ( | self | ) |
Generates a JSON friendly dictionary with all the object's attributes and values. This function is intended as a first introduction of the object, to receivers that are unaware of its existence.
def Team.Team.memberIn | ( | self, | |
member | |||
) |
Team.memberIn(self, member) Returns True if member is in the Team and False otherwise. Raises an assertionError if member is not a GameObject
def Team.Team.removeMember | ( | self, | |
member | |||
) |
Team.removeMember(self, member) Removes a member from a Team object. Returns True for success and False for failure
def Team.Team.removeMembers | ( | self, | |
members | |||
) |
Team.removeMembers(self, members) Removes a list of members (Character object) from a Team object. If the list contains objects not in the list they are ignored
def Team.Team.updateScore | ( | self | ) |
Team.updateScore(self) Function that calculates the team's score
A function to calculate the Team's current score.
It MUST NOT set the value of self.score internally, but just return a value self.members must be its only argument