Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Klondike

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

NameTypeDescription
rulesKlondikeRules
tableaureadonly KlondikeColumn[]

Seven columns.

stockreadonly number[]

Face down; the top card, the next to turn, is the LAST.

wastereadonly number[]

Face up beside the stock; the top card, the one that can be played, is the LAST.

foundationreadonly number[]

How many cards are home on each suit's foundation, in SUITS order: its top card is that rank.

recyclesnumber

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);
24

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.