Reference · Tiles, layouts and deals
isFreefunction
Whether the tile in this slot is free.
Import it
import { isFree } from "@johnmorrisdotca/jarajara";
Definition
function isFree(geometry: MahjongGeometry, cells: MahjongCells, slot: number): boolean
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. |
slot | number | The zero-based slot index or slot coordinates specified by this signature. |
Returns
boolean
Whether the tile in this slot is free.
Examples
import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { freePairs, geometryOf, isFree, 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(isFree(geometry,cells,pair[0]));trueWhat it prints (run when this page was built)