Skip to the content

Meikyuu迷宮

Generate seeded mazes and arrow puzzles, follow numbered levels, and play on flat grids or three-dimensional surfaces.

Meikyuu is the Japanese word 迷宮 for labyrinth. About the name

Contents

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

NameTypeDescription
linksLinks

Passage neighbour lists, one per cell.

fromnumber

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);
25

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/meikyuu 3.2.0.