Why bother to write another Sudoku solver?
Basically – for fun.
I enjoy solving Sudoku problems, especially Killer Sudoku. A few years ago I started to write a program to solve them automatically by coding the same algorithms I was using by hand. I knew very little about windows applications, or object oriented programming,so initially wrote this using Excel as the user interface and Visual Basic for the logic.
After a while I wanted to try different geometries such as the Samurai problem – which occurs occasionally in “The Times” or problems where the standard 3 by 3 box is replaced by an irregular Shape, as in the diagram.
I also wanted to solve Killer problems which use many of the same approaches as standard Sudoku problems with the addition of a partition routine.
This was all working in the Excel version but the input and display became restrictive.
It is now written in C#. At first this seemed completely alien to someone brought up on Fortran IV but slowly the realisation came that, through the use of Classes, it actually became simpler as it became more general. Because this was all done for fun, and to teach me a new language, I have tried to make it completely general.
- As far as I’m aware, there is no restriction on the size or shape of the geometry that can be created.
- The only absolute restriction on the number of characters is that they must all have different 4 digit (hex) Unicode numbers. The diagram at right illustrates this in a character set I call “diabolical”. The actual characters can be chosen at time of setting up the problem with complete freedom subject to the above.
- Problems can have higher than 2 dimensions, the only restriction is that it is possible to project the problem onto a 2 dimensional rectangular grid for input and output purposes. The diagram below shows a problem which is composed of the outer faces of a 4*4 cube. This has been laid out flat as if it were a cardboard box. The rule is that no character is allowed to repeat on any of the faces or any of the 12 bands around the cube. 3 of the bands have been highlighted in colour.
- Holes can exist within problems, although I’m not sure why anyone would want to do this!