Reference · Tiles, layouts and deals
matchesOffunction
EVERY TILE THAT MATCHES A SLOT'S, under the bonus rule in play, told apart by whether it could be taken with it now. A tile's own slot is never in either list, and an empty slot has no matches. Pure: it reads the tiles as they lie.
Import it
import { matchesOf } from "@johnmorrisdotca/jarajara";
Definition
function matchesOf(geometry: MahjongGeometry, cells: MahjongCells, rule: MahjongBonusRule, slot: number): MatchesOf
Parameters
| Name | Type | Description |
|---|---|---|
geometry | MahjongGeometry | The stacked layout’s covering and side-blocking relationships. |
cells | string | The face-code string in native slot order; dot marks a removed tile. |
rule | MahjongBonusRule | Grouped or identical bonus matching. |
slot | number | The zero-based slot index or slot coordinates specified by this signature. |
Returns
MatchesOf
EVERY TILE THAT MATCHES A SLOT'S, under the bonus rule in play, told apart by whether it could be taken with it now. A tile's own slot is never in either list, and an empty slot has no matches. Pure: it reads the tiles as they lie.
Examples
import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { freePairs, geometryOf, layoutFor, matchesOf } 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(matchesOf(geometry,cells,"group",pair[0]));{ free: [ 7 ], blocked: [] }What it prints (run when this page was built)