Reference · Tiles, layouts and deals
takePairfunction
The tiles with a pair taken. The caller has asked canTake.
Import it
import { takePair } from "@johnmorrisdotca/jarajara";
Definition
function takePair(cells: MahjongCells, a: number, b: number): MahjongCells
Parameters
| Name | Type | Description |
|---|---|---|
cells | string | The face-code string in native slot order; dot marks a removed tile. |
a | number | The first tile slot or code specified by this signature. |
b | number | The second tile slot or code specified by this signature. |
Returns
string
The tiles with a pair taken. The caller has asked canTake.
Examples
import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { freePairs, geometryOf, layoutFor, takePair } 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(takePair(cells,pair[0],pair[1]));xPNx.BB.What it prints (run when this page was built)