本文へ移動

Meikyuu迷宮

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

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

目次

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

ArrowGame型

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

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

定義

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;
};

メンバー

名前型説明
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.

例

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
}

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

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

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