本文へ移動

Meikyuu迷宮

シード付きの迷路と矢印パズルを作り、番号付きの問題を進め、平面や立体表面で遊べます。

「迷宮」は迷路のように入り組んだ場所を表す言葉です。 名前について(英語)

目次

リファレンス · 迷路・矢印・混合の盤

MazeMeasure型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

HOW HARD A MAZE IS, measured from the maze alone (docs/MAZES.md says why each number is here). Everything is a whole number counted off the passages, so the same maze measures the same in every engine, and a level list ordered by effort stays ordered.

effort is an estimate, in cells drawn, of what a person does to solve it: the length of the way through, plus the length of the wrong turns taken (a person who meets a fork takes the wrong side half the time and walks to the end of it before turning back, so half of two times the depth of each wrong branch), plus two for every fork on the way (looking, and deciding), plus what collecting the keys adds. A big maze with a long way through costs more than a small one with many dead ends, as it takes longer to draw; two mazes of one size cost what their branching makes them.

インポート

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

定義

type MazeMeasure = {
    cells: number;
    deadEnds: number;
    deadEndShare: number;
    junctions: number;
    river: number;
    solution: number;
    decisions: number;
    branches: number;
    longestBranch: number;
    wasted: number;
    detour: number;
    effort: number;
};

メンバー

名前型説明
cellsnumber
deadEndsnumber

Cells with one passage.

deadEndSharenumber
junctionsnumber

Cells with three or more passages.

rivernumber

The share of cells with exactly two passages: a high river is a maze of long winding corridors.

solutionnumber

Cells on the way from the start to the goal, both included.

decisionsnumber

Places on the way where the line could have gone another way.

branchesnumber

Wrong branches that leave the way.

longestBranchnumber

The length of the longest of them, to its end.

wastednumber

The lengths of all the wrong branches, added up.

detournumber

What collecting the keys costs: there and back to each, off the way.

effortnumber

例

import type { MazeMeasure, MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze, measureMaze } 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: MazeMeasure = measureMaze(maze);
console.log(value);
{
  cells: 25,
  deadEnds: 7,
  deadEndShare: 0.28,
  junctions: 5,
  river: 0.52,
  solution: 16,
  decisions: 4,
  branches: 4,
  longestBranch: 3,
  wasted: 7,
  detour: 0,
  effort: 31
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/meikyuu 3.2.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。