solveRipple関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Counts rule-valid fillings within an explicit node budget.
インポート
import { solveRipple } from "@johnmorrisdotca/kazu/ripple";
ほかのエクスポート元: @johnmorrisdotca/kazu
定義
function solveRipple(board: RippleBoard, options?: { limit?: number; nodes?: number; }): RippleSolve
引数
| 名前 | 型 | 説明 |
|---|---|---|
board | RippleBoard | 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. |
戻り値
RippleSolve
Counts rule-valid fillings within an explicit node budget.
例
import type { RippleBoard } from "@johnmorrisdotca/kazu/ripple";
import { solveRipple } from "@johnmorrisdotca/kazu/ripple";
const rippleBoard: RippleBoard = {"width":9,"height":9,"rooms":[0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,3,3,3,4,4,4,5,5,5,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,6,6,6,7,7,7,8,8,8,6,6,6,7,7,7,8,8,8],"clues":[4,null,7,9,2,null,5,null,3,null,null,3,6,7,4,8,9,2,8,null,2,1,3,null,null,null,null,7,null,1,null,6,null,null,null,9,3,8,null,5,1,7,null,null,6,2,4,6,null,9,3,7,5,1,1,null,8,null,5,null,9,2,4,null,2,null,null,null,null,null,null,null,6,null,null,2,4,null,null,3,null]};
console.log(solveRipple(rippleBoard,{limit:2,nodes:20000}));{
count: 1,
solution: [
4, 6, 7, 9, 2, 8, 5, 1, 3, 5, 1, 3,
6, 7, 4, 8, 9, 2, 8, 9, 2, 1, 3, 5,
4, 6, 7, 7, 5, 1, 4, 6, 2, 3, 8, 9,
3, 8, 9, 5, 1, 7, 2, 4, 6, 2, 4, 6,
8, 9, 3, 7, 5, 1, 1, 3, 8, 7, 5, 6,
9, 2, 4, 9, 2, 4, 3, 8, 1, 6, 7, 5,
6, 7, 5, 2, 4, 9, 1, 3, 8
],
complete: true,
nodes: 61
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。