Skip to content

Game

sealed class Game

A state of the game.

Instances are immutable. Each instance provides methods to advance the game state, which returns a new instance.

To create the initial game state, use newGame.

Game flow:

Inheritors

Properties

players

abstract 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

handOf

abstract fun handOf(player: Player): Hand

Returns the Hand (the cards) of player.

If player is not part of the game, an error is thrown.