AI Player

class src.ai_player.AIPlayer(name, color)[source]

AIPlayer Class that controls the behavior of an AI player in the game. Attributes

:param 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 dictionary of resource type string mapped to the amount the player has :type resources: dict :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 isTurn: boolean :param hasLongestRoad: a boolean indicating if the player has the longest road. :type hasLongestRoad: boolean :param has_largest_army: a boolean indicating if the player has the largest army :type has_largest_army: boolean :param trade_offers: a list of trade_offers that the player has received (of type Trade) :type trade_offers: list

choose_action(actions)[source]

Chooses an action randomly from a list of possible actions.

Parameters:

actions (list[Action]) – A list of possible actions.

Returns:

The chosen action.

Return type:

Action

get_possible_actions(adjacent_nodes, board_mapping, node_buttons)[source]

Given the current game state, generates all possible actions the player can take. This includes settlement or city building actions, road building actions, and trade actions.

Returns:

A list of possible actions.

Return type:

list[Action]

take_turn(adjacent_nodes, board_mapping, node_buttons)[source]

Constructor Class