generateLoop関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Makes a seeded puzzle and proves it has one answer. A random winding loop is grown cell by cell, every square is numbered with how many of its edges the loop uses, and then numbers are taken away for as long as the puzzle can still be solved the way the level asks: easy and medium by the rules alone (easy keeps most numbers), hard by supposing one edge at a time, extra-hard the most-supposing of several such boards. Numbers that say 0 are taken away first, because they say least. If no board of the level is found within the attempts the next level down is tried, and the first generator, which cannot fail, is the last.
インポート
import { generateLoop } from "@johnmorrisdotca/kazu/loop";
ほかのエクスポート元: @johnmorrisdotca/kazu
定義
function generateLoop(width?: number, height?: number, seed?: number, level?: LoopLevel): LoopPuzzle
引数
| 名前 | 型 | 説明 |
|---|---|---|
width (省略可) | number | The supported board width in cells. |
height (省略可) | number | The supported board height in cells. |
seed (省略可) | number | The reproducible native puzzle seed. |
level (省略可) | LoopLevel | The requested native difficulty tier. |
戻り値
LoopPuzzle
Makes a seeded puzzle and proves it has one answer. A random winding loop is grown cell by cell, every square is numbered with how many of its edges the loop uses, and then numbers are taken away for as long as the puzzle can still be solved the way the level asks: easy and medium by the rules alone (easy keeps most numbers), hard by supposing one edge at a time, extra-hard the most-supposing of several such boards. Numbers that say 0 are taken away first, because they say least. If no board of the level is found within the attempts the next level down is tried, and the first generator, which cannot fail, is the last.
例
import { generateLoop } from "@johnmorrisdotca/kazu/loop";
console.log(generateLoop(5,5,42,"easy"));この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。