Sudoku SolverI’m a Sudoku addict. There, I said it.

In particular, I like to solve them in pen, and without writing down little numbers all over the place. I take pride in a clean and solved sudoku – just correct numbers in their squares.

Over time, I developed a straightforward set of algorithms that I step through in my mind that solve all but the hardest puzzles. Since they are just a process I go through, I found I couldn’t actually verbalize them, I just knew how to look at the puzzle and find solutions. I thought it would be a fun exercise to try and program a sudoku solver, thus forcing me to be able to explain to myself the process I go through.

This solver is my current solution. It can’t yet solve every puzzle, but it gets as far as I do without guessing. I know the next algorithm that needs to be added to make it better, but as you can imagine they get harder and harder to implement as the complexity grows, and I haven’t quite got that code part figured out yet.

Feel free to play around with it. It has a few example puzzles built in and you can input your own. The ultimate solver (not mine!), with explanations of a few dozen algorithms is here.