Better comments
This commit is contained in:
		
							parent
							
								
									24463fe920
								
							
						
					
					
						commit
						f84cccc1b5
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		|  | @ -38,6 +38,7 @@ public class Solver implements SudokuSolver { | |||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         // If row is 9, drop down to the next column, if column is 9, we are done | ||||
|         if (row == 9) { | ||||
|             row = 0; | ||||
|             if (++col == 9) { | ||||
|  | @ -45,13 +46,17 @@ public class Solver implements SudokuSolver { | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // If we have a "number" in the current cell | ||||
|         // recursively call solve() on the next cell | ||||
|         if (board[row][col] != 0) { | ||||
|             return solve(row + 1, col); | ||||
|         } | ||||
| 
 | ||||
|         // Check for legal values in the current cell | ||||
|         for (int val = 1; val <= 9; ++val) { | ||||
|             if (legal(row, col, val)) { | ||||
|                 board[row][col] = val; | ||||
|                 // When we find a legal value, recursively call solve() on the next cell | ||||
|                 if (solve(row + 1, col)) { | ||||
|                     return true; | ||||
|                 } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus