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

playFreeCellfunction

The table after a move, or null where the rules refuse it.

Import it

import { playFreeCell } from "@johnmorrisdotca/toranpu/freecell";

Definition

function playFreeCell(table: FreeCellTable, move: FreeCellMove): FreeCellTable | null

Parameters

NameTypeDescription
tableFreeCellTable

The native solitaire table; move helpers leave the input unchanged.

moveFreeCellMove

The native move to validate or apply.

Returns

FreeCellTable | null

The table after a move, or null where the rules refuse it.

Examples

import { dealFreeCell, dealOfSeed, deckOf, movesFrom, playFreeCell } from "@johnmorrisdotca/toranpu/freecell";

const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
console.log(playFreeCell(table, movesFrom(table)[0]!)?.tableau.map((column) => column.length));
[
  6, 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.