Player¶
- class src.player.Player(name, color)[source]¶
Player class that controls the behaviour of an indivdual player of the game. Contains attributes such as the player name and number of VP’S.
- Parameters:
name – String representing the name of the
player :type name: str :param victory_points: Integer representing the number of victory points the player has received. :type victory_points: int :param color: A tuple with an r,g,b value representing the color that the player has. :type color: tuple :param resources: A list of resources that the player has (all of type Resource) :type resources: list :param settlements: A list of settlements the player has :type settlements: list :param cities: A list of cities the player has :type cities: list :param roads: a list of roads the player has (all of type Road) :type roads: list :param isTurn: a boolean indicating if it is the players turn in the gameloop. :type is Turn: bool :param hasLongestRoad: a boolean indicating if the player has the longest road. :type hasLongestRoad: bool :param has_largest_army: a boolean indicating if the player has the largest army :type has_largest_army: bool :param trade_offers: a list of trade_offers that the player has received (of type Trade) :type trade_offers: list
- add_resource(resource)[source]¶
Adds resources to players inventory
- Parameters:
resources (list) – resources to be added
- build_city(node)[source]¶
Builds a city at specified node only can build if a settlement is on the node
- build_road(node1, node2, is_special_round)[source]¶
Builds a road from node1 to node2. Road will be set to the color of the player building
- build_settlement(settlement, is_special_round)[source]¶
Builds a settlement at specified node, Can only build if player has enough resources
- get_longest_road()[source]¶
Displays current longest connected road built on the board
- Returns:
Integer value of longest constructed road
- Return type:
int
- get_resources()[source]¶
Returns current players resources
- Returns:
list of resources
- Return type:
list
- get_victory_points()[source]¶
Returns current players victory points
- Returns:
Integer value of current victory point count for desired player
- Return type:
int