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
| Name | Type | Description |
|---|---|---|
orientation | "portrait" | "landscape" | "auto" | Portrait, landscape or automatic native orientation. |
box | Box | The viewport dimensions and logical board bounds, or board bounds specified by the signature. |
ratio | number | 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}));0What it prints (run when this page was built)