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-grid SVG

import { … } from "@johnmorrisdotca/kazu/draw";

12.7 kB minified and gzipped, with everything it imports (measured with esbuild)

Kazu's drawing: a puzzle as SVG text, with the style that gives it its look, and where everything sits in it (so a page can tell which cell a finger is over). A separate entry (@johnmorrisdotca/kazu/draw), so a server that only checks an answer never loads any of it.

Exports

NameKindWhat it is
drawKazufunctionA PUZZLE AS SVG TEXT: the grid with its printed numbers, whatever has been written in it, pencil marks, and everything the kind of puzzle prints: the heavier rules round the boxes or a Jigsaw's regions, the shaded diagonals, a cage's dashed outline with its sum, the more-than marks between cells, and the tower clues round the edge.
drawShikakufunctionSVG text with only the public clues and the player's rectangles.
KAZU_CELLconstantThe units of a cell, and the margin round the drawing.
KAZU_NAMESconstantBilingual puzzle names, aliases, rules, origins and introductory copy by native kind.
KAZU_SIZE_NAMESconstantWhat each side is for, under its size on a chooser: the quick one, the usual one, the long one.
KAZU_STRINGSconstantNative English and Japanese labels, announcements and interpolation templates for the number grid.
KAZU_STYLEconstantTHE STYLE a Kazu drawing wears: the colours of its board as custom properties, and the one rule that matters for a puzzle played with fingers: nothing in the drawing can be selected, dragged or double-tapped.
kazuCellNamefunctionA cell as a screen reader names it: "row 3, column 5".
KazuDrawOptionstypeWhat a drawing shows beyond the puzzle itself.
kazuGeometryfunctionWhere everything is in the drawing of a puzzle of this kind and side.
KazuGeometrytypeWHERE EVERYTHING IS IN A DRAWING, so a page of your own can play it: the drawing is a square of side units, every cell cell units across, and a Towers square sits inside a ring one cell deep that holds its clues.
KazuLanguagetypeTHE WORDS A KAZU BOARD SAYS, in English and Japanese: what a screen reader hears of the drawing, the buttons and lines under a playable board, and what a hint says.
kazuLanguageOffunctionThe language a piece of text is in: Japanese for anything starting ja, English for everything else.
KazuNametypeWHAT EACH PUZZLE IS CALLED, and what it is, in English and Japanese: the name a player searches for, its Japanese name, a line saying how it is played, and a few lines of rules.
kazuNameOffunctionWhat a puzzle is called in a language, as a screen reader says it.
kazuSayfunctionA line in a language, with its values filled in; the line itself if there is none by that name.
kazuWherefunctionThe words for the groups a number is ruled out by, for a hint's line: "its row, column and box".
ShikakuDrawOptionstypeCurrent Shikaku marks or entries, selection, errors and native SVG appearance choices.

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