Reference · Rules, solvers and generation
onTheBoardfunction
Whether a cell is on the board: every cell of a whole square, the hexagon's own of a plain hexagon, and those a shape keeps.
Import it
import { onTheBoard } from "@johnmorrisdotca/tsunagi";
Definition
function onTheBoard(layout: LinkLayout, at: number): boolean
Parameters
| Name | Type | Description |
|---|---|---|
layout | LinkLayout | The decoded native board and its rule settings. |
at | number | The zero-based cell index. |
Returns
boolean
Whether the cell is on the board.
Examples
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { decodeLayout, onTheBoard } from "@johnmorrisdotca/tsunagi";
console.log(onTheBoard(decodeLayout(TSUNAGI_4[0][0],4)!,0));trueWhat it prints (run when this page was built)