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 · Games and state

KeptCardGametype

What every card game's state carries for its keeping.

Import it

import type { KeptCardGame } from "@johnmorrisdotca/toranpu";

Definition

type KeptCardGame<M> = {
    size: number;
    players: readonly string[];
    computers: readonly boolean[];
    seed: number;
    moves: readonly M[];
};

Members

NameTypeDescription
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly M[]

Examples

import type { KeptCardGame, MoveOf } from "@johnmorrisdotca/toranpu";
import { newGame } from "@johnmorrisdotca/toranpu";

const value: KeptCardGame<MoveOf<"hearts">> = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(value.seed);
42

What it prints (run when this page was built)

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