dealFreeCellfunction
Deal a deck (card numbers, the first dealt first) into a table with so many free cells: one card to each column in turn.
Import it
import { dealFreeCell } from "@johnmorrisdotca/toranpu/freecell";
Definition
function dealFreeCell(deck: readonly number[], cells: number): FreeCellTable
Parameters
| Name | Type | Description |
|---|---|---|
deck | readonly number[] | The deck in its current order; the input is left unchanged. |
cells | number | The number of available free cells. |
Returns
FreeCellTable
Deal a deck (card numbers, the first dealt first) into a table with so many free cells: one card to each column in turn.
Examples
import { dealFreeCell, dealOfSeed, deckOf } from "@johnmorrisdotca/toranpu/freecell";
console.log(dealFreeCell(deckOf(dealOfSeed(42))!, 4).tableau.map((column) => column.length));[
7, 7, 7, 7,
6, 6, 6, 6
]What it prints (run when this page was built)