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

solveFreeCellfunction

A winning line from this table — every move a replay of it makes, the safe ones home included — or null when none was found within budget tables. Best first (bestFirst): the table that looks nearest to won is opened next.

Import it

import { solveFreeCell } from "@johnmorrisdotca/toranpu/freecell";

Definition

function solveFreeCell(start: FreeCellTable, budget?: number): { moves: FreeCellMove[] | null; tables: number; }

Parameters

NameTypeDescription
startFreeCellTable

The initial game or state before the recorded moves.

budget (optional)number

Limits on the solver’s search work.

Returns

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

A winning line from this table — every move a replay of it makes, the safe ones home included — or null when none was found within budget tables. Best first (bestFirst): the table that looks nearest to won is opened next.

Examples

import { dealFreeCell, dealOfSeed, deckOf, solveFreeCell } from "@johnmorrisdotca/toranpu/freecell";

const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
console.log(solveFreeCell(table, 100));

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