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
ConstructorsConstructorDescriptionSimplePlayerStateProvider(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 theplayerplayer.createStartingState(PlayerType player) Generates the starting state for theplayerplayer.intGets 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:PlayerStateProviderGets the number of pieces that players start with.- Specified by:
getStartingPieceCountin interfacePlayerStateProvider- Returns:
- The number of pieces that players start with.
-
create
Description copied from interface:PlayerStateProviderGenerates a state for theplayerplayer.- Specified by:
createin 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:PlayerStateProviderGenerates the starting state for theplayerplayer.- Specified by:
createStartingStatein interfacePlayerStateProvider- Parameters:
player- The player to create the starting state for.- Returns:
- A player state for the player
player.
-
applyPieceIntroduced
Description copied from interface:PlayerStateProviderGenerates a new player state that is a copy ofplayerState, with the given piece introduced to the board.- Specified by:
applyPieceIntroducedin 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:PlayerStateProviderGenerates a new player state that is a copy ofplayerState, with the given piece captured.- Specified by:
applyPieceCapturedin 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:PlayerStateProviderGenerates a new player state that is a copy ofplayerState, with the given piece scored.- Specified by:
applyPieceScoredin 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.
-