CrazyEightsMovetype
A card played (an eight names the suit to follow), a card drawn from the stock, or a turn passed.
Import it
import type { CrazyEightsMove } from "@johnmorrisdotca/toranpu/crazy-eights";
Definition
type CrazyEightsMove = {
play: CardId;
suit?: CardSuit;
} | {
draw: true;
} | {
pass: true;
};
Examples
import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import type { CrazyEightsMove } from "@johnmorrisdotca/toranpu/crazy-eights";
const names = Array.from({ length: CARD_GAME_TABLES.crazyEights.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("crazyEights", { players: names, seed: 42 })!;
const value: CrazyEightsMove = rulesFor("crazyEights").moves(game)[0]!;
console.log(value);{ play: '3S' }What it prints (run when this page was built)