spiderMoveFor関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The move that carries the cards held at from onto the column to, if the rules allow exactly those cards there.
インポート
import { spiderMoveFor } from "@johnmorrisdotca/toranpu/spider";
定義
function spiderMoveFor(table: SpiderTable, from: SpiderSpot, to: string): SpiderMove | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
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. |
戻り値
SpiderMove | null
The legal run carry, or null when the selected run cannot move onto that column.
例
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。