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 · Surface maze rules and geometry

SOLID_KINDSconstant

THE SURFACE OF A SOLID AS A CELL GRAPH: the one thing a maze over a solid is made on. A solid is a closed surface cut into cells; each cell has the cells beside it, one across each of its sides, and nothing is the edge of the shape, because a surface has none. The generators, the measure and the game read only cells and neighbours (as they do for a flat maze), so a maze over a cube is carved by the very same algorithms as a maze on a page, and what is new is only where the cells lie in space.

Five solids were the first, each cut into cells in a way that suits it:

  • cube: six squares, each n by n, with the cells of one face joined to the cells of the next across every edge of the cube (6 n^2 cells).
  • sphere: a geodesic globe, a football: the dual of an icosahedron cut n ways along each edge, so its cells are 12 pentagons and the rest hexagons (10 n^2 + 2 cells). It was weighed against a cube with its corners rounded off, which has the very graph of the cube and so would be the same maze in a different coat. The football's cells are nearly equal in size all over the globe, with no poles and no seams; its twelve pentagons are the corners, each with only five ways out.
  • tetrahedron, octahedron, icosahedron: four, eight and twenty triangles, each cut n ways along its edges into n^2 small triangles (4 n^2, 8 n^2 and 20 n^2 cells). A triangle has three ways out, so these mazes branch least and run longest.

Twelve more came after them (solidShapes.ts): the dice a person may know (the dodecahedron, the ten-sided trapezohedron, the rhombic and deltoidal ones, a bipyramid and a prism) and shapes that are not dice (a box, a cross of cubes, a ring, a star and a heart). They are cut into cells the same way: every polygon face of the shape is divided into smaller ones, and the cells of one face are joined to the next across every edge.

A cell is a flat polygon (a curved cell of the sphere is the flat polygon through its corners). Its sides are in a fixed order, counter-clockwise seen from outside, starting at a corner that is fixed by how the grid is built, and neighbours[cell][side] is the cell across that side. That order is part of the format: a line kept as steps (lineToSteps) is the position of each cell among its predecessor's neighbours, so it is the same line for ever and on every device. Everything that decides the graph is integer arithmetic (a corner is found by whole-number weights, never by a rounded coordinate), so the same solid is the same graph in every browser and every Node.

Import it

import { SOLID_KINDS } from "@johnmorrisdotca/meikyuu/3d";

Also exported from: @johnmorrisdotca/meikyuu/3d/levels, @johnmorrisdotca/meikyuu/3d/levels/dice, @johnmorrisdotca/meikyuu/3d/levels/shapes, @johnmorrisdotca/meikyuu/3d/levels/all

Definition

const SOLID_KINDS: readonly ["cube", "sphere", "tetrahedron", "octahedron", "icosahedron", "prism", "trapezohedron", "dodecahedron", "rhombic-dodecahedron", "bipyramid", "icositetrahedron", "triacontahedron", "box", "cross", "ring", "torus", "star", "heart"] = ["cube", "sphere", "tetrahedron", "octahedron", "icosahedron", ...SOLID_SHAPE_KINDS] as const

Examples

import { SOLID_KINDS } from "@johnmorrisdotca/meikyuu/3d";
console.log(SOLID_KINDS);
[
  'cube',                 'sphere',
  'tetrahedron',          'octahedron',
  'icosahedron',          'prism',
  'trapezohedron',        'dodecahedron',
  'rhombic-dodecahedron', 'bipyramid',
  'icositetrahedron',     'triacontahedron',
  'box',                  'cross',
  'ring',                 'torus',
  'star',                 'heart'
]

What it prints (run when this page was built)

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