Skip to content

Crazy Eights

tilttek/tavern-games

Game\CrazyEights, named crazy-eights, for 2 to 6 seats, with the 52 cards of the French-suited deck.

The rules

Each seat is dealt a hand and one card is turned up on the discard pile. In their turn, a seat plays a card of the same rank or suit as the top of the discard pile, or an eight, which is wild and names the suit to follow; a seat that cannot or will not play draws one card, then plays or passes. When the draw pile is empty, the discard pile under its top card is shuffled back into it. An eight turned up at the start names its own suit.

PartWhat it is
Optionhand, the cards dealt to each seat: 5, from 3 to 8
Movescrazy-eights.play ({card, suit}, the suit S, H, D or C, for an eight only), crazy-eights.draw, crazy-eights.pass; the timeout of a turn draws a card when none was drawn and one is left, then passes
RefusalsA card not in the seat's hand, a card that follows neither the suit nor the rank, an eight without a suit, a second draw in a turn, a pass before drawing while a card is left to draw, a draw with nothing left

The endings

ReasonWhenWinners
emptied-handA seat plays its last cardThat seat
blockedNothing is left to draw, and every seat passes in a rowThe fewest cards, equal hands sharing the win
too-longThe cards have seen CrazyEights::MAX_GESTURES gestures, 1 000The fewest cards, equal hands sharing the win

The outcome reports the cards left in each hand as cards.

The cards

The cards are kept by tilttek/card-deck. The setup draws a seed of 32 bytes from the table's chance and deals from a deck shuffled with it; the data of the table holds that seed and the gestures of the cards. Every move and every view replays the gestures into a DeckState: a game stays under 1 000 gestures, which keeps the replay bounded (Testing). Seat n of the table, from 0, is the player p(n+1) of tilttek/card-deck.

What each seat sees

FieldWhat it holds
handThe seat's own cards, each {card, face}; none for the audience
topThe face of the top of the discard pile, 9C
suitThe suit to follow: the one an eight named, else the top card's
drawThe cards left in the draw pile
handsHow many cards each seat holds
turnThe seat playing, null once the game is over
drawnWhether the seat playing has drawn this turn

A seat never sees another seat's cards, the order of the draw pile, the seed of the cards or their gestures.