freeCellMoveForfunction
The move that carries the cards held at from to to, if the rules allow exactly those cards there.
Import it
import { freeCellMoveFor } from "@johnmorrisdotca/toranpu/freecell";
Definition
function freeCellMoveFor(table: FreeCellTable, from: FreeCellSpot, to: FreeCellPile): FreeCellMove | null
Parameters
| Name | Type | Description |
|---|---|---|
table | FreeCellTable | The native solitaire table; move helpers leave the input unchanged. |
from | FreeCellSpot | The source position or source state specified by this API. |
to | FreeCellPile | The destination position or state specified by this API. |
Returns
FreeCellMove | null
The matching legal carry, or null when the selected cards cannot move there.
Examples
import { dealFreeCell, dealOfSeed, deckOf, freeCellMoveFor } from "@johnmorrisdotca/toranpu/freecell";
const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
console.log(freeCellMoveFor(table, { pile: "1", index: table.tableau[0]!.length - 1 }, "a"));{ from: '1', to: 'a', count: 1 }What it prints (run when this page was built)