Player

data class Player(val type: PieceType, val name: String = type.name, val points: Int = 0)

Represents a player in the game.

Constructors

Link copied to clipboard
constructor(type: PieceType, name: String = type.name, points: Int = 0)

Properties

Link copied to clipboard

The name of the player (defaults to piece type name if null).

Link copied to clipboard
val points: Int

The current number of pieces the player has on the board.

Link copied to clipboard

The type of piece the player uses (BLACK or WHITE).

Functions

Link copied to clipboard
fun refresh(board: Board): Player

Updates the player's points based on the current board state.

Link copied to clipboard
fun swap(): Player

Returns a new Player instance with the opposite piece type.