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
| 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. |
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)