solveNurikabefunction
Counts valid island placements and checks the remaining cells as the sea under a finite budget.
Import it
import { solveNurikabe } from "@johnmorrisdotca/kazu/nurikabe";
Also exported from: @johnmorrisdotca/kazu
Definition
function solveNurikabe(board: NurikabeBoard, options?: { limit?: number; nodes?: number; }): NurikabeSolve
Parameters
| Name | Type | Description |
|---|---|---|
board | NurikabeBoard | The valid native board with its printed clues and dimensions. |
options (optional) | { limit?: number; nodes?: number; } | Solution/node limits or native SVG choices specified by the signature. |
Returns
NurikabeSolve
Counts valid island placements and checks the remaining cells as the sea under a finite budget.
Examples
import type { NurikabeBoard } from "@johnmorrisdotca/kazu/nurikabe";
import { solveNurikabe } from "@johnmorrisdotca/kazu/nurikabe";
const nurikabeBoard: NurikabeBoard = {"size":5,"clues":[1,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,2,0,0,3,0,0]};
console.log(solveNurikabe(nurikabeBoard,{limit:2,nodes:20000}));{
count: 1,
solution: [
false, true, true, true,
false, true, true, false,
false, false, true, false,
false, true, true, true,
true, true, true, false,
false, false, false, true,
false
],
complete: true,
nodes: 139
}What it prints (run when this page was built)