Reference · Mazes, arrows and mixed boards
gridOffunction
A grid by name. w and h are columns and rows for squares, hexagons and triangles, and the size of the raster a shape is cut from for the rest (h is ignored there); for a circle w is the number of rings, and for a hexagon the radius, and for a pyramid the rows.
Import it
import { gridOf } from "@johnmorrisdotca/meikyuu";
Definition
function gridOf(shape: MeikyuuShape, w: number, h?: number): Grid
Parameters
| Name | Type | Description |
|---|---|---|
shape | "square" | "circle" | "hex" | "triangle" | "heart" | "leaf" | "star" | "ring" | "diamond" | "cross" | "moon" | "hexagon" | "pyramid" | The supported native flat-grid geometry or cut-out shape. |
w | number | The native grid width in cells. |
h (optional) | number | The native grid height in cells. |
Returns
Grid
A grid by name. w and h are columns and rows for squares, hexagons and triangles, and the size of the raster a shape is cut from for the rest (h is ignored there); for a circle w is the number of rings, and for a hexagon the radius, and for a pyramid the rows.
Examples
import { gridOf } from "@johnmorrisdotca/meikyuu";
console.log(gridOf("heart",9,9).cells);52What it prints (run when this page was built)