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
| Name | Type | Description |
|---|---|---|
table | SpiderTable | The native solitaire table; move helpers leave the input unchanged. |
from | SpiderSpot | The source position or source state specified by this API. |
to | string | 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"));nullWhat it prints (run when this page was built)