Class EndGameState

java.lang.Object
net.royalur.rules.state.GameState
net.royalur.rules.state.EndGameState

public class EndGameState extends GameState
A game state where a player has won the game.
  • Constructor Details

    • EndGameState

      public EndGameState(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs, @Nullable PlayerType winner)
      Instantiates a game state where a player has won the 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.
      winner - The winning player, or null if neither player won.
  • Method Details

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

      public boolean hasWinner()
      Gets whether the game ended with a winner.
      Returns:
      Whether the game ended with a winner.
    • hasLoser

      public boolean hasLoser()
      Gets whether the game ended with a loser.
      Returns:
      Whether the game ended with a loser.
    • getWinner

      public PlayerType getWinner()
      Gets the player that won the game.
      Returns:
      The player that won the game.
    • getLoser

      public PlayerType getLoser()
      Gets the player that lost the game.
      Returns:
      The player that lost the game.
    • getWinningPlayer

      public PlayerState getWinningPlayer()
      Gets the state of the player that won the game.
      Returns:
      The state of the player that won the game.
    • getLosingPlayer

      public PlayerState getLosingPlayer()
      Gets the state of the player that lost the game.
      Returns:
      The state of the player that lost the game.
    • 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
    • describe

      public String describe()
      Description copied from class: GameState
      Generates an English text description of the state of the game.
      Specified by:
      describe in class GameState
      Returns:
      An English text description of the state of the game.
    • equals

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