solveLoop関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Counts loop solutions with the pruning in loopLogic.ts under explicit work bounds.
インポート
import { solveLoop } from "@johnmorrisdotca/kazu/loop";
ほかのエクスポート元: @johnmorrisdotca/kazu
定義
function solveLoop(board: LoopBoard, options?: { limit?: number; nodes?: number; }): LoopSolve
引数
| 名前 | 型 | 説明 |
|---|---|---|
board | LoopBoard | The valid native board with its printed clues and dimensions. |
options (省略可) | { limit?: number; nodes?: number; } | Solution/node limits or native SVG choices specified by the signature. |
戻り値
LoopSolve
Counts loop solutions with the pruning in loopLogic.ts under explicit work bounds.
例
import type { LoopBoard } from "@johnmorrisdotca/kazu/loop";
import { solveLoop } from "@johnmorrisdotca/kazu/loop";
const loopBoard: LoopBoard = {"width":5,"height":5,"clues":[2,3,1,null,null,3,1,1,null,null,3,2,2,null,null,3,0,2,2,null,2,2,1,2,3]};
console.log(solveLoop(loopBoard,{limit:2,nodes:20000}));{
count: 1,
solution: [
1, 5, 10, 15, 17, 20, 23,
24, 26, 27, 28, 29, 31, 32,
36, 38, 43, 44, 48, 51, 55,
59
],
complete: true,
nodes: 0
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。