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

ReadGametype

A game read back: which game it is, and the game itself.

Import it

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

Definition

type ReadGame = {
    [K in CardGameKind]: {
        kind: K;
        game: GameOf<K>;
    };
}[CardGameKind];

Examples

import { fromJSON, newGame, toJSON } from "@johnmorrisdotca/toranpu";
import type { ReadGame } from "@johnmorrisdotca/toranpu";

const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
const value: ReadGame = fromJSON(toJSON("hearts", game))!;
console.log(value.kind);
hearts

What it prints (run when this page was built)

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