Fri, 01 Feb 2013 10:18:47 +0100
removed completeness test - the solver automatically returns false when the field is incomplete
src/de/uapcore/sudoku/Solver.java | file | annotate | diff | comparison | revisions |
--- a/src/de/uapcore/sudoku/Solver.java Thu Jan 31 18:44:44 2013 +0100 +++ b/src/de/uapcore/sudoku/Solver.java Fri Feb 01 10:18:47 2013 +0100 @@ -173,7 +173,7 @@ } // Backtrack - return solve(f, candidates) && complete(f); + return solve(f, candidates); } public boolean check(Field f) { @@ -202,45 +202,6 @@ return true; } - private boolean complete(Field f) { - for (int i = 0 ; i < 9 ; i++) { - if (!complete(f.getRow(i))) { - return false; - } - if (!complete(f.getColumn(i))) { - return false; - } - } - for (int x = 0 ; x < 3 ; x++) { - for (int y = 0 ; y < 3 ; y++) { - if (!complete(f.getSquare(x, y))) { - return false; - } - } - } - return true; - } - - private boolean complete(int[][] square) { - for (int x = 0 ; x < 3 ; x++) { - for (int y = 0 ; y < 3 ; y++) { - if (square[x][y] == 0) { - return false; - } - } - } - return true; - } - - private boolean complete(int[] line) { - for (int i = 0 ; i < 9 ; i++) { - if (line[i] == 0) { - return false; - } - } - return true; - } - private boolean valid(int[] line) { int numbers[]; numbers = new int[9];