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

How-to

Separate answer checking, hints and proof

Treat bounded search completion as part of a uniqueness result.

A valid answer is not a uniqueness proof

import {generateHitori,checkHitori,solveHitori} from "@johnmorrisdotca/kazu/hitori";
const puzzle = generateHitori(5,42,"easy");
const proof = solveHitori(puzzle,{limit:2,nodes:20000});
console.log(checkHitori(puzzle,puzzle.solution).ok,proof.count,proof.complete);
console.log(proof.complete && proof.count===1);
true 1 true
true

Check validates the supplied answer against native clues. Solve searches within a budget and may stop incomplete; one found answer after exhaustion does not prove uniqueness. Use a limit of two and require a complete search with count one. The six-grid count helper returns a count or null, so do not infer completion solely from that count.

What a hint means

Number-grid hints first seek an only-number or only-place deduction. When a hard puzzle needs an answer-based move, the hint marks why:"answer"; it is not falsely presented as a logical single. Wrong entries do not become premises for the hint. Family hints return their own rectangle/cell/edge action or null when no usable hint is available, and native play tracks help. An assisted result should not be reported as unassisted. See hintKazu and the established player modes.

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