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 TypeMethodDescriptionbooleanGets 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.booleanGets whether this control state has an associated player.booleanReturns whether this state represents a finished game.booleanReturns 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:GameStateGet the subject player of the game state. e.g., player to roll/move, player that rolled/moved, player that won.- Specified by:
getSubjectin classGameState
-
isPlayable
public boolean isPlayable()Description copied from class:GameStateReturns whether this state is a valid state to be played from.- Specified by:
isPlayablein classGameState- Returns:
- Whether this state is a valid state to be played from.
-
isFinished
public boolean isFinished()Description copied from class:GameStateReturns whether this state represents a finished game.- Specified by:
isFinishedin 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
-