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

FreeCellTabletype

A game of FreeCell as it stands: the columns, the free cells and the foundations.

Import it

import type { FreeCellTable } from "@johnmorrisdotca/toranpu/freecell";

Definition

type FreeCellTable = {
    tableau: readonly (readonly number[])[];
    cells: readonly (number | null)[];
    foundation: readonly number[];
};

Members

NameTypeDescription
tableaureadonly (readonly number[])[]

Eight columns, each its cards from the bottom up. Every card is face up.

cellsreadonly (number | null)[]

The free cells, one card or none each: four in the classic game, fewer to make it harder.

foundationreadonly number[]

How many cards are home on each suit's foundation, in SUITS order: its top card is that rank.

Examples

import { dealFreeCell } from "@johnmorrisdotca/toranpu/freecell";
import { dealOfSeed, deckOf } from "@johnmorrisdotca/toranpu/klondike";
import type { FreeCellTable } from "@johnmorrisdotca/toranpu/freecell";

const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
const value: FreeCellTable = table;
console.log(value.cells.length);
4

What it prints (run when this page was built)

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