Reference · Number-puzzle engines
kazuGuessDepthfunction
How many guesses, each followed by everything reasoning then finds, a person needs to finish the puzzle: 0 when reasoning alone finishes it (easy), 1 when one guess does (medium), more when more (hard); Infinity when there is no answer. Null for givens that are not a puzzle. Meant for a puzzle already known to have exactly one answer.
Import it
import { kazuGuessDepth } from "@johnmorrisdotca/kazu";
Definition
function kazuGuessDepth(kind: KazuKind, size: number, givens: string): number | 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. |
Returns
number | null
The native guess-depth measure, or null for invalid or unsolved givens.
Examples
import type { KazuPuzzle } from "@johnmorrisdotca/kazu";
import { kazuGuessDepth } 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(kazuGuessDepth(kind,size,givens));0What it prints (run when this page was built)