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
| Name | Type | Description |
|---|---|---|
start | FreeCellTable | 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));