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

Loop rules

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

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

Loop uses a dedicated edge model and a single-loop constraint.

Exports

NameKindWhat it is
checkLoopfunctionChecks all numbered cells, degree-two vertices, and one connected closed loop.
decodeLoopfunctionRead a native saved Loop game, or null for invalid board data or progress.
drawLoopfunctionDraws public clues and selected loop edges as an SVG board.
edgeVerticesfunctionRead the two vertex indices at the ends of a native Loop edge.
encodeLoopfunctionEncode the Loop board and current game as native resumable text.
generateLoopfunctionMakes a seeded puzzle and proves it has one answer.
hintLoopfunctionFind a native Loop hint, or null when no actionable hint is available.
isLoopBoardfunctionWhether the value has valid native Loop dimensions, clues and data.
LOOP_LEVELSconstantHow hard a puzzle is made, by what a person must do to solve it; see rateLoop.
LOOP_MOST_ATTEMPTSconstantThe native Loop generation-attempt limit.
LOOP_MOST_NODESconstantThe native Loop search-node budget.
LOOP_MOST_SIDEconstantThe maximum supported Loop board dimension.
LOOP_SIZESconstantThe sides on offer for a square board; any side from 2 to LOOP_MOST_SIDE can be made.
LoopBoardtypeLoop dimensions and printed clues in their native row-major representation.
loopCellEdgesfunctionRead the four edges around a cell, or null for a cell outside the board.
LoopChecktypeThe Loop completion result and cells that violate its native rules.
LoopDrawOptionstypeCurrent Loop marks or entries, selection, errors and native SVG appearance choices.
loopEdgeCountfunctionAn edge index is horizontal row-major first, then vertical row-major.
loopFinishedfunctionWhether this Loop game satisfies its complete native rules.
LoopGametypeThe immutable Loop board, current entries or marks, undo history and assistance state.
loopHorizontalCountfunctionCount horizontal edges in the Loop board’s native edge numbering.
LoopLanguagetypeThe native English or Japanese display language for Loop.
LoopLeveltypeA native difficulty tier for generated Loop puzzles.
LoopMaterialtypeA supported material of the native Loop board.
LoopMounttypeThe mounted Loop game and progress, native controls and cleanup handle.
LoopMountOptionstypeThe initial Loop board, native progress, appearance and host event callbacks.
LoopProgresstypeThe Loop constraint status of a partial board.
LoopPuzzletypeA seeded Loop board with its verified solution and native difficulty tier.
LoopRatingtypeHow hard a board is, measured by solving it.
LoopSolvetypeA bounded Loop solve result: answer count, first solution, node work and whether the search completed.
loopVertexEdgesfunctionRead edges meeting a native Loop vertex.
mountLoopfunctionMounts an accessible dot-and-edge loop player in the given host element.
newLoopfunctionCreate the initial immutable Loop game from a valid board.
progressLoopfunctionReports overfilled clues and branched vertices during play without requiring a finished loop.
rateLoopfunctionRates a board with one answer by solving it as a person would: with the rules, then by supposing one edge at a time.
solveLoopfunctionCounts loop solutions with the pruning in loopLogic.ts under explicit work bounds.
toggleLoopfunctionApply the requested native Loop entry or mark to a new immutable game; invalid or fixed targets stay unchanged.
undoLoopfunctionReturn the Loop game with its previous marks or entries restored, or unchanged when there is no undo history.

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