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 · Gin Rummy

GinMovetype

A card drawn from the stock or taken from the discard pile, or a card thrown: laid on the pile, or face down to knock.

Import it

import type { GinMove } from "@johnmorrisdotca/toranpu/gin-rummy";

Definition

type GinMove = {
    draw: "stock";
} | {
    draw: "discard";
} | {
    discard: CardId;
} | {
    knock: CardId;
};

Examples

import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import type { GinMove } from "@johnmorrisdotca/toranpu/gin-rummy";

const names = Array.from({ length: CARD_GAME_TABLES.ginRummy.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("ginRummy", { players: names, seed: 42 })!;
const value: GinMove = rulesFor("ginRummy").moves(game)[0]!;
console.log(value);
{ draw: 'stock' }

What it prints (run when this page was built)

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