Package net.royalur.rules
Interface PlayerStateProvider
- All Known Implementing Classes:
SimplePlayerStateProvider
public interface PlayerStateProvider
An interface that provides the manipulation of PlayerStates as a game progresses.
-
Method Summary
Modifier and TypeMethodDescriptionapplyPieceCaptured
(PlayerState playerState, Piece piece) Generates a new player state that is a copy ofplayerState
, with the given piece captured.applyPieceIntroduced
(PlayerState playerState, Piece piece) Generates a new player state that is a copy ofplayerState
, with the given piece introduced to the board.applyPieceScored
(PlayerState playerState, Piece piece) Generates a new player state that is a copy ofplayerState
, with the given piece scored.create
(PlayerType player, int pieces, int score) Generates a state for theplayer
player.createStartingState
(PlayerType player) Generates the starting state for theplayer
player.int
Gets the number of pieces that players start with.
-
Method Details
-
getStartingPieceCount
int getStartingPieceCount()Gets the number of pieces that players start with.- Returns:
- The number of pieces that players start with.
-
create
Generates a state for theplayer
player.- Parameters:
player
- The player to create the starting state for.pieces
- The number of pieces the player has yet to play.score
- The number of pieces the player has scored.- Returns:
- A player state for the player
player
.
-
createStartingState
Generates the starting state for theplayer
player.- Parameters:
player
- The player to create the starting state for.- Returns:
- A player state for the player
player
.
-
applyPieceIntroduced
Generates a new player state that is a copy ofplayerState
, with the given piece introduced to the board.- Parameters:
playerState
- The player state to modify the pieces of.piece
- The piece that was introduced to the board.- Returns:
- A new player state after the given piece was introduced to the board.
-
applyPieceCaptured
Generates a new player state that is a copy ofplayerState
, with the given piece captured.- Parameters:
playerState
- The player state to modify the pieces of.piece
- The piece that was captured.- Returns:
- A new player state after the given piece was captured.
-
applyPieceScored
Generates a new player state that is a copy ofplayerState
, with the given piece scored.- Parameters:
playerState
- The player state to modify the score of.piece
- The piece that was scored.- Returns:
- A new player state with the given new piece scored.
-