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
| Name | Type | Description |
|---|---|---|
kind | "number-place" | "jigsaw" | "diagonal" | "sum-cages" | "more-or-less" | "towers" | The native number-grid puzzle key. |
size | number | The supported square grid side length. |
givens | string | 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));1432234141233214What it prints (run when this page was built)