KlondikeTabletype
A game of Klondike as it stands: every pile, and the rules it is played under.
Import it
import type { KlondikeTable } from "@johnmorrisdotca/toranpu/klondike";
Definition
type KlondikeTable = {
rules: KlondikeRules;
tableau: readonly KlondikeColumn[];
stock: readonly number[];
waste: readonly number[];
foundation: readonly number[];
recycles: number;
};
Members
| Name | Type | Description |
|---|---|---|
rules | KlondikeRules | |
tableau | readonly KlondikeColumn[] | Seven columns. |
stock | readonly number[] | Face down; the top card, the next to turn, is the LAST. |
waste | readonly number[] | Face up beside the stock; the top card, the one that can be played, is the LAST. |
foundation | readonly number[] | How many cards are home on each suit's foundation, in |
recycles | number | How many times the waste has been turned back into the stock. |
Examples
import { dealKlondike, dealOfSeed, deckOf } from "@johnmorrisdotca/toranpu/klondike";
import type { KlondikeTable } from "@johnmorrisdotca/toranpu/klondike";
const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 });
const value: KlondikeTable = table;
console.log(value.stock.length);24What it prints (run when this page was built)