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

savedGamefunction

A game as the object toJSON writes: its table, its seed and its moves.

Import it

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

Definition

function savedGame<K extends CardGameKind>(kind: K, game: GameOf<K>): SavedGame<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

SavedGame<K>

A game as the object toJSON writes: its table, its seed and its moves.

Examples

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

const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(savedGame("hearts", game));
{
  format: 1,
  generator: 'toranpu 2.15.0',
  game: 'hearts',
  size: 100,
  players: [ 'Aki', 'Ben', 'Cy', 'Dev' ],
  computers: [ false, false, false, false ],
  seed: 42,
  moves: []
}

What it prints (run when this page was built)

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