TurnTracker

public interface TurnTracker

An interface for classes that track whose turn it is

Author:The Condor

Methods

addPlayer

void addPlayer(Integer playerNumber)

Start tracking an additional player

Parameters:
  • playerNumber – The playerNumber of the player to start tracking.

hasHadTurnBefore

boolean hasHadTurnBefore(int playerNumber)

Check whether the player has already had a turn this episode.

Parameters:
  • playerNumber
Returns:

true if there was a time after the last call of newEpisodeAndStep() but before the last call of newStep(), during which the tracker was tracking that playerNumber and isAgentsTurn() on an agent with the chosen player number could ever have returned true, false otherwise

isAgentsTurn

boolean isAgentsTurn(Agent agent)

Check whether it is an agent’s turn. IE: Whether the agent should get a state and a chance to send actions during this step.

Parameters:
  • agent – An agent.
Returns:

true if the agent controls a player whose turn it is, false otherwise.

isPlayersTurn

boolean isPlayersTurn(int playerNumber)

Check whether it is an player’s turn. IE: Whether the agent’s with that player number should get a state and a chance to send actions during this step.

Parameters:
  • playerNumber – An player.
Returns:

true if it is the turn of that player, false otherwise.

newEpisodeAndStep

void newEpisodeAndStep()

Advance to the first step of a new episode.

newStep

void newStep()

Go to the next step in the current episode.

removePlayer

void removePlayer(Integer playerNumber)

Stop tracking a player

Parameters:
  • playerNumber – The playerNumber of the player to stop tracking.