Reference · Playable number grid
KazuEventDetailtype
What every event tells of the board.
Import it
import type { KazuEventDetail } from "@johnmorrisdotca/kazu/play";
Definition
type KazuEventDetail = {
kind: KazuKind;
size: number;
level?: KazuLevel;
seed?: number;
run: string;
notes: string;
answer: string;
progress: {
filled: number;
total: number;
};
elapsedMs: number;
hints: number;
checks: number;
helped: boolean;
solved: boolean;
hint?: KazuHint;
};
Members
| Name | Type | Description |
|---|---|---|
kind | "number-place" | "jigsaw" | "diagonal" | "sum-cages" | "more-or-less" | "towers" | |
size | number | |
level (optional) | "easy" | "medium" | "hard" | undefined | |
seed (optional) | number | undefined | |
run | string | What the player has written, as a run's code ( |
notes | string | The pencil marks, as a code ( |
answer | string | The whole grid, printed numbers and the player's: what |
progress | { filled: number; total: number; } | |
elapsedMs | number | The time on the clock, in milliseconds. |
hints | number | How many hints were taken, and how many times Check was pressed. A solve with any hint is a helped one. |
checks | number | |
helped | boolean | |
solved | boolean | |
hint (optional) | KazuHint | undefined | For |
Examples
import type { KazuPuzzle } from "@johnmorrisdotca/kazu";
import { answerOf, decodeCells, encodeNotes, encodeRun, isSolved, kazuProgress, newKazuGame } from "@johnmorrisdotca/kazu";
import type { KazuEventDetail } from "@johnmorrisdotca/kazu/play";
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 answer = puzzle.solution;
const solution = decodeCells(answer,size)!;
const game = newKazuGame(kind,size,givens)!;
const value: KazuEventDetail = {kind,size,run:encodeRun(game.entries),notes:encodeNotes(game.notes),answer:answerOf(game),progress:kazuProgress(game),elapsedMs:0,hints:0,checks:0,helped:false,solved:isSolved(game)};
console.log(value);{
kind: 'number-place',
size: 4,
run: '................',
notes: '',
answer: '14..2..1412.3..4',
progress: { filled: 9, total: 16 },
elapsedMs: 0,
hints: 0,
checks: 0,
helped: false,
solved: false
}What it prints (run when this page was built)