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

rulesForfunction

A game's rules by its kind, with its own game and move types.

Import it

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

Definition

function rulesFor<K extends CardGameKind>(kind: K): CardGameRules<GameOf<K>, MoveOf<K>>

Parameters

NameTypeDescription
kindK

The named card game or sound kind.

Returns

CardGameRules<GameOf<K>, MoveOf<K>>

A game's rules by its kind, with its own game and move types.

Examples

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

const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(rulesFor("hearts").moves(game).length);
286

What it prints (run when this page was built)

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