Project 4 - Sudoku Solver

Due - Monday November 12, 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.

Grading:

5 Design meeting
15 Overall design and documentation (address all comments from Project 1)
10 Compiles and runs
10 Demonstration and oral responses
25 Phase 1 Solver
35 Phase 2 Recursive Solver

Extra Credit Opportunity

Implement a graphical user interface for your program.

Due 9:40AM Monday November 12, 2007

  1. 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/username.
  2. Make sure that each function is well documented. Your documentation should specify the type and function of the input parameters and output.
  3. 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