Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · FreeCell

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

NameTypeDescription
deckreadonly number[]

The deck in its current order; the input is left unchanged.

cellsnumber

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.