topOffunction
The top card of a pile, or undefined where it holds none (a foundation's top is its suit at its count).
Import it
import { topOf } from "@johnmorrisdotca/toranpu/freecell";
Definition
function topOf(table: FreeCellTable, pile: FreeCellPile): number | undefined
Parameters
| Name | Type | Description |
|---|---|---|
table | FreeCellTable | The native solitaire table; move helpers leave the input unchanged. |
pile | FreeCellPile | The pile to inspect or arrange. |
Returns
number | undefined
The top card of a pile, or undefined where it holds none (a foundation's top is its suit at its count).
Examples
import { dealFreeCell, dealOfSeed, deckOf, topOf } from "@johnmorrisdotca/toranpu/freecell";
const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
console.log(topOf(table, "a"));undefinedWhat it prints (run when this page was built)