Package net.royalur.rules.state
Class ControlGameState
java.lang.Object
net.royalur.rules.state.GameState
net.royalur.rules.state.ControlGameState
- Direct Known Subclasses:
AbandonedGameState
,ResignedGameState
A game state that records a control action that was made.
-
Constructor Summary
ConstructorsConstructorDescriptionControlGameState
(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs) Instantiates a game state for a control action.ControlGameState
(Board board, PlayerState lightPlayer, PlayerState darkPlayer, long timeSinceGameStartMs, PlayerType player) Instantiates a game state for a control action. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the player that performed the control action.Get the subject player of the game state. e.g., player to roll/move, player that rolled/moved, player that won.boolean
Gets whether this control state has an associated player.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
addMetadata, addMetadata, clearMetadata, describe, getBoard, getDarkPlayer, getLightPlayer, getMetadata, getMetadata, getPlayerState, getTimeSinceGameStartMs, hasMetadata, removeMetadata
-
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
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
-
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.
-
hasPlayer
public boolean hasPlayer()Gets whether this control state has an associated player.- Returns:
- Whether this control state has an associated player.
-
getPlayer
Gets the player that performed the control action.- Returns:
- The player that performed the control action.
-
equals
-