THE "SUDOKU" GAME
“Sudoku” is a logic game that became very popular among the general public through newspapers and magazines. The objective is to place
the numbers from 1 to 9 in a half-completed 9x9 panel (the “Sudoku”). “Sudoku” consists of a total of nine (9) smaller 3x3 sub-panels.
All cells need to be filled with one of the numbers from 1 to 9. Numbers need each time to be selected in accordance to the following
three conditions:
• A number may be present only once in each column.
• A number may be present only once in each line.
• A number may be present only once in each 3x3 sub-panel.
The dots represent Empty Cells to be filled. Numbers in the brackets represent given numbers. We need to note that a valid (properly
completed) “Sudoku” is considered the one truly possessing a UNIQUE solution.
“Sudoku” can be constructed for other dimensions as well, e.g. a 4x4 “Sudoku” (consisting of 2x2 sub-panels and accepting only numbers
from 1 to 4), a 16x16 “Sudoku” (consisting of 4x4 sub-panels and accepting only numbers from 1 to 9 and letters from A to F, etcetera).
The “Sudoku” Algorithm presented here is including a definition of a constant size, that is the dimension of “Sudoku” e.g.
#define size 9
For a 9x9 “Sudoku” (consisting of 3x3 sub-panels and accepting numbers from 1 to 9). The presented code is capable of handling sizes
equal to either 4 or 9. Of course, as the size will be each time fixed, the executable that will emerge will operate on a single value
of size (the one supplied by the user at the initial stages of the Algorithm).
The Algorithm is also capable of saving in a text file (Savegame File) with a name and an increment number, one unsolved or one half-solved
“Sudoku” according to the following format:
201900000
600058041
000003050
010000070
024305180
070000020
060500000
790240005
000007402
The contents of the text file (Savegame File) can later inserted into the program to be completed at a later time.
Download "Sudoku"