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

solveKazufunction

The one answer a puzzle's givens allow, as a cells code, or null when they allow none, more than one, or the search ran past budget steps (Sudoku, Jigsaw, Diagonal and Sum Cages). A grid this cannot vouch for is never handed back as though it were the answer.

Import it

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

Definition

function solveKazu(kind: KazuKind, size: number, givens: string, budget?: number): string | null

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.

givensstring

The original native printed-clue code.

budget (optional)number

The maximum bounded solver work.

Returns

string | null

A native answer code, or null for invalid inputs or no answer found within the search budget.

Examples

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

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

What it prints (run when this page was built)

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