本文へ移動

Meikyuu迷宮

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

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

目次

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

MazeCore型

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

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 type { MazeCore } from "@johnmorrisdotca/meikyuu";

定義

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[])[];
    };
};

メンバー

名前型説明
linksLinks
startnumber
goalnumber
keysreadonly number[]
grid{ readonly cells: number; readonly neighbours: readonly (readonly number[])[]; }

例

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: []
}

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

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

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