Reference · Tiles, layouts and deals
MahjongGeometrytype
What stands on and beside each slot, worked out once per layout: the slots over it (any higher layer overlapping it), and the slots touching its left and right sides on its own layer.
Import it
import type { MahjongGeometry } from "@johnmorrisdotca/jarajara";
Definition
type MahjongGeometry = {
layout: MahjongLayout;
above: readonly (readonly number[])[];
left: readonly (readonly number[])[];
right: readonly (readonly number[])[];
};
Members
| Name | Type | Description |
|---|---|---|
layout | MahjongLayout | |
above | readonly (readonly number[])[] | |
left | readonly (readonly number[])[] | |
right | readonly (readonly number[])[] |
Examples
import { geometryOf, layoutFor } from "@johnmorrisdotca/jarajara";
import type { MahjongGeometry } from "@johnmorrisdotca/jarajara";
const layout = layoutFor(4)!;
const geometry = geometryOf(layout);
const value: MahjongGeometry = geometry;
console.log(value);{
layout: {
size: 4,
key: 'tiny',
slots: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object]
]
},
above: [ [ 4 ], [ 4, 5, 7 ], [ 5, 6, 7 ], [ 6 ], [], [ 7 ], [], [] ],
left: [
[], [ 0 ], [ 1 ],
[ 2 ], [], [ 4 ],
[ 5 ], []
],
right: [
[ 1 ], [ 2 ], [ 3 ],
[], [ 5 ], [ 6 ],
[], []
]
}What it prints (run when this page was built)