DEV Community

iqiqgame
iqiqgame

Posted on Edited on

17 Puzzle Solvers That Show Their Work (Sudoku, Wordle, Lights Out and More)

I help my daughter finish sudokus from the newspaper, and I kept solving them by hand, then checking them by hand too. The solving was fine. The checking was slow, and I kept making arithmetic slips in it.

So I wrote a solver for myself. Then I kept needing one for other puzzles too, and instead of one site per puzzle I ended up putting them on a single page.

It runs entirely in the browser — no account, no email gate, no waiting for a server. The part I care about is that the solvers explain themselves instead of just printing the answer.

If you would rather jump straight in, all seventeen are on the puzzle solver index page.

Sudoku tells you whether the puzzle is actually solvable

A lot of sudokus in circulation are ambiguous — the givens allow more than one valid completion, and you only find that out after wasting twenty minutes. The sudoku solver checks for a unique solution before handing one over, and tells you plainly when your givens are contradictory.

It also has a hint mode that fills in exactly one cell at a time and names the technique it used — "naked single: only 8 can go in row 1, column 1" — so my daughter can keep doing the thinking instead of watching a grid fill itself.

Lights Out is a linear algebra problem

Pressing a cell twice cancels out, so a solution is really a set of cells rather than a sequence. That makes it a linear system over GF(2), which the lights out solver solves with Gaussian elimination.

Gaussian elimination gives you one solution; searching the null space for the minimum weight one gives you the fewest possible presses. When a board genuinely cannot be solved it says so instead of failing quietly.

Wordle ranks by what you learn, not by what fits

Filtering against the official 2,315-word answer list is the easy part. The wordle solver ranks the surviving candidates by how much each one would narrow your search down, so the suggestion is the informative word rather than simply the first word that still fits. Grey letters are never reused.

Sliding puzzle gives you the shortest path

The sliding puzzle solver handles 3×3 through 9×9, returns the minimum number of moves, and plays the solution back with pause and speed controls so you can copy it one step at a time. It checks solvability as you type, which catches a repeated or out-of-range number before it starts searching for a solution to the wrong board.

The rest of them

The other solvers follow the same idea — explain the reasoning, not just the answer:

All seventeen live on one page at iqiqgame.com/tags/tool-solver. Everything is free, nothing needs an account, and all of the solving happens in the browser.

Why the nudges matter

A solver that only prints the answer is a lookup table. The nudges are the difference:

  • Sliding puzzle — the one number that breaks the pattern when two options look equally valid
  • Sudoku — a hint that names the technique, so the next time you might spot it yourself
  • 24 game — a hint that points at the right factorisation instead of just the target

That was the design goal. If a solver hands you the answer and nothing else, you'll keep coming back to it every time you get stuck, which defeats the point of solving the puzzle at all.

Two earlier builds are still around if you want the code rather than the hosted version: a Sudoku generator and solver with a unique-solution generator, and a 24 points card game as a single HTML file with a brute-force solver. Both are open source and run offline.

The stack is Nuxt and TypeScript, and all the solving runs client-side. If you have tried a different approach to any of these — especially the minimum-press Lights Out search — I'd be curious to hear about it.

Top comments (0)