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

moveTextfunction

A move in words, for any of the eleven games: moveText("hearts", { play: "QS" }) is "Play Q♠", and with { form: "did" } it is "plays Q♠". kind is needed because a bid of nought is "nil" in Spades and "0" in Oh Hell.

Import it

import { moveText } from "@johnmorrisdotca/toranpu";

Definition

function moveText<K extends CardGameKind>(kind: K, move: MoveOf<K>, options?: MoveTextOptions): string

Parameters

NameTypeDescription
kindK

The named card game or sound kind.

moveMoveOf<K>

The native move to validate or apply.

options (optional)MoveTextOptions

Options for this call; omitted fields retain their documented defaults.

Returns

string

A move in words, for any of the eleven games: moveText("hearts", { play: "QS" }) is "Play Q♠", and with { form: "did" } it is "plays Q♠". kind is needed because a bid of nought is "nil" in Spades and "0" in Oh Hell.

Examples

import { moveText, newGame, rulesFor } from "@johnmorrisdotca/toranpu";

const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(moveText("hearts", rulesFor("hearts").moves(game)[0]!, { language: "en" }));
Pass 2♣ 3♣ 7♣

What it prints (run when this page was built)

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