Class OngoingGameState

java.lang.Object
net.royalur.rules.state.GameState
net.royalur.rules.state.OngoingGameState
Direct Known Subclasses:
ActionGameState, PlayableGameState

public abstract class OngoingGameState extends GameState
A game state from within a game where a winner has not yet been determined.
  • Constructor Details

    • OngoingGameState

      public OngoingGameState(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs, PlayerType turn)
      Instantiates a game state for an ongoing point in a game.
      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.
      turn - The player who made an action or that should make an action.
  • Method Details

    • 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.
    • getTurn

      public PlayerType getTurn()
      Gets the player who can make the next interaction with the game.
      Returns:
      The player who can make the next interaction with the game.
    • getWaiting

      public PlayerType getWaiting()
      Gets the player that is waiting whilst the other player makes the next interaction with the game.
      Returns:
      The player who is waiting for the other player to interact with the game.
    • getTurnPlayer

      public PlayerState getTurnPlayer()
      Gets the state of the player that we are waiting on to interact with the game.
      Returns:
      The state of the player that we are waiting on to interact with the game.
    • getWaitingPlayer

      public PlayerState getWaitingPlayer()
      Gets the state of the player that is waiting whilst the other player makes the next interaction with the game.
      Returns:
      The state of the player that is waiting for the other player to interact with the game.
    • getSubject

      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
    • equals

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