Reference · Shared Awase table
playAtTablefunction
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 it
import { playAtTable } from "@johnmorrisdotca/jarajara/table";
Definition
function playAtTable(table: AwaseTable, a: number, b: number, state?: AwaseTableState | null): { table: AwaseTable; state: AwaseTableState; } | null
Parameters
| Name | Type | Description |
|---|---|---|
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 (optional) | AwaseTableState | null | A previously replayed native table state, or null to read it again. |
Returns
{ 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.
Examples
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 ]What it prints (run when this page was built)