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 · Hitori rules

generateHitorifunction

Makes a seeded puzzle and proves its answer is the only one. The shaded squares are chosen first (never touching, the rest in one piece), the white squares get numbers that repeat nowhere in their row or column, and every shaded square takes a number that a white square in its row or column already has. Boards with more than one answer are repaired by renumbering a shaded square so that the other answer repeats a number, and the result is rated: easy by the plain rules, medium once the whites must stay in one piece, hard by supposing, and extra-hard the most-supposing of several boards.

Import it

import { generateHitori } from "@johnmorrisdotca/kazu/hitori";

Also exported from: @johnmorrisdotca/kazu

Definition

function generateHitori(size?: number, seed?: number, level?: HitoriLevel): HitoriPuzzle

Parameters

NameTypeDescription
size (optional)number

The supported square board side length.

seed (optional)number

The reproducible native puzzle seed.

level (optional)HitoriLevel

The requested native difficulty tier.

Returns

HitoriPuzzle

Makes a seeded puzzle and proves its answer is the only one. The shaded squares are chosen first (never touching, the rest in one piece), the white squares get numbers that repeat nowhere in their row or column, and every shaded square takes a number that a white square in its row or column already has. Boards with more than one answer are repaired by renumbering a shaded square so that the other answer repeats a number, and the result is rated: easy by the plain rules, medium once the whites must stay in one piece, hard by supposing, and extra-hard the most-supposing of several boards.

Examples

import { generateHitori } from "@johnmorrisdotca/kazu/hitori";

console.log(generateHitori(5,42,"easy"));

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