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 · Number-puzzle engines

generateKazufunction

A puzzle of any of the six, from a seed: the one door. The same kind, size, level and seed make the same puzzle in every browser and every Node, for ever, which is what lets a solve be kept as those four and a race be handed one number. Every puzzle has exactly one answer, and an easy one yields to singles alone.

Throws a RangeError for a kind, size, level or seed it does not make, rather than a puzzle made from something else.

Import it

import { generateKazu } from "@johnmorrisdotca/kazu";

Definition

function generateKazu(kind: KazuKind, size: number, level: KazuLevel, seed: number): KazuPuzzle

Parameters

NameTypeDescription
kind"number-place" | "jigsaw" | "diagonal" | "sum-cages" | "more-or-less" | "towers"

The native number-grid puzzle key.

sizenumber

The supported square grid side length.

level"easy" | "medium" | "hard"

The native easy, medium or hard generation tier.

seednumber

A reproducible integer seed from 1 to KAZU_SEED_MOST.

Returns

KazuPuzzle

A puzzle of any of the six, from a seed: the one door. The same kind, size, level and seed make the same puzzle in every browser and every Node, for ever, which is what lets a solve be kept as those four and a race be handed one number. Every puzzle has exactly one answer, and an easy one yields to singles alone.

Examples

import type { KazuPuzzle } from "@johnmorrisdotca/kazu";
import { generateKazu } from "@johnmorrisdotca/kazu";

const puzzle: KazuPuzzle = {"kind":"number-place","size":4,"level":"easy","seed":42,"givens":"14..2..1412.3..4","solution":"1432234141233214"};
const givens = puzzle.givens;
console.log(generateKazu("number-place",4,"easy",42).givens);

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