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

Getting started

Getting started

Build a small seeded maze and read its solution.

A complete native recipe

Install @johnmorrisdotca/meikyuu with npm. Flat maze rules are in the root; drawing, mounting, levels and surface mazes have separate entries.

import {buildMaze,solutionOf,isPerfect,measureMaze} from "@johnmorrisdotca/meikyuu";
const maze = buildMaze({shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42});
console.log(maze.grid.cells,isPerfect(maze.grid,maze.links),solutionOf(maze));
console.log(measureMaze(maze).effort);
25 true [
   6,  5,  0,  1,  2,  7,
   8,  9, 14, 19, 18, 23,
  22, 21, 16, 15
]
31

A recipe includes geometry, dimensions, algorithm, play mode and seed. The same native recipe reproduces the same maze. A perfect maze is a connected passage tree; measuring effort does not start a clock or play a game.

Use recipes and algorithms, native game state, numbered levels or drawing and embeds next. Large mazes and surfaces should be generated in a worker when a custom host must keep input responsive.

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