Phase

from dgisim import Phase

Phase is an abstract class.

class Phase

Phase defines how GameState make state transitions under this phase.

This class doesn’t store any data, so all instances of Phase (of the same class) are considered equal and have the same hash.

abstract action_generator(game_state: GameState, pid: Pid) None | ActionGenerator
Returns:

an action generator for player pid under game_state. None is returned if the player is not allowed to make a move.

abstract step(game_state: GameState) GameState
Returns:

the next game state after one state transition from game_state.

This method defines how state transition is performed. (transtion without player action)

abstract step_action(game_state: GameState, pid: Pid, action: PlayerAction) None | GameState
Parameters:
  • game_state – current game state.

  • pid – player of action.

  • action – the action of player.

Returns:

the next game state after one state transition from game_state.

This method defines how state transition is performed. (transtion with player action)

waiting_for(game_state: GameState) None | Pid
Returns:

which player’s action is required to perform the next state transition. None is returned if no player action is required.