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

MazeCoveragetype

HOW MUCH OF THE MAP THE ANSWER COVERS (coverageOf): the second half of a maze's difficulty. The first half (difficultyOf's six terms) counts what a person meets on the way: forks, traps, wrong turns, bends, the size of it all. It cannot tell a maze whose answer crosses the whole map from one of the very same size whose answer stays in a corner and a short arm, and the second is the easier to play. John, 2026-10-06: a Huge cross maze whose answer sat in the middle and one arm, 134 cells of 4,736, read four dots of five. The family's rule, written once for every package with levels (LEVELS-STANDARD.md in johnmorrisdotca/.github), is: a level's difficulty counts how much of the map its answer covers.

Here that is two shares, each from 0 to 1, counted off the cell centres and the answer, so they are the same in every engine:

  • bbox: the box that holds the answer (and the trips to its keys) over the box that holds the maze, along each axis, as a geometric mean over the axes (two for a flat maze, three for a solid). An answer that stays on one side has a thin box.
  • zones: the maze is cut into a grid of zones, 2 by 2 under 150 cells, 3 by 3 under 800 and 4 by 4 above (2 by 2 by 2 under 200 cells and 3 by 3 by 3 above, for a solid), and a zone counts as visited when the answer has at least ZONE_VISIT cells in it. A zone with less than a quarter of an average zone's cells is left out, so a cross is cut to its arms and a ring to its ring. The share is of the cells' area, not of the zones. A solid's is divided by SOLID_ZONES_TOP (clamped to 1): a shell has no inside, so even a tour of all of it touches only about three quarters of the three-dimensional zones.

cover is the two averaged, with the bottom fifth taken off and the rest stretched to 0 to 1 ((0.5 * bbox + 0.5 * zones - 0.2) / 0.7, held between 0 and 1), and factor is 0.5 + 0.5 * cover: the difficulty is multiplied by it. A maze whose answer covers the map keeps its score; one whose answer stays in a corner counts for half. It is a factor and not a seventh term, because a term added would give every small maze a bonus (a small maze is covered by any answer) and a factor leaves them alone. docs/LEVELS.md explains the choices and the numbers.

Import it

import type { MazeCoverage } from "@johnmorrisdotca/meikyuu";

Definition

type MazeCoverage = {
    bbox: number;
    zones: number;
    cover: number;
    factor: number;
};

Members

NameTypeDescription
bboxnumber

The answer's box over the maze's, from 0 to 1.

zonesnumber

The share of the map's area, in zones the answer visits, from 0 to 1.

covernumber

The two, averaged and stretched, from 0 (a corner) to 1 (the whole map).

factornumber

What the score is multiplied by: 0.5 at no cover, 1 at all of it.

Examples

import type { MazeCoverage, MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze, coverageOf, solutionOf } from "@johnmorrisdotca/meikyuu";

const recipe: MazeRecipe = {shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42};
const maze = buildMaze(recipe);
const grid = maze.grid;
const route = solutionOf(maze);
const value: MazeCoverage = coverageOf(grid.centres,route);
console.log(value);
{ bbox: 1, zones: 1, cover: 1, factor: 1 }

What it prints (run when this page was built)

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