Reference · Number-puzzle engines
neighboursfunction
The cells sharing an edge with index.
Import it
import { neighbours } from "@johnmorrisdotca/kazu";
Definition
function neighbours(size: number, index: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
size | number | The supported square grid side length. |
index | number | The zero-based row-major cell index. |
Returns
number[]
The cells sharing an edge with index.
Examples
import { neighbours } from "@johnmorrisdotca/kazu";
console.log(neighbours(4,0));[ 4, 1 ]What it prints (run when this page was built)