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

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

NameTypeDescription
tableFreeCellTable

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

pileFreeCellPile

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"));
undefined

What it prints (run when this page was built)

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