Game Engine

class battleground.game_engine.GameEngine(num_players, type, **kwargs)[source]

This is an interface for the game engine class. An engine for a specific game should implement these functions.

game_over()[source]

Check if the game is over.

Returns:(bool) is the game over.
get_current_player()[source]

This is used by the game runner to determine which player should make the next move

Returns:(int) index of the current player in the players list of the GameRunner
get_game_name()[source]
Returns:(str) the type of the current game.
get_save_state()[source]
Returns:the state of the game as it should be saved in the database.
get_state()[source]

Get the current state of the game.

Returns:the current game state.
move(move)[source]

Resolve a move in the game engine on behalf of the current player. This function is called by the game runner, taking the agent’s chosen move of the current player.

Parameters:move – the move returned by the agent of the current player.
reset()[source]

Initialize the game to the starting point.