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

markNurikabeSeafunction

Apply the requested native Nurikabe entry or mark to a new immutable game; invalid or fixed targets stay unchanged.

Import it

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

Also exported from: @johnmorrisdotca/kazu

Definition

function markNurikabeSea(game: NurikabeGame, cell: number): NurikabeGame

Parameters

NameTypeDescription
gameNurikabeGame

The current immutable game state.

cellnumber

A zero-based row-major cell index.

Returns

NurikabeGame

Apply the requested native Nurikabe entry or mark to a new immutable game; invalid or fixed targets stay unchanged.

Examples

import type { NurikabeBoard } from "@johnmorrisdotca/kazu/nurikabe";
import { markNurikabeSea, newNurikabe } 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 nurikabeGame = newNurikabe(nurikabeBoard);
console.log(markNurikabeSea(nurikabeGame,0));
{
  board: {
    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
    ]
  },
  sea: [
    false, false, false, false,
    false, false, false, false,
    false, false, false, false,
    false, false, false, false,
    false, false, false, false,
    false, false, false, false,
    false
  ],
  history: [],
  helped: false
}

What it prints (run when this page was built)

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