# Java Sudoku

Ever since SudokuBan (bit rot guilt guilt), a sudoku solver has sort of been my one-step-beyond-”Hello world” program for new languages. Although Java isn’t exactly a new language for me, the re-familiarising process is more or less the same; so I kicked off a sudoku solver in Java. And just a few minutes ago I sort of got it trivially working.

By “sort of” and “trivially” I mean that I’ve tested its ability to solve an empty grid. That is, given an empty 3×3 (or more correctly 9×9) sudoku grid, it can fill it with numbers that would be a valid solution. It doesn’t do randomness yet, so the solution it finds is by some definition the “first” valid sudoku (adding randomness is the first step to generating new puzzles). In principle it should be able to solve existing puzzles, but I haven’t tried it yet. In fact I don’t think the class has enough exposed to be able to fill in the puzzle’s starting cells. Hmm.

The Mercurial repository is public if anyone would like to follow along, or copy my copious mistakes.

Incidentally, the “first” sudoku looks like this:

+---+---+---+ |123|456|789| |456|789|123| |789|123|456| +---+---+---+ |231|674|895| |875|912|364| |694|538|217| +---+---+---+ |317|265|948| |542|897|631| |968|341|572| +---+---+---+