freeCellHomeMovefunction
The move that sends a top card home, if it can go: what a double tap does.
Import it
import { freeCellHomeMove } from "@johnmorrisdotca/toranpu/freecell";
Definition
function freeCellHomeMove(table: FreeCellTable, spot: FreeCellSpot): FreeCellMove | null
Parameters
| Name | Type | Description |
|---|---|---|
table | FreeCellTable | The native solitaire table; move helpers leave the input unchanged. |
spot | FreeCellSpot | The source or destination card location. |
Returns
FreeCellMove | null
The legal foundation move, or null when the selected card cannot go home.
Examples
import { dealFreeCell, dealOfSeed, deckOf, freeCellHomeMove } from "@johnmorrisdotca/toranpu/freecell";
const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
console.log(freeCellHomeMove(table, { pile: "1", index: table.tableau[0]!.length - 1 }));nullWhat it prints (run when this page was built)