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

freeCellMoveForfunction

The move that carries the cards held at from to to, if the rules allow exactly those cards there.

Import it

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

Definition

function freeCellMoveFor(table: FreeCellTable, from: FreeCellSpot, to: FreeCellPile): FreeCellMove | null

Parameters

NameTypeDescription
tableFreeCellTable

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

fromFreeCellSpot

The source position or source state specified by this API.

toFreeCellPile

The destination position or state specified by this API.

Returns

FreeCellMove | null

The matching legal carry, or null when the selected cards cannot move there.

Examples

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

const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4);
console.log(freeCellMoveFor(table, { pile: "1", index: table.tableau[0]!.length - 1 }, "a"));
{ from: '1', to: 'a', count: 1 }

What it prints (run when this page was built)

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