Package net.royalur.rules.simple
Class SimplePlayerStateProvider
java.lang.Object
net.royalur.rules.simple.SimplePlayerStateProvider
- All Implemented Interfaces:
PlayerStateProvider
Provides new instances of, and manipulations to, simple player states.
-
Constructor Summary
ConstructorDescriptionSimplePlayerStateProvider
(int startingPieceCount) Creates a new simple player state provider. -
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.
-
Constructor Details
-
SimplePlayerStateProvider
public SimplePlayerStateProvider(int startingPieceCount) Creates a new simple player state provider.- Parameters:
startingPieceCount
- The number of pieces that each player starts with.
-
-
Method Details
-
getStartingPieceCount
public int getStartingPieceCount()Description copied from interface:PlayerStateProvider
Gets the number of pieces that players start with.- Specified by:
getStartingPieceCount
in interfacePlayerStateProvider
- Returns:
- The number of pieces that players start with.
-
create
Description copied from interface:PlayerStateProvider
Generates a state for theplayer
player.- Specified by:
create
in interfacePlayerStateProvider
- 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
Description copied from interface:PlayerStateProvider
Generates the starting state for theplayer
player.- Specified by:
createStartingState
in interfacePlayerStateProvider
- Parameters:
player
- The player to create the starting state for.- Returns:
- A player state for the player
player
.
-
applyPieceIntroduced
Description copied from interface:PlayerStateProvider
Generates a new player state that is a copy ofplayerState
, with the given piece introduced to the board.- Specified by:
applyPieceIntroduced
in interfacePlayerStateProvider
- 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
Description copied from interface:PlayerStateProvider
Generates a new player state that is a copy ofplayerState
, with the given piece captured.- Specified by:
applyPieceCaptured
in interfacePlayerStateProvider
- 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
Description copied from interface:PlayerStateProvider
Generates a new player state that is a copy ofplayerState
, with the given piece scored.- Specified by:
applyPieceScored
in interfacePlayerStateProvider
- 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.
-