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¶
Types¶
IncorrectPlayerCount¶
data class IncorrectPlayerCount(val playerCount: Int) : GameNotStarted.StartFailures
StartFailures¶
sealed interface StartFailures
Properties¶
players¶
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¶
fun addPlayer(player: Player): GameNotStarted
Adds a new player.
If the player is already part of the game, this is a no-op.
handOf¶
The cards of each player are only decided on game start, so every player is considered to have an empty deck.
removePlayer¶
fun removePlayer(player: Player): GameNotStarted
Removes a player.
If the player is not already part of the game, this is a no-op.
start¶
context(_: Raise<GameNotStarted.StartFailures>)
fun start(): LegalMove<GameNewTurn>
Starts the game.
Requires at least two players.
The cards are shuffled and split evenly between the players.