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 · Playable surface mazes

mountSolidfunction

Draw a maze over a solid into host and play it. Returns the handle that drives it, or null for a recipe that is none.

Import it

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

Definition

function mountSolid(host: HTMLElement, options: SolidMountOptions): SolidMount | null

Parameters

NameTypeDescription
hostHTMLElement

The DOM host receiving the native player or styles.

optionsSolidMountOptions

Native display/mount choices, or the point tuple specified by this signature.

Returns

SolidMount | null

The native surface player, or null for invalid recipe or a view that cannot be mounted.

Examples

import type { MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze } from "@johnmorrisdotca/meikyuu";
import type { SolidRecipe } from "@johnmorrisdotca/meikyuu/3d";
import { mountSolid } from "@johnmorrisdotca/meikyuu/3d/play";

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 solidRecipe: SolidRecipe = {kind:"cube",n:2,algorithm:"backtracker",seed:42};
const host = document.createElement("div");
document.body.append(host);
const player = mountSolid(host,{recipe:solidRecipe});
console.log(player?.maze().grid.cells);
player?.destroy();

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