Sudoku
Sudoku
Sanjay Jain et al.: Mathematical and C Programming Approach for Sudoku Game
2. Problem Analysis
Since Sudoku game is hugely attractive for worldwide
players in different intellectual levels, it is significantly
necessary for researchers to create puzzles tailored to the
difficulty requests of players in a tolerable time.
Meanwhile, these created puzzles must yield a unique
solution so that players can complete the puzzles based on
confirm ed cells using logic-deducing step by step. A puzzle
with unique solution also shows sufficient intellectual
challenges in the pursuit of terminal answer, and highlights
the inherent charm of Sudoku game.
Thus, we develop a program to construct specific Su doku
puzzles with the consideration of the following three
requirements: as in[2].
2.1. Varying Difficulty
Essentially, the program should be able to create puzzles
in different levels of difficulty. It regulates that the program
for creating must be designed by means of two jobs as
follows:
Difficulty level: define what the difficulty level is, and
evaluate a fixed Sudoku puzzle by a grading program.
Extensibility: A varying number as a metric of
difficulty request from a play can be input by the player.
Based on this number, the algorithm for creating must be
applicable to generate diverse puzzles satisfying the
difficulty request of the player.
2.2. Unique Solution
All generated Sudoku puzzles must be guaranteed to
yield a unique solution by a solving algorithm.
2.3. Minimizing Complexity
The programs of all these algorithms must finish their
jobs in a short time accepted by users or players.
2.4. Assumptions
We scale the game environment of a Sudoku puzzle
within a 9 -by-9 grid, and take no consideration of the
Sudoku puzzle in other size of the grid.
All the statistic data of the running time in this paper
are counted by our computer. These data have reliable
statistic values and comparability since they are collected
under the same computational condition.
2.5. Computational complexity of the Sudoku Problem
The computational complexity for a Sudoku problem is
analytically valuable, in fact, at every step there is always a
cell that can be filled only with a number, than the
complexity results O(n^2),where n is the number of cells for
each row or column,(in our case n=9).
Instead, for a generalized Sudoku problem (a Sudoku
problem that has not a uniqu e solution) the computational
complexity is not easily valuable analytically but may be
evaluated by comparison with the corresponding one of a
problem, the mathematical complexity of which has been
evaluated and is known; as in[3],[4] .
Sanjay Jain et al.: Mathematical and C Programming Approach for Sudoku Game
return 0;
}
This program gives in output a generalized Sudoku
instance, but we cannot be sure that this instance has a unique
solution.
5.1. Comparison with Existing One
To generate an instance with unique solution the
following method, developed by Professor Della Croce and
professor Ferro of Politecnico di Torino is used.
Suppose that the model presented above has been solved
and a feasible solution has been found. Denote by SOL(i,j)
the value of the element (i,j) of the schema in the feasible
solution. Solve the following model P2:
Variables: Xi,j,k binary i=1...9, j=1...9, k=1...9
Objective Function: min
Constraints:
6. Results
Based on the specification of algorithms above, we
create Sudoku puzzles in different levels respectively
within tolerable time using our developed solving and
generating algorithms while guarantees each of these
puzzles has a unique feasible solution.
Our algorithm finds at least one feasible solution, if it
exists. Originally, we assumed each Sudoku puzzle has one
unique solution since usually an answer is provided with
each puzzle. However, after playing a few games, we
discovered that uniqueness is not a requirement for puzzle
creators. Some puzzles have multiple solutions. In such
cases, our solution was correct but distinct from the solution
provided by the puzzle creators.
8. Examples
In this paper some examples of Sudoku instance on
which our model has been tested will be given.
Example of Sudoku and its solution.
ACKNOWLEDGEMENTS
The authors are thankful to the reviewers for their
suggestions to improve the present paper.
REFERENCES
[1] Bertram Felgenhauer & Frazer Jarvis, 2006. Mathematics of
Sudoku I. Mathematical Spectrum 39 (2006): 15-22.
[2]
[3]
[4]