Reference · Mazes, arrows and mixed boards
MazeCoretype
What the game, the stones, the measure and the steps read of a maze: the passages, the two ends, the keys, and how many cells there are and which
are beside which. A Maze is one, and so is a maze over the surface of a solid (SolidMaze in @johnmorrisdotca/meikyuu/3d), so one set of rules
plays them both.
Import it
import type { MazeCore } from "@johnmorrisdotca/meikyuu";
Definition
type MazeCore = {
readonly links: Links;
readonly start: number;
readonly goal: number;
readonly keys: readonly number[];
readonly grid: {
readonly cells: number;
readonly neighbours: readonly (readonly number[])[];
};
};
Members
| Name | Type | Description |
|---|---|---|
links | Links | |
start | number | |
goal | number | |
keys | readonly number[] | |
grid | { readonly cells: number; readonly neighbours: readonly (readonly number[])[]; } |
Examples
import type { MazeCore, MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze } from "@johnmorrisdotca/meikyuu";
const recipe: MazeRecipe = {shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42};
const maze = buildMaze(recipe);
const value: MazeCore = maze;
console.log(value);{
recipe: {
shape: 'square',
w: 5,
h: 5,
algorithm: 'backtracker',
mode: 'to-goal',
seed: 42
},
grid: {
shape: 'square',
w: 5,
h: 5,
centres: [
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array]
],
sides: [
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array]
],
box: { x: 0, y: 0, w: 5, h: 5 },
at: [Function: at],
cells: 25,
neighbours: [
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array], [Array], [Array],
[Array]
]
},
links: [
[ 1, 5 ], [ 2, 0 ],
[ 7, 3, 1 ], [ 2, 4 ],
[ 3 ], [ 0, 6 ],
[ 5, 11 ], [ 8, 2 ],
[ 9, 7 ], [ 14, 8 ],
[ 11 ], [ 6, 12, 10 ],
[ 11, 17, 13 ], [ 12 ],
[ 19, 9 ], [ 16 ],
[ 15, 21 ], [ 12 ],
[ 23, 19 ], [ 18, 24, 14 ],
[ 21 ], [ 16, 20, 22 ],
[ 21, 23 ], [ 22, 18 ],
[ 19 ]
],
start: 6,
goal: 15,
entrance: null,
exit: null,
keys: []
}What it prints (run when this page was built)