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

solveKlondikefunction

A winning line from this table — every move, the safe ones home included, that a replay of it makes — or null when none was found within budget tables. budget is a count, never a time, so every browser agrees.

Import it

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

Definition

function solveKlondike(start: KlondikeTable, budget?: number): { moves: KlondikeMove[] | null; tables: number; }

Parameters

NameTypeDescription
startKlondikeTable

The initial game or state before the recorded moves.

budget (optional)number

Limits on the solver’s search work.

Returns

{ moves: KlondikeMove[] | null; tables: number; }

A winning line from this table — every move, the safe ones home included, that a replay of it makes — or null when none was found within budget tables. budget is a count, never a time, so every browser agrees.

Examples

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

const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 });
console.log(solveKlondike(table, 100));

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