Reference · Tiles, layouts and deals
MahjongLayouttype
A stacked layout: its slots in reading order (layer by layer, row by row), which is the order a deal is written in.
Import it
import type { MahjongLayout } from "@johnmorrisdotca/jarajara";
Definition
type MahjongLayout = {
size: number;
key: string;
slots: readonly MahjongSlot[];
};
Members
| Name | Type | Description |
|---|---|---|
size | number | The layout's width in tiles: its "size", unique among the layouts. |
key | string | |
slots | readonly MahjongSlot[] |
Examples
import { layoutFor } from "@johnmorrisdotca/jarajara";
import type { MahjongLayout } from "@johnmorrisdotca/jarajara";
const layout = layoutFor(4)!;
const value: MahjongLayout = layout;
console.log(value);{
size: 4,
key: 'tiny',
slots: [
{ x: 0, y: 0, z: 0 },
{ x: 2, y: 0, z: 0 },
{ x: 4, y: 0, z: 0 },
{ x: 6, y: 0, z: 0 },
{ x: 1, y: 0, z: 1 },
{ x: 3, y: 0, z: 1 },
{ x: 5, y: 0, z: 1 },
{ x: 3, y: 0, z: 2 }
]
}What it prints (run when this page was built)