Project 2 - Sudoku Solver
Due - Monday February 26, 2007
The goal of this project is to give you experience using
recursion. You will add a solve option to the sudoku
program you wrote for Project 1. If the user selects solve, you will invoke a method
that will come up with a solution to the puzzle (if one exists).
Your solver will operate in two phases. In phase 1, it will
iteratively look at each square and fill in its value if it has
only 1 possible solution. This situation occurs when there is
only one number that does not occur in the row, column, and
subsquare of the empty square. Your program will repeat this
process (beginning in the top left of the grid) until all squares
are full or no empty squares with only 1 solution remain.
In phase 2, your solver will use recursion and
backtracking to try every possible combination until a valid
solution is found. The basic idea of the algorithm is as follows:
select a valid candidate value for a particular square and then
recursively solve the remaining puzzle. We will spend a bit of
time discussing this algorithm during the class period.
Due 9:40AM Monday February 26, 2007
- Complete and submit your working code. Turn in a hard copy in class and place a copy of your .java files in /home/submit/cs112-s07/username.
- Make sure that each function is well documented. Your documentation should specify the type and function of the input parameters and output.
- Run your program on a variety of inputs ensuring that all error conditions are handled correctly.
Note: No portion of your code may be copied from any other
source including another text book, a web page, or another
student (current or former). You must provide citations for any
sources you have used in designing and implementing your program.
Sami Rollins