perTier int64 | puzzles int64 | mismatches int64 | byTier dict | overall dict |
|---|---|---|---|---|
10 | 40 | 0 | {
"naive": {
"easy": {
"avgMs": 0.016,
"avgNodes": 59
},
"medium": {
"avgMs": 0.071,
"avgNodes": 598
},
"hard": {
"avgMs": 0.964,
"avgNodes": 10750
},
"expert": {
"avgMs": 9.084,
"avgNodes": 103932
}
},
"mrv": {
"easy": {
"a... | {
"naive": {
"avgMs": 2.534,
"avgNodes": 28835
},
"mrv": {
"avgMs": 0.222,
"avgNodes": 177
},
"logic": {
"avgMs": 0.114,
"avgNodes": 2
}
} |
Sudoku Solver Benchmark — Backtracking vs MRV vs Constraint Propagation
Search cost (recursive calls / "nodes") and solve time for three ways to solve a 9×9 Sudoku, measured on the same shipped engine that powers the LK Forge Sudoku Solver, across a reproducible, seed-generated corpus of easy → expert puzzles. All three strategies are asserted to return the same correct solution, so no wrong number ships.
- How the solver works: https://lkforge.com/tools/puzzles/sudoku-solver/how-the-sudoku-solver-works.html
- Try it: https://lkforge.com/tools/puzzles/sudoku-solver/
- Producer: LK Forge — client-side AI games, solvers, and tools.
Headline numbers (overall averages)
| Strategy | Avg search nodes | Avg solve time |
|---|---|---|
| Naive backtracking (next-empty cell) | 28,835 | 2.536 ms |
| MRV backtracking (most-constrained cell first) | 177 | 0.220 ms |
| Constraint propagation (naked + hidden singles) | 2 | 0.118 ms |
So the MRV heuristic cuts search ~163× vs naive backtracking, and constraint propagation solves a typical puzzle in ~2 nodes — deducing the answer with almost no guessing, the same reasoning the solver's hint engine explains.
Files
data/sudoku-strategies.json— per-difficulty (easy/medium/hard/expert) and overallavgMsandavgNodesfor each of the three strategies.
Method
- Corpus: puzzles produced by the shipped generator with fixed seeds → reproducible.
- Node count = recursive solver calls (a machine-independent measure of search effort).
- Strategies: (1) naive backtracking in the shipped cell order; (2) MRV — always branch on the cell with the fewest candidates; (3) logic — apply naked + hidden singles as far as possible before guessing.
- Correctness gate: all three must return the identical, valid solution for every puzzle.
Reproduce
node benchmark.js # runs the shipped engine.js over the seeded corpus
Citation
LK Forge (2026). Sudoku Solver Benchmark — Backtracking vs MRV vs Constraint Propagation. https://lkforge.com/tools/puzzles/sudoku-solver/
Everything runs client-side, no login, no tracking.
- Downloads last month
- 13