Reference
Hitori rules
import { … } from "@johnmorrisdotca/kazu/hitori";
4.5 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
checkHitori | function | Checks unshaded row and column duplicates, adjacent shades, and white connectivity. |
decodeHitori | function | Read a native saved Hitori game, or null for invalid board data or progress. |
encodeHitori | function | Versioned public clue and mark data; the generated answer is not saved. |
generateHitori | function | Makes a seeded puzzle and proves its answer is the only one. |
hintHitori | function | Gives one next shade in the unique minimal solution, if uniqueness was proved. |
HITORI_LEAST_SIDE | constant | The minimum supported Hitori board dimension. |
HITORI_LEVELS | constant | How hard a puzzle is made, by what a person must do to solve it; see rateHitori. |
HITORI_MAX_NODES | constant | The native Hitori search-node budget. |
HITORI_MOST_ATTEMPTS | constant | The native Hitori generation-attempt limit. |
HITORI_MOST_SIDE | constant | The maximum supported Hitori board dimension. |
HITORI_SIZES | constant | The sides on offer; any side from 4 to HITORI_MOST_SIDE is a board isHitoriBoard takes. |
HitoriBoard | type | Hitori dimensions and printed clues in their native row-major representation. |
HitoriGame | type | The immutable Hitori board, current entries or marks, undo history and assistance state. |
HitoriLevel | type | A native difficulty tier for generated Hitori puzzles. |
hitoriNeighbors | function | Read orthogonally adjacent cells on a square Hitori board. |
HitoriPuzzle | type | A seeded Hitori board with its verified solution and native difficulty tier. |
HitoriRating | type | How hard a board is, measured by solving it. |
HitoriSolve | type | A bounded Hitori solve result: answer count, first solution, node work and whether the search completed. |
isHitoriBoard | function | Whether the value has valid native Hitori dimensions, clues and data. |
newHitori | function | Create the initial immutable Hitori game from a valid board. |
rateHitori | function | Rates a board with one answer by solving it: with the plain rules, with the whites-stay-together rule, then by supposing. |
restartHitori | function | Return the Hitori game reset to its initial entries or marks. |
shadeHitori | function | Apply the requested native Hitori entry or mark to a new immutable game; invalid or fixed targets stay unchanged. |
solveHitori | function | Counts distinct minimal shade patterns: an answer shades only squares that settle a duplicate, so extra shades are never a second answer. |
undoHitori | function | Return the Hitori game with its previous marks or entries restored, or unchanged when there is no undo history. |