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

resolveTurnfunction

The turn an orientation means for a maze, given the room when it is auto.

Import it

import { resolveTurn } from "@johnmorrisdotca/meikyuu";

Definition

function resolveTurn(orientation: MeikyuuOrientation, box: Box, ratio: number, room: { width: number; height: number; } | null): Turn

Parameters

NameTypeDescription
orientation"portrait" | "landscape" | "auto"

Portrait, landscape or automatic native orientation.

boxBox

The viewport dimensions and logical board bounds, or board bounds specified by the signature.

rationumber

The desired display ratio.

room{ width: number; height: number; } | null

Available viewport width/height, or null before layout.

Returns

Turn

The turn an orientation means for a maze, given the room when it is auto.

Examples

import type { MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze, resolveTurn } 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 box = {width:390,height:844,area:grid.box};
console.log(resolveTurn("auto",grid.box,1,{width:390,height:844}));
0

What it prints (run when this page was built)

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