Games · 01

Sudoku.

I wrote my first Sudoku game in Java in high school, then spent tens of hours learning and programming actual Sudoku strategies so it could solve the puzzles the way a person would.

Play it

Give it a try.

Pick a square and type 1–9. Pencil mode adds guesses.

Under the hood

The two approaches.

One follows recognizable Sudoku logic. The other tries possibilities until something works.

01

Strategy solver

My original high-school Java program. The button above runs the same candidate lists, singles, hidden singles, and pair rules in the same order.

02

Backtracking

Try a valid number. If it creates a dead end later, undo it and try the next one. Very short, very persistent, and mildly annoying in hindsight.

What survived the experience

There is more than one useful way to think.

I originally wanted the computer to solve Sudoku the same way I did. That meant researching strategies, turning each one into rules, and finding a way for the program to explain its next move.

Backtracking showed me that computers do not have to approach a problem like people do. My version is easier to follow and explain. Backtracking is much shorter and will happily check possibilities faster than I ever could.