Reference · Number-puzzle engines
decodeNotesfunction
The pencil marks a code says (each cell a bit mask, bit v for the number v), or null for a code that is not one for a grid of this side.
Import it
import { decodeNotes } from "@johnmorrisdotca/kazu";
Definition
function decodeNotes(code: string, size: number): number[] | null
Parameters
| Name | Type | Description |
|---|---|---|
code | string | The native encoded clues, entries or notes specified by the signature. |
size | number | The supported square grid side length. |
Returns
number[] | null
The pencil marks a code says (each cell a bit mask, bit v for the number v), or null for a code that is not one for a grid of this side.
Examples
import type { KazuPuzzle } from "@johnmorrisdotca/kazu";
import { decodeNotes, encodeNotes, newKazuGame } 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;
const game = newKazuGame(kind,size,givens)!;
console.log(decodeNotes(encodeNotes(game.notes),size));[
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0
]What it prints (run when this page was built)