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

checkNurikabefunction

Checks island areas and separation, the connected sea, and the ban on 2×2 sea blocks.

Import it

import { checkNurikabe } from "@johnmorrisdotca/kazu/nurikabe";

Also exported from: @johnmorrisdotca/kazu

Definition

function checkNurikabe(board: NurikabeBoard, sea: readonly boolean[]): { ok: boolean; errors: readonly number[]; }

Parameters

NameTypeDescription
boardNurikabeBoard

The valid native board with its printed clues and dimensions.

seareadonly boolean[]

The current sea-cell flags in row-major order.

Returns

{ ok: boolean; errors: readonly number[]; }

Checks island areas and separation, the connected sea, and the ban on 2×2 sea blocks.

Examples

import type { NurikabeBoard, NurikabePuzzle } from "@johnmorrisdotca/kazu/nurikabe";
import { checkNurikabe } 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]};
const nurikabeSolution: NurikabePuzzle["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];
console.log(checkNurikabe(nurikabeBoard,nurikabeSolution));
{ ok: true, errors: [] }

What it prints (run when this page was built)

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