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

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

20.3 kB minified and gzipped, with everything it imports (measured with esbuild)

Meikyuu over the surface of a solid: a perfect maze on a cube, a globe, the other dice (a tetrahedron, an octahedron, an icosahedron, a ten-sided, a twelve-sided and more) or a shape (a box, a cross of cubes, a ring, a torus, a star, a heart), with the line drawn from one face to the next across the edges. The graph of the surface (solidGridOf), the maze made on it by the very algorithms the flat mazes use (buildSolidMaze, SolidRecipe), the measure of how hard it is (solidDifficultyOf), the arithmetic of looking at a turned solid and of finding the cell under a finger (projectFrame, pickCell), the checker for an answer (checkSolidAnswer) and a still picture as SVG (drawSolid). The game itself (drawing, undo, stones, steps) is the root entry's: it plays any maze, flat or not. The board to play in a page is @johnmorrisdotca/meikyuu/3d/play, and the numbered levels are in @johnmorrisdotca/meikyuu/3d/levels.

Exports

NameKindWhat it is
buildSolidMazefunctionMake the maze a recipe names.
cachedSolidGridfunctionThe grid of a solid cut n ways, kept: a grid is never changed, and a script that makes thousands of mazes of one size builds it once.
cellsAlongDragfunctionThe cells a straight drag from one point to another crosses, in order, by sampling it finely enough that no cell the drag passes through is missed.
checkSolidAnswerfunctionWhether a list of cells is the answer: it starts at the start, ends at the goal, steps from each cell to one joined to it by a passage, and never visits a cell twice.
createFramefunctionRoom for a frame of a solid.
dragTurnfunctionThe turn a drag from one point to another makes: the point of the solid under the first is carried to under the second.
drawSolidfunctionRender a surface maze and optional trail/stones as native SVG text.
DrawSolidOptionstypeA MAZE OVER A SOLID AS SVG TEXT, a still picture of it from one side: the near side's cells shaded by how squarely they face the viewer, the walls that stand, and, if asked, the line, the stones and the way through.
EDGE_FULLconstantThe normalized threshold used for a full native edge turn.
EDGE_NEIGHBOURconstantThe normalized neighbouring-cell edge-turn threshold.
EDGE_RATEconstantThe fastest the solid turns by itself, in radians a second.
EDGE_SAFEconstantTHE SOLID TURNS BY ITSELF to keep the end of a line being drawn in view.
edgeTurnfunctionCompute a view rotation that follows a surface path near an edge, or null when no turn is needed.
faceCellTurnfunctionThe turn that brings the cell round to face the viewer (see facingOf for around), by the shortest way, and then rolls it so that a side of the cell lies level (the cell's own first side, to the nearest of the turns that put one of its sides level).
isSolidCutfunctionWhether a solid can be cut n ways: a whole number of at least 2, or 1 where the solid has already sixty cells uncut (the dodecahedron's five to a face).
isSolidDiefunctionWhether a solid is among the dice (the rest are shapes).
MEIKYUU_MOST_SOLID_CELLSconstantThe most cells a solid may have in a recipe: a little over twice the biggest level.
MEIKYUU_SOLID_PER_LISTconstantHow many levels each size of each solid has: eight pages of eight.
openingTurnfunctionA view of the solid to begin with: the cell faces the viewer, then the solid is tipped a little so that its depth shows and its neighbours on the near side can be seen.
parseSolidRecipefunctionA recipe from its code, or null when it is not one, or names a solid of more than MEIKYUU_MOST_SOLID_CELLS cells.
pickCellfunctionThe cell the point (x, y) of the picture is on, or -1 for none.
projectFramefunctionPut the solid, turned by q and zoomed, on a picture width by height: fills every array of the frame.
QuattypeA rotation: [x, y, z, w], of length one.
QUAT_IDENTITYconstantThe rotation that does nothing.
quatAnglefunctionHow far apart two rotations are, in radians, from 0 to pi.
quatAxisAnglefunctionThe turn of angle radians about an axis (any length but nought).
quatBetweenfunctionThe shortest turn that carries the direction a onto the direction b.
quatMulfunctionTwo rotations in turn: b after a.
quatNormalizefunctionA rotation made one again: the turns a drag adds up carry a little error, which this takes out.
quatSlerpfunctionHalfway (or any share) from one rotation to another along the shortest way.
quatTurnfunctionA point turned.
SOLID_ALGORITHMSconstantThe algorithms that make a maze over a solid: all but Eller's, which needs rows.
SOLID_CUTSconstantHow many ways each solid is cut, for each size: small, medium, large, huge and colossal.
SOLID_DICEconstantThe dice, by how many sides, smallest first.
SOLID_DIE_SIDESconstantHow many sides a die has (what its name on a die is: d6).
SOLID_EYEconstantHow far the eye is from the middle of the solid, in times its reach.
SOLID_FILLconstantThe share of the box the solid's outline fills at most.
SOLID_FIRSTconstantTHE SOLIDS BY HOW THEY ARE MET.
SOLID_KINDSconstantTHE SURFACE OF A SOLID AS A CELL GRAPH: the one thing a maze over a solid is made on.
SOLID_MORE_DICEconstantThe seven dice that came after the first five, and the six shapes.
SOLID_MORE_SHAPESconstantThe additional box, cross, ring, torus, star and heart surface families.
SOLID_SHAPESconstantThe shapes.
SOLID_SIZE_NAMESconstantTHE SIZES OF THE LEVELS OF A SOLID: three to each, small, medium and large, cut so that they come to about the same number of cells whichever solid it is (under a hundred, about three hundred, and six to seven hundred), and so that the one kind of solid is not the easy one: a cube cut 4, 7 and 10 ways has 96, 294 and 600 cells, a globe at frequency 3, 5 and 8 has 92, 252 and 642, an octahedron cut 3, 6 and 9 has 72, 288 and 648.
SOLID_ZOOM_LEASTconstantHow far in and out the picture can be zoomed, as a multiple of the fitted size: in to six, so that a cell of a colossal solid (about six pixels across when the whole solid is in the box) is a finger wide (about 24) at four and has room beyond.
SOLID_ZOOM_MOSTconstantThe maximum native surface-view zoom factor.
SolidAlgorithmtypeA maze-carving algorithm supported on a surface graph.
solidAnswerStepsfunctionThe answer as steps (the format a kept run uses, lineToSteps), for a maze: its whole solution.
solidCellsfunctionHow many cells a solid cut n ways has.
solidCellsOffunctionHow many cells a solid has at a size.
solidCutOffunctionThe cut of a solid at a size.
solidDifficultyOffunctionHow hard a maze over a solid is to play, from 0 to 100, on the very scale flat mazes are scored on (difficultyOf).
SolidEdgetypeThe edge between two cells: its two corners (indices into vertices) and the two cells it lies between.
SolidFrametypeWhere a solid is, as a picture of a given size: the turn, the zoom, and every corner and cell as it lands.
solidGeometryfunctionHow a maze over a solid lies in space, for the measure: squared distance through space to the goal, and the bend of the line in three dimensions.
SolidGridtypeA surface cell graph, neighbouring faces, vertices, projected centres and shape geometry.
solidGridOffunctionThe surface of a solid cut n ways (n at least 2, or 1 for a solid with sixty cells at that): its cells, which are beside which, and where each lies.
SolidKindtypeA supported polyhedron, die or shaped surface for a maze.
SolidMazetypeA maze over a solid: what a flat maze has that is not flat.
SolidRecipetypeEverything that makes a maze over a solid.
solidRecipeCodefunctionA recipe as one short word, such as cube:6:prim:48213, and the other way (parseSolidRecipe).
SolidSizetypeA named small, medium, large, huge or colossal surface-maze collection.
solidSolutionOffunctionThe one way from the start to the goal, cell by cell.
stepTurnfunctionA turn about the viewer's own axes: right radians about the vertical (the solid's near side moves right) and down about the horizontal.
trackballPointfunctionThe point of the trackball a point of the picture is on, for turning by a drag: the unit sphere seen from the front, and, outside it, the rim.
Vec3typeA point or a direction in three dimensions.

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