playAtTable関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The player to move takes this pair: the table and where it now stands, or
null where the rules do not allow it. Played on from state where the
caller holds it, so a turn costs one pair rather than the whole game again.
インポート
import { playAtTable } from "@johnmorrisdotca/jarajara/table";
定義
function playAtTable(table: AwaseTable, a: number, b: number, state?: AwaseTableState | null): { table: AwaseTable; state: AwaseTableState; } | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
table | AwaseTable | The shared native table and its recorded pair takes. |
a | number | The first tile slot or code specified by this signature. |
b | number | The second tile slot or code specified by this signature. |
state (省略可) | AwaseTableState | null | A previously replayed native table state, or null to read it again. |
戻り値
{ table: AwaseTable; state: AwaseTableState; } | null
The player to move takes this pair: the table and where it now stands, or null where the rules do not allow it. Played on from state where the caller holds it, so a turn costs one pair rather than the whole game again.
例
import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { freePairs, geometryOf, layoutFor } from "@johnmorrisdotca/jarajara";
import { playAtTable, readTable, startTable } from "@johnmorrisdotca/jarajara/table";
const deal = generateAwase(4,"easy",2026);
const layout = layoutFor(4)!;
const geometry = geometryOf(layout);
const cells = deal.givens;
const pair = freePairs(geometry,cells,"group")[0];
const table = startTable(deal,[{name:"Seat 1"},{name:"Seat 2"}]);
const state = readTable(table)!;
console.log(playAtTable(table,pair[0],pair[1],state)?.state.scores);[ 3, 0 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。