-
Notifications
You must be signed in to change notification settings - Fork 4
Sudoku Solution Algorithm
This solution requires you to have a wrapper method that initializes your helper method (of the same name) to start at the origin (the upper-left corner) of the 2-D array parameter. The wrapper method is called by the Test class (or any jUnit test case that Anthony might create) and is necessary for the magic of recursion to occur.
Your helper method (an overloaded method which also keeps track of a row and a column parameter) is where the Sudoku solver does a majority of the work. Keep in mind that this method is solving a Sudoku puzzle, which is a 9 x 9 array. Also keep in mind that the checkSudoku method that Edo provided designates the literal integer '0' as a blank cell.
- The base case of this method does the following:
If the column has reached its bound
-
Increment the row.
-
Reset the column (to the start of the next row)
-
If the row has reached its bound, return true;
- Then, if the current cell of the Sudoku is blank