stratega.GameState

class stratega.GameState

Contains the game data without any logic, offering access to the current board, a list of player and their units. If the agent want access to the definition of entity types, actions or game config yaml it should access to SGA::GameInfo

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: stratega.GameState, arg0: stratega.GameState) -> None

  2. __init__(self: stratega.GameState) -> None

Methods

__init__(*args, **kwargs)

Overloaded function.

add_entity(*args, **kwargs)

Overloaded function.

add_player(self, p)

Adds player to gamestate

apply_fog_of_war(self, playerID)

Removes entities and hide tiles that are not visible from the point of view of the given player.

can_execute_action(*args, **kwargs)

Overloaded function.

can_play(self, playerID)

Indicates if the player with the provided ID can play in this game state.

can_research(self, playerID, technologyID)

Check if player can research an technology

get_board_height(self)

Returns the height of the board.

get_board_width(self)

Returns the width of the board.

get_current_tbs_player(self)

Returns the ID of the player that moves in this state for Turn Based Games.

get_current_tick(self)

Returns the current tick of the game.

get_entities(self)

get_entity(*args, **kwargs)

Overloaded function.

get_entity_at(self, pos)

Returns an entity at board position 'pos'.

get_entity_const(self, entityID)

Returns an entity at board position 'pos'.

get_fog_of_war_tile_id(self)

Returns the ID of the tile that represents the fog of war.

get_game_info(self)

Returns a pointer to the struct with static information about the game.

get_game_type(self)

Returns the type of the game, of GameType

get_non_player_entities(self, playerID, ...)

Gets the list of entities of the specified player.

get_num_players(self)

Gets the number of players in this game state.

get_object(self, entityID)

Return object by its ID

get_only_entities(self, entityID)

Returns an entity by its ID.

get_player(self, arg0)

Get player

get_player_action_types(self, playerID)

Returns a list with all the action types that a player can execute

get_player_entities(self, playerID, ...)

Gets the list of entities of the specified player.

get_player_parameter(self, playerID, paramName)

Gets the value of a player parameter.

get_player_parameter_names(self, playerID)

Returns a list will all the parameter names of the player of which ID is given

get_player_parameters(self, playerID)

Gets a map with all pairs <parameter,value>

get_player_score(self, playerID)

Returns the score of the player whose ID is passed.

get_players(self)

Get player

get_slot_object(self, entityID)

Return slot object by its ID

get_tile_at(*args, **kwargs)

Overloaded function.

get_winner_id(self)

Returns the player ID of the winner.

has_player_parameter(self, paramName)

Indicates if the player has a specific parameter

inc_tick(self)

Increments the current tick in the game by 1.

initBoard(self, boardWidth, tiles)

Initializes the board with the tiles passed by parameter.

init_research_techs(self)

Initializes the research technologies to all players, to none.

is_game_over(self)

Returns true if the game is over.

is_in_bounds(*args, **kwargs)

Overloaded function.

is_researched(self, playerID, technologyID)

Check if technology is researched

is_walkable(self, position)

Checks if tile is occupied or the tile is walkable

print_action_info(self, action)

Print information of a specific action

print_board(*args, **kwargs)

Overloaded function.

print_entity_info(self, entityID)

Print information of a specific entity

print_state_info(self)

Print all the entities of the current state

research_technology(self, playerID, technologyID)

Research technology

set_current_tbs_player(self, playerID)

Sets the current TBS player.

set_game_info(self, gameInfoPtr)

Sets the pointer to the game information struct.

set_game_over(self, over)

Sets if the game is over

set_game_type(self, gt)

Sets the type of game (enum type GameType)

set_tick_limit(self, tickL)

Returns the current game tick limit.

set_winner_id(self, winnerID)

Sets the winner of the game.

who_can_play(self)

Returns a list with the ID of players that can play in this game state.

Attributes

current_tick

game_info

game_over

game_type

winner_id