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

undoNurikabefunction

Return the Nurikabe game with its previous marks or entries restored, or unchanged when there is no undo history.

Import it

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

Also exported from: @johnmorrisdotca/kazu

Definition

function undoNurikabe(game: NurikabeGame): NurikabeGame

Parameters

NameTypeDescription
gameNurikabeGame

The current immutable game state.

Returns

NurikabeGame

Return the Nurikabe game with its previous marks or entries restored, or unchanged when there is no undo history.

Examples

import type { NurikabeBoard } from "@johnmorrisdotca/kazu/nurikabe";
import { newNurikabe, undoNurikabe } 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(undoNurikabe(nurikabeGame));
{
  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.