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

Akari rules

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

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

Exports

NameKindWhat it is
AKARI_DENSER_ATTEMPTSconstantThe native Akari generation-attempt limit for each denser fallback.
AKARI_DENSER_CROWDSconstantWhen a level finds no board in AKARI_MOST_ATTEMPTS plain attempts (a large board of an easy level, mostly: one attempt in a hundred succeeds on a 14×14), the generator tries again with more black squares, each of these multiples of the usual share in turn, AKARI_DENSER_ATTEMPTS attempts at each.
AKARI_LEVELSconstantHow hard a puzzle is made, by what a person must do to solve it; see rateAkari.
AKARI_MOST_ATTEMPTSconstantThe native Akari generation-attempt limit.
AKARI_MOST_NODESconstantThe native Akari search-node budget.
AKARI_MOST_SIDEconstantThe maximum supported Akari board dimension.
AKARI_PLAY_STYLEconstantScoped native Akari board and player CSS.
AKARI_SIZESconstantThe sides the demo and the site offer for a square board; any side from 2 to AKARI_MOST_SIDE can be made.
AKARI_STRINGSconstantNative English and Japanese labels and announcements for Akari.
AkariBoardtypeA board is row-major.
AkariChecktypeThe Akari completion result and cells that violate its native rules.
AkariDrawOptionstypeCurrent Akari marks or entries, selection, errors and native SVG appearance choices.
akariFinishedfunctionA game is finished only when its bulbs satisfy every rule and light every white square.
AkariGametypeThe immutable Akari board, current entries or marks, undo history and assistance state.
AkariLanguagetypeThe native English or Japanese display language for Akari.
AkariLeveltypeA native difficulty tier for generated Akari puzzles.
AkariMaterialtypeA supported material of the native Akari board.
AkariMounttypeThe mounted Akari game and progress, native controls and cleanup handle.
AkariMountOptionstypeThe initial Akari board, native progress, appearance and host event callbacks.
akariNeighboursfunctionReturns the orthogonally adjacent cells to a board position.
AkariPiecestypeA supported native Akari mark or piece appearance.
AkariProgresstypeThe Akari constraint status of a partial board.
AkariPuzzletypeA seeded Akari board with its verified solution and native difficulty tier.
AkariRatingtypeHow hard a board is, measured by solving it.
AkariSolvetypeA bounded Akari solve result: answer count, first solution, node work and whether the search completed.
akariVisiblefunctionWhite squares visible from a cell, including itself, stopping at black squares and edges.
checkAkarifunctionChecks a complete placement from the public rules, without consulting a stored answer.
decodeAkarifunctionDecodes a bounded save after validating the board and each placement.
drawAkarifunctionDraws the public clues and current bulbs as SVG.
encodeAkarifunctionEncodes only public clues and player placements.
generateAkarifunctionMakes a seeded board and proves it has one answer.
hintAkarifunctionReturns a missing bulb, or an extra bulb to remove, only after uniqueness is proved.
isAkariBoardfunctionValidates dimensions and the three public square kinds.
mountAkarifunctionMounts the player in a host element; call destroy when the host is removed.
newAkarifunctionStarts a game with only its public board data.
progressAkarifunctionReports immediate contradictions while allowing required clues to remain unsatisfied during play.
rateAkarifunctionRates a board by solving it as a person would: with the rules alone (depth 0), then with one supposition at a time (depth 1), and anything beyond that is depth 2.
solveAkarifunctionBounded constraint search over the rules in akariLogic.ts; a stopped proof is always marked incomplete.
toggleAkarifunctionToggles a bulb on a white square and keeps one prior turn for undo.
undoAkarifunctionRestores the last bulb placement.

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