Package net.royalur.rules.state
Class EndGameState
java.lang.Object
net.royalur.rules.state.GameState
net.royalur.rules.state.EndGameState
A game state where a player has won the game.
-
Constructor Summary
ConstructorDescriptionEndGameState
(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs, PlayerType winner) Instantiates a game state where a player has won the game. -
Method Summary
Modifier and TypeMethodDescriptiondescribe()
Generates an English text description of the state of the game.boolean
getLoser()
Gets the player that lost the game.Gets the state of the player that lost the game.Get the subject player of the game state.Gets the player that won the game.Gets the state of the player that won the game.boolean
hasLoser()
Gets whether the game ended with a loser.boolean
Gets whether the game ended with a winner.boolean
Returns whether this state represents a finished game.boolean
Returns whether this state is a valid state to be played from.Methods inherited from class net.royalur.rules.state.GameState
getBoard, getDarkPlayer, getLightPlayer, getPlayerState, getTimeSinceGameStartMs
-
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, ornull
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 classGameState
- 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 classGameState
- 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
Gets the player that won the game.- Returns:
- The player that won the game.
-
getLoser
Gets the player that lost the game.- Returns:
- The player that lost the game.
-
getWinningPlayer
Gets the state of the player that won the game.- Returns:
- The state of the player that won the game.
-
getLosingPlayer
Gets the state of the player that lost the game.- Returns:
- The state of the player that lost the game.
-
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 classGameState
-
describe
Description copied from class:GameState
Generates an English text description of the state of the game. -
equals
-