Skip to the content

Kazu数

Generate checked Sudoku and logic puzzles, read native rules and hints, and draw or embed playable boards.

Kazu is the Japanese word 数 for number. About the name

Contents

Reference · Nurikabe rules

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

NameTypeDescription
boardNurikabeBoard

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kazu 2.1.0.