Reference · Four-neighbour rules
orthogonalNeighboursfunction
Returns the adjacent cells under the orthogonal rules.
Import it
import { orthogonalNeighbours } from "@johnmorrisdotca/jirai/orthogonal";
Also exported from: @johnmorrisdotca/jirai
Definition
function orthogonalNeighbours(settings: OrthogonalSettings, cell: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
settings | OrthogonalSettings | 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[]
Returns the adjacent cells under the orthogonal rules.
Examples
import type { OrthogonalSettings } from "@johnmorrisdotca/jirai/orthogonal";
import { orthogonalNeighbours } from "@johnmorrisdotca/jirai/orthogonal";
const orthogonalSettings: OrthogonalSettings={width:3,height:3,mines:1,noGuess:false,opening:"clear",seed:42};
console.log(orthogonalNeighbours(orthogonalSettings,0));[ 1, 3 ]What it prints (run when this page was built)