Skip to the content

Toranpuトランプ

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

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Stack Up

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

NameTypeDescription
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly StackUpMove[]
phase"playing" | "over"
toPlaynumber | null
stocksstring[][]

Each seat's stock, face down but for the top card, which is the last.

handsstring[][]
discardsstring[][][]

Each seat's four discard piles, the top card of each last.

buildingstring[][]

The four building piles: a pile of n cards wants an n + 1 next, up to 12.

drawstring[]
donestring[]

Finished piles of twelve, shuffled back into the draw pile when it runs out.

reshufflesnumber
playedboolean

Whether the seat to play has played a card this turn.

idlenumber

Turns in a row that ended with nothing played.

endedStackUpEnd | 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);
4

What it prints (run when this page was built)

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