StackUpGametype
A game of Stack Up: every seat's stock, hand and four discard piles, the four building piles, the cards still to draw and the finished piles waiting to be shuffled back in.
Import it
import type { StackUpGame } from "@johnmorrisdotca/toranpu/stack-up";
Definition
type StackUpGame = KeptCardGame<StackUpMove> & {
phase: "playing" | "over";
toPlay: number | null;
stocks: CardId[][];
hands: CardId[][];
discards: CardId[][][];
building: CardId[][];
draw: CardId[];
done: CardId[];
reshuffles: number;
played: boolean;
idle: number;
ended: StackUpEnd | null;
};
Members
| Name | Type | Description |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
moves | readonly StackUpMove[] | |
phase | "playing" | "over" | |
toPlay | number | null | |
stocks | string[][] | Each seat's stock, face down but for the top card, which is the last. |
hands | string[][] | |
discards | string[][][] | Each seat's four discard piles, the top card of each last. |
building | string[][] | The four building piles: a pile of n cards wants an n + 1 next, up to 12. |
draw | string[] | |
done | string[] | Finished piles of twelve, shuffled back into the draw pile when it runs out. |
reshuffles | number | |
played | boolean | Whether the seat to play has played a card this turn. |
idle | number | Turns in a row that ended with nothing played. |
ended | StackUpEnd | null |
Examples
import type { StackUpGame } from "@johnmorrisdotca/toranpu/stack-up";
import { newGame } from "@johnmorrisdotca/toranpu";
const value: StackUpGame = newGame("stackUp", { players: ["Aki", "Ben"], seed: 42 })!;
console.log(value.building.length);4What it prints (run when this page was built)