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 · Klondike

movesFromfunction

Every move the rules allow from this table, in a fixed order: to the foundations first, then onto the columns, then the stock. The table's own list, for a solver and a stuck-game check; a person's move is checked by playKlondike alone.

Import it

import { movesFrom } from "@johnmorrisdotca/toranpu/klondike";

Definition

function movesFrom(table: KlondikeTable): KlondikeMove[]

Parameters

NameTypeDescription
tableKlondikeTable

The native solitaire table; move helpers leave the input unchanged.

Returns

KlondikeMove[]

Every move the rules allow from this table, in a fixed order: to the foundations first, then onto the columns, then the stock. The table's own list, for a solver and a stuck-game check; a person's move is checked by playKlondike alone.

Examples

import { dealKlondike, dealOfSeed, deckOf, movesFrom } from "@johnmorrisdotca/toranpu/klondike";

const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 });
console.log(movesFrom(table).slice(0, 5));
[
  { kind: 'carry', from: '1', to: '3' },
  { kind: 'carry', from: '2', to: '7' },
  { kind: 'carry', from: '3', to: '6' },
  { kind: 'draw' }
]

What it prints (run when this page was built)

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