Skip to the content

Jarajaraジャラジャラ

Draw mahjong tiles, arrange racks and stacked boards, and play seeded Awase alone or at a shared table.

Jarajara is the Japanese sound of mahjong tiles rattling together. About the name

Contents

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

NameTypeDescription
tableAwaseTable

The shared native table and its recorded pair takes.

anumber

The first tile slot or code specified by this signature.

bnumber

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jarajara 1.7.0.