Class ControlGameState

java.lang.Object
net.royalur.rules.state.GameState
net.royalur.rules.state.ControlGameState
Direct Known Subclasses:
AbandonedGameState, ResignedGameState

public abstract class ControlGameState extends GameState
A game state that records a control action that was made.
  • Constructor Details

    • ControlGameState

      public ControlGameState(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs, @Nullable PlayerType player)
      Instantiates a game state for a control action.
      Parameters:
      board - The state of the pieces on the board.
      lightPlayer - The state of the light player.
      darkPlayer - The state of the dark player.
      timeSinceGameStartMs - The time this state was created.
      player - The player that performed the control action.
    • ControlGameState

      public ControlGameState(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs)
      Instantiates a game state for a control action.
      Parameters:
      board - The state of the pieces on the board.
      lightPlayer - The state of the light player.
      darkPlayer - The state of the dark player.
      timeSinceGameStartMs - The time this state was created.
  • Method Details

    • getSubject

      @Nullable public PlayerType getSubject()
      Description copied from class: GameState
      Get the subject player of the game state. e.g., player to roll/move, player that rolled/moved, player that won.
      Specified by:
      getSubject in class GameState
    • isPlayable

      public boolean isPlayable()
      Description copied from class: GameState
      Returns whether this state is a valid state to be played from.
      Specified by:
      isPlayable in class GameState
      Returns:
      Whether this state is a valid state to be played from.
    • isFinished

      public boolean isFinished()
      Description copied from class: GameState
      Returns whether this state represents a finished game.
      Specified by:
      isFinished in class GameState
      Returns:
      Whether this state represents a finished game.
    • hasPlayer

      public boolean hasPlayer()
      Gets whether this control state has an associated player.
      Returns:
      Whether this control state has an associated player.
    • getPlayer

      public PlayerType getPlayer()
      Gets the player that performed the control action.
      Returns:
      The player that performed the control action.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class GameState