Generating Unique-Solution Kakuro Puzzles and Grading Them by Solving Technique
Most online Kakuro (Cross Sums) generators either serve a tiny static pack or generate grids without proving uniqueness—which leads to frustrating late-game guessing. While building Kakuro Club , I wanted every generated grid to satisfy three strict invariants: Mathematically unique solution (verified before a puzzle is ever served). Difficulty graded by human solving technique , not just grid…
Online Kakuro puzzle generators often produce a limited selection of puzzles or fail to guarantee a unique solution, leading to potential guesswork in the later stages. When developing Kakuro Club, the goal was to create every puzzle with a mathematically unique solution, grade difficulty based on human solving techniques rather than grid size, and generate deterministic puzzle codes for consistent puzzle generation and shared links.
To achieve these objectives, the constraint solver and grading pipeline operate as follows. First, precomputing all 502 valid run combinations—each run containing k distinct digits from 1-9 summing to S—takes less than a millisecond. A lookup table maps (run_length, target_sum) to a list of 9-bit digit masks, enabling quick filtering of valid combinations during the solving process.
The uniqueness verifier proves that a generated puzzle has only one solution using backtracking with Minimum Remaining Values (MRV). If more than one solution is found, the system modifies cell values or black-cell symmetries and re-evaluates. For grading difficulty, a separate human-style solver attempts to solve each unique grid using various deduction techniques: Easy (one-way sums and single-candidate intersections), Medium (cross-run candidate elimination), Hard (subset/naked-pair eliminations), Expert (multi-run sum parity), Hard (longer elimination chains across multiple runs), and Fiendish (requiring bifurcation). The highest technique tier required to finish the puzzle determines its published grade.
Finally, to ensure clean black-and-white printing, the Printable Kakuro sheet generator sets print-color-adjust: exact and renders clue diagonals as inline SVG triangles within crisp CSS grid cells, resulting in a lightweight (~39 KB HTML) puzzle generator.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to