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 · Spider

spiderMoveForfunction

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

Import it

import { spiderMoveFor } from "@johnmorrisdotca/toranpu/spider";

Definition

function spiderMoveFor(table: SpiderTable, from: SpiderSpot, to: string): SpiderMove | null

Parameters

NameTypeDescription
tableSpiderTable

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

fromSpiderSpot

The source position or source state specified by this API.

tostring

The destination position or state specified by this API.

Returns

SpiderMove | null

The legal run carry, or null when the selected run cannot move onto that column.

Examples

import { dealSpider, spiderDealOfSeed, spiderDeckOf, spiderMoveFor } from "@johnmorrisdotca/toranpu/spider";

const table = dealSpider(spiderDeckOf(spiderDealOfSeed(42, 1), 1)!);
console.log(spiderMoveFor(table, { pile: "0", index: table.tableau[0]!.cards.length - 1 }, "1"));
null

What it prints (run when this page was built)

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