Reference · Rules, generation and deductions
neighboursfunction
Every neighbour once. Wrap joins both pairs of opposite edges.
Import it
import { neighbours } from "@johnmorrisdotca/jirai";
Definition
function neighbours(settings: Settings, cell: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
settings | Settings | The validated native field dimensions, mine count, topology, shape, opening, generation policy and numeric seed. |
cell | number | An active native cell index in row-major board order. |
Returns
number[]
Every neighbour once. Wrap joins both pairs of opposite edges.
Examples
import type { Settings } from "@johnmorrisdotca/jirai";
import { neighbours } from "@johnmorrisdotca/jirai";
const settings: Settings={width:3,height:3,mines:1,grid:"square",noGuess:false,opening:"clear",seed:42};
console.log(neighbours(settings,0));[ 1, 3, 4 ]What it prints (run when this page was built)