Skip to content

GameNotStarted

data class GameNotStarted(val players: Set<Player>, random: Random) : Game

Game state before the game starts: users are registering.

A new state is generated each time a player joins or leaves.

Constructors

GameNotStarted

constructor(players: Set<Player>, random: Random)

Types

IncorrectPlayerCount

data class IncorrectPlayerCount(val playerCount: Int) : GameNotStarted.StartFailures

StartFailures

sealed interface StartFailures

Properties

players

open override val players: Set<Player>

The set of players in the game.

This set is immutable and ordered: the players will play in the order in which they appear in this set.

Functions

addPlayer

Adds a new player.

If the player is already part of the game, this is a no-op.

handOf

open override fun handOf(player: Player): Hand

The cards of each player are only decided on game start, so every player is considered to have an empty deck.

removePlayer

Removes a player.

If the player is not already part of the game, this is a no-op.

start

Starts the game.

Requires at least two players.

The cards are shuffled and split evenly between the players.