GinMovetype
A card drawn from the stock or taken from the discard pile, or a card thrown: laid on the pile, or face down to knock.
Import it
import type { GinMove } from "@johnmorrisdotca/toranpu/gin-rummy";
Definition
type GinMove = {
draw: "stock";
} | {
draw: "discard";
} | {
discard: CardId;
} | {
knock: CardId;
};
Examples
import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import type { GinMove } from "@johnmorrisdotca/toranpu/gin-rummy";
const names = Array.from({ length: CARD_GAME_TABLES.ginRummy.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("ginRummy", { players: names, seed: 42 })!;
const value: GinMove = rulesFor("ginRummy").moves(game)[0]!;
console.log(value);{ draw: 'stock' }What it prints (run when this page was built)