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

isFreeAmongfunction

Whether a slot's tile could be taken now, among the slots present says are still filled.

Import it

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

Definition

function isFreeAmong(geometry: MahjongGeometry, present: (slot: number) => boolean, slot: number): boolean

Parameters

NameTypeDescription
geometryMahjongGeometry

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

present(slot: number) => boolean

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

slotnumber

The zero-based slot index or slot coordinates specified by this signature.

Returns

boolean

Whether a slot's tile could be taken now, among the slots present says are still filled.

Examples

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

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];
console.log(isFreeAmong(geometry,slot=>cells[slot]!==".",pair[0]));
true

What it prints (run when this page was built)

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