Reference · Mazes, arrows and mixed boards
walkfunction
How far every cell is from from along the passages, and the cell before it on the way: -1 where unreachable.
Import it
import { walk } from "@johnmorrisdotca/meikyuu";
Definition
function walk(links: Links, from: number): { dist: Int32Array; before: Int32Array; order: Int32Array; }
Parameters
| Name | Type | Description |
|---|---|---|
links | Links | Passage neighbour lists, one per cell. |
from | number | The start cell or pointer point specified by the signature. |
Returns
{ dist: Int32Array; before: Int32Array; order: Int32Array; }
How far every cell is from from along the passages, and the cell before it on the way: -1 where unreachable.
Examples
import type { MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze, walk } from "@johnmorrisdotca/meikyuu";
const recipe: MazeRecipe = {shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42};
const maze = buildMaze(recipe);
console.log(walk(maze.links,maze.start).order.length);25What it prints (run when this page was built)