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

ArrowGametype

AN ARROW PUZZLE BEING PLAYED, as pure functions. tapArrow is the one move: a free arrow is taken off the board; a blocked one costs a heart (and says which arrow is in its way); a locked one that has not been unlocked does nothing at all, and costs nothing, because the player cannot know yet. The same goes for an arrow that no order of taps can clear before the unlock, because a locked arrow is in its way, directly or behind others (locked, with by naming the arrow to look at): nothing the player does can free it, so it must not cost the hearts the puzzle is lost with, and a mixed puzzle cannot be lost before the labyrinth has even been tried. Clear every arrow to win; lose the last heart and the puzzle is lost until it is restarted.

The mixed puzzles lock some arrows until a button deep in a maze is reached. unlockArrows is what reaching it does.

Import it

import type { ArrowGame } from "@johnmorrisdotca/meikyuu";

Definition

type ArrowGame = {
    readonly board: ArrowBoard;
    readonly present: readonly boolean[];
    readonly hearts: number;
    readonly heartsAtStart: number;
    readonly unlocked: boolean;
    readonly status: "playing" | "cleared" | "lost";
    readonly taken: readonly number[];
    readonly mistakes: number;
};

Members

NameTypeDescription
boardArrowBoard
presentreadonly boolean[]

Whether each arrow is still on the board.

heartsnumber
heartsAtStartnumber
unlockedboolean

Whether the locked arrows have been unlocked.

status"playing" | "cleared" | "lost"
takenreadonly number[]

The arrows taken, in order, for Undo and for the page's own record.

mistakesnumber

Taps that cost a heart.

Examples

import type { ArrowGame, ArrowRecipe } from "@johnmorrisdotca/meikyuu";
import { makeArrows, newArrowGame } from "@johnmorrisdotca/meikyuu";

const arrowRecipe: ArrowRecipe = {shape:"square",w:5,h:5,longest:3,seed:42};
const arrows = makeArrows(arrowRecipe);
const arrowGame = newArrowGame(arrows);
const value: ArrowGame = arrowGame;
console.log(value);
{
  board: {
    recipe: { shape: 'square', w: 5, h: 5, longest: 3, seed: 42 },
    w: 5,
    h: 5,
    inShape: [
      true, true, true, true, true,
      true, true, true, true, true,
      true, true, true, true, true,
      true, true, true, true, true,
      true, true, true, true, true
    ],
    arrows: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    locked: [
      false, false, false,
      false, false, false,
      false, false, false,
      false, false, false,
      false
    ]
  },
  present: [
    true, true, true,
    true, true, true,
    true, true, true,
    true, true, true,
    true
  ],
  hearts: 3,
  heartsAtStart: 3,
  unlocked: true,
  status: 'playing',
  taken: [],
  mistakes: 0
}

What it prints (run when this page was built)

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