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

CardGamePlaystype

Each card game's game and move, so its rules can be named with their own types.

Import it

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

Definition

type CardGamePlays = {
    hearts: {
        game: HeartsGame;
        move: HeartsMove;
    };
    bigTwo: {
        game: BigTwoGame;
        move: ClimbMove;
    };
    president: {
        game: PresidentGame;
        move: PresidentMove;
    };
    goFish: {
        game: GoFishGame;
        move: GoFishMove;
    };
    crazyEights: {
        game: CrazyEightsGame;
        move: CrazyEightsMove;
    };
    spades: {
        game: SpadesGame;
        move: SpadesMove;
    };
    ginRummy: {
        game: GinGame;
        move: GinMove;
    };
    euchre: {
        game: EuchreGame;
        move: EuchreMove;
    };
    cribbage: {
        game: CribbageGame;
        move: CribbageMove;
    };
    ohHell: {
        game: OhHellGame;
        move: OhHellMove;
    };
    war: {
        game: WarGame;
        move: WarMove;
    };
};

Members

NameTypeDescription
hearts{ game: HeartsGame; move: HeartsMove; }
bigTwo{ game: BigTwoGame; move: ClimbMove; }
president{ game: PresidentGame; move: PresidentMove; }
goFish{ game: GoFishGame; move: GoFishMove; }
crazyEights{ game: CrazyEightsGame; move: CrazyEightsMove; }
spades{ game: SpadesGame; move: SpadesMove; }
ginRummy{ game: GinGame; move: GinMove; }
euchre{ game: EuchreGame; move: EuchreMove; }
cribbage{ game: CribbageGame; move: CribbageMove; }
ohHell{ game: OhHellGame; move: OhHellMove; }
war{ game: WarGame; move: WarMove; }

Examples

import type { CardGamePlays } from "@johnmorrisdotca/toranpu";
import { newGame } from "@johnmorrisdotca/toranpu";

const value: CardGamePlays["hearts"]["game"] = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(value.phase);
passing

What it prints (run when this page was built)

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