removed completeness test - the solver automatically returns false when the field is incomplete

Fri, 01 Feb 2013 10:18:47 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 01 Feb 2013 10:18:47 +0100
changeset 8
e70a0e3555fb
parent 7
2c0a2766461c
child 9
576e7a2861ae

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];

mercurial