GameState

data class GameState(val players: MatchPlayers, val lastPlayer: PieceType, val board: Board, val winner: Player? = null)

Represents the state of a Reversi game, including the last player who made a move and the current board configuration.

Constructors

Link copied to clipboard
constructor(players: MatchPlayers, lastPlayer: PieceType, board: Board, winner: Player? = null)

Properties

Link copied to clipboard

The current state of the game board, or null if the board is not initialized.

Link copied to clipboard

The type of the last player who made a move, or null if no moves have been made.

Link copied to clipboard

The list of players in the game.

Link copied to clipboard

The player who has won the game, or null if there is no winner.

Functions

Link copied to clipboard
fun changeName(newName: String, pieceType: PieceType): GameState

Changes a player's name in the game state.

Link copied to clipboard

Refreshes the players' point counts based on the current board state.