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 · Tiles, layouts and deals

layPairsfunction

Lay these pairs of tiles into the slots present names, or null when no attempt reached the end. Higher slots are a little likelier to be taken first, which keeps the stacks coming down together and leaves fewer attempts stuck on a tower of two.

Import it

import { layPairs } from "@johnmorrisdotca/jarajara";

Definition

function layPairs(geometry: MahjongGeometry, present: readonly boolean[], pairs: readonly (readonly [string, string])[], random: Random): Laid | null

Parameters

NameTypeDescription
geometryMahjongGeometry

The stacked layout’s covering and side-blocking relationships.

presentreadonly boolean[]

Whether each native slot is still occupied or selected for laying.

pairsreadonly (readonly [string, string])[]

Matching tile-face pairs to lay into slots.

randomRandom

A reproducible random source returning values in [0,1).

Returns

Laid | null

Lay these pairs of tiles into the slots present names, or null when no attempt reached the end. Higher slots are a little likelier to be taken first, which keeps the stacks coming down together and leaves fewer attempts stuck on a tower of two.

Examples

import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { geometryOf, layPairs, layoutFor, pairsLeft, seededRandom } from "@johnmorrisdotca/jarajara";

const deal = generateAwase(4,"easy",2026);
const layout = layoutFor(4)!;
const geometry = geometryOf(layout);
const cells = deal.givens;
console.log(layPairs(geometry,layout.slots.map(()=>true),pairsLeft(cells,"group"),seededRandom(42))?.order.length);
4

What it prints (run when this page was built)

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