Commits

lakin.wecker committed c896ecd Draft

a few more puzzles to try and solve.

Comments (0)

Files changed (1)

sudoku/__init__.py

 
     #---------------------------------------------------------------------------
     def invalidate(self, value):
-        if value == 1 and self.pos() == (3, 4):
-            import pdb; pdb.set_trace()
-            print self.pos(), value
         self.allowed[value-1] = 0
 
     #---------------------------------------------------------------------------
     [_, 4, _,   2, _, 9,   _, 8, _],
     [_, _, 8,   7, _, 6,   4, _, _],
 ]
+game_3 = [
+    [_, 7, _,   8, _, 6,   _, _, _],
+    [_, _, _,   9, _, 5,   1, _, 3],
+    [_, _, 6,   _, _, _,   _, _, 9],
+
+    [5, _, _,   _, _, _,   3, _, _],
+    [_, _, 9,   _, 5, 4,   _, 7, 6],
+    [6, _, _,   _, _, _,   5, _, _],
+
+    [_, _, 4,   _, _, _,   _, _, 1],
+    [_, _, _,   2, _, 9,   4, _, 8],
+    [_, 1, _,   4, _, 3,   _, _, _],
+]
+game_4 = [
+    [_, _, 3,   _, _, _,   8, _, _],
+    [_, _, _,   8, _, 1,   2, _, _],
+    [_, 9, 1,   _, _, _,   _, _, _],
+
+    [_, _, _,   _, _, _,   _, 5, _],
+    [_, 6, 4,   _, _, 8,   9, _, _],
+    [_, _, 2,   _, 3, _,   _, _, 8],
+
+    [_, _, 5,   _, 1, _,   _, _, _],
+    [_, _, _,   _, 5, 4,   6, _, _],
+    [7, _, 9,   3, _, _,   _, _, 2],
+]
 
 if __name__ == "__main__":
     game = Game(game_1)
     print unicode(game)
-    print game.grid[3][4].possible()
-    print game.grid[4][8].possible()
     game.solve_iteration()
     game.solve_iteration()
     game.solve_iteration()
-    game.solve_iteration()
-    print game.grid[3][4].possible()
-    print game.grid[4][8].possible()
     print unicode(game)
     game.is_solved()