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

freePairsfunction

Every pair that could be taken now, each once, lower slot first, in slot order.

Import it

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

Definition

function freePairs(geometry: MahjongGeometry, cells: MahjongCells, rule: MahjongBonusRule): [number, number][]

Parameters

NameTypeDescription
geometryMahjongGeometry

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

cellsstring

The face-code string in native slot order; dot marks a removed tile.

ruleMahjongBonusRule

Grouped or identical bonus matching.

Returns

[number, number][]

Every pair that could be taken now, each once, lower slot first, in slot order.

Examples

import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { freePairs, geometryOf, layoutFor } from "@johnmorrisdotca/jarajara";

const deal = generateAwase(4,"easy",2026);
const layout = layoutFor(4)!;
const geometry = geometryOf(layout);
const cells = deal.givens;
console.log(freePairs(geometry,cells,"group"));
[ [ 4, 7 ] ]

What it prints (run when this page was built)

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