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
| Name | Kind | What it is |
|---|---|---|
checkLoop | function | Checks all numbered cells, degree-two vertices, and one connected closed loop. |
decodeLoop | function | Read a native saved Loop game, or null for invalid board data or progress. |
drawLoop | function | Draws public clues and selected loop edges as an SVG board. |
edgeVertices | function | Read the two vertex indices at the ends of a native Loop edge. |
encodeLoop | function | Encode the Loop board and current game as native resumable text. |
generateLoop | function | Makes a seeded puzzle and proves it has one answer. |
hintLoop | function | Find a native Loop hint, or null when no actionable hint is available. |
isLoopBoard | function | Whether the value has valid native Loop dimensions, clues and data. |
LOOP_LEVELS | constant | How hard a puzzle is made, by what a person must do to solve it; see rateLoop. |
LOOP_MOST_ATTEMPTS | constant | The native Loop generation-attempt limit. |
LOOP_MOST_NODES | constant | The native Loop search-node budget. |
LOOP_MOST_SIDE | constant | The maximum supported Loop board dimension. |
LOOP_SIZES | constant | The sides on offer for a square board; any side from 2 to LOOP_MOST_SIDE can be made. |
LoopBoard | type | Loop dimensions and printed clues in their native row-major representation. |
loopCellEdges | function | Read the four edges around a cell, or null for a cell outside the board. |
LoopCheck | type | The Loop completion result and cells that violate its native rules. |
LoopDrawOptions | type | Current Loop marks or entries, selection, errors and native SVG appearance choices. |
loopEdgeCount | function | An edge index is horizontal row-major first, then vertical row-major. |
loopFinished | function | Whether this Loop game satisfies its complete native rules. |
LoopGame | type | The immutable Loop board, current entries or marks, undo history and assistance state. |
loopHorizontalCount | function | Count horizontal edges in the Loop board’s native edge numbering. |
LoopLanguage | type | The native English or Japanese display language for Loop. |
LoopLevel | type | A native difficulty tier for generated Loop puzzles. |
LoopMaterial | type | A supported material of the native Loop board. |
LoopMount | type | The mounted Loop game and progress, native controls and cleanup handle. |
LoopMountOptions | type | The initial Loop board, native progress, appearance and host event callbacks. |
LoopProgress | type | The Loop constraint status of a partial board. |
LoopPuzzle | type | A seeded Loop board with its verified solution and native difficulty tier. |
LoopRating | type | How hard a board is, measured by solving it. |
LoopSolve | type | A bounded Loop solve result: answer count, first solution, node work and whether the search completed. |
loopVertexEdges | function | Read edges meeting a native Loop vertex. |
mountLoop | function | Mounts an accessible dot-and-edge loop player in the given host element. |
newLoop | function | Create the initial immutable Loop game from a valid board. |
progressLoop | function | Reports overfilled clues and branched vertices during play without requiring a finished loop. |
rateLoop | function | Rates a board with one answer by solving it as a person would: with the rules, then by supposing one edge at a time. |
solveLoop | function | Counts loop solutions with the pruning in loopLogic.ts under explicit work bounds. |
toggleLoop | function | Apply the requested native Loop entry or mark to a new immutable game; invalid or fixed targets stay unchanged. |
undoLoop | function | Return the Loop game with its previous marks or entries restored, or unchanged when there is no undo history. |