Interface PlayerStateProvider

All Known Implementing Classes:
SimplePlayerStateProvider

public interface PlayerStateProvider
An interface that provides the manipulation of PlayerStates as a game progresses.
  • Method Details

    • getStartingPieceCount

      int getStartingPieceCount()
      Gets the number of pieces that players start with.
      Returns:
      The number of pieces that players start with.
    • create

      PlayerState create(PlayerType player, int pieces, int score)
      Generates a state for the player 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

      PlayerState createStartingState(PlayerType player)
      Generates the starting state for the player player.
      Parameters:
      player - The player to create the starting state for.
      Returns:
      A player state for the player player.
    • applyPieceIntroduced

      PlayerState applyPieceIntroduced(PlayerState playerState, Piece piece)
      Generates a new player state that is a copy of playerState, 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

      PlayerState applyPieceCaptured(PlayerState playerState, Piece piece)
      Generates a new player state that is a copy of playerState, 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

      PlayerState applyPieceScored(PlayerState playerState, Piece piece)
      Generates a new player state that is a copy of playerState, 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.