isPerfect関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether the passages are a spanning tree of the grid: every cell reached, and exactly one way to each.
インポート
import { isPerfect } from "@johnmorrisdotca/meikyuu";
定義
function isPerfect(grid: MazeCore["grid"], links: Links): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
grid | { readonly cells: number; readonly neighbours: readonly (readonly number[])[]; } | The valid native flat or surface cell graph. |
links | Links | Passage neighbour lists, one per cell. |
戻り値
boolean
Whether the passages are a spanning tree of the grid: every cell reached, and exactly one way to each.
例
import type { MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze, isPerfect } from "@johnmorrisdotca/meikyuu";
const recipe: MazeRecipe = {shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42};
const maze = buildMaze(recipe);
const grid = maze.grid;
console.log(isPerfect(grid,maze.links));true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。