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

playComputersfunction

Every computer move due, played in turn until a person is to move or the game is over. Returns the game and the moves the computers made, in order, so a table can show them one at a time.

Import it

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

Definition

function playComputers<K extends CardGameKind>(kind: K, game: GameOf<K>): { game: GameOf<K>; moves: MoveOf<K>[]; }

Parameters

NameTypeDescription
kindK

The named card game or sound kind.

gameGameOf<K>

The current native game; applying a move returns a new state.

Returns

{ game: GameOf<K>; moves: MoveOf<K>[]; }

Every computer move due, played in turn until a person is to move or the game is over. Returns the game and the moves the computers made, in order, so a table can show them one at a time.

Examples

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

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

What it prints (run when this page was built)

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