Recently a nice book has been published which explains how to create a computer program to solve and to generate Sudoku puzzles: "Sudoku programming with C".
At first sight it might seem strange that the author chose to use the C programming language which is rather old. But actually it proves to be a good choice because the code used in the book can be read by a broader audience since it doesn´t contain higher abstraction layers such as object orientation or functional programming. Even the use of pointers (a rather tricky concept in C) has been minimized.
Different solution strategies are explained which can be used by human solvers as well as the computer. These strategies are implemented in the computer program and on top of it an advanced computer algorithm called backtracking is used to solve even the hardest Sudoku. The code used in the book is properly developed and very well explained.
The source code is available for download and the author explains in appendix A how to use Eclipse to compile this source code. Unfortunately I didn´t manage to install a C-compiler in my version of Eclipse that I use for Java or XML. On this page I explain how to install and use an alternative for Eclipse to be able to compile the source code (for Windows users that is - support for C is no problem on Apple).

I use Quincy, a simple free C/C++ IDE for Windows. Go to the Quincy website and download the latest version of the setup-program.
Run it to install Quincy on your computer. The installation is pretty straightforward.
After installation the program can be started no additional installs are necessary.
In the Quincy-menu choose {File} {New} and in the dialog that follows point to Project:



Press OK; enter a project name and confirm.
Be sure to save the project file into the folder where the c-files (the sources) reside.
In the blank project screen you have to add all the c-files of the solver (or the generator if you want to compile those sources). This can be done through the menu {File} {Open} or by dragging the c-files onto the Quincy screen from Windows explorer:



Now choose {Project} {Build} from the menu and your executable will be created.


© Dirk Verlinden (2009-2018) - dirk.verlinden@telenet.be - Voorwaarden/Disclaimer - Sitemap