Skip to content

GameSelectCard

data class GameSelectCard(
    hands: Map<Player, Hand>, 
    val previousTable: Deck, 
    val newTable: Deck, 
    val currentPlayer: Player
) : GameHalfTurn

Game state where a player just placed cards on the table.

The player must select a card on the old table to insert into their own hand, by calling selectCard.

Constructors

GameSelectCard

constructor(
    hands: Map<Player, Hand>, 
    previousTable: Deck, 
    newTable: Deck, 
    currentPlayer: Player
)

Properties

currentPlayer

newTable

val newTable: Deck

The new deck that the player just played.

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.

previousTable

The deck that was on the table before the current player played their cards.

Functions

handOf

open override fun handOf(player: Player): Hand

Returns the Hand (the cards) of player.

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

selectCard

The currentPlayer must select one of the cards on the previousTable.

The selected card will be added to their own hand.

After that, the previousTable is discarded and the next player's turn begins.