Example #1
0
    def test_update(self):
        board = self.easy_board
        s = Sodoku(board)
        i, j = s.get_feasible_ordered()[0]
        f = s.find_feasible(i, j)
        s.update(i, j, next(iter(f)))

        self.assertTrue(s.is_valid())
        return
Example #2
0
#!/usr/bin/python

from sodoku import Sodoku

sodoku = Sodoku()


Example #3
0
 def test_solve000(self):
     board = self.easy_board
     s = solve(Sodoku(board))
     self.assertTrue(s.is_solved())
     self.assertTrue(verify_solves(s, board))
     return
Example #4
0
 def test_copy(self):
     board = self.easy_board
     s = Sodoku(board)
     s.copy()
     return
Example #5
0
 def test_valid_002(self):
     board = self.invalid_board
     s = Sodoku(board)
     self.assertFalse(s.is_valid())
     return
Example #6
0
 def test_feasible(self):
     board = self.easy_board
     s = Sodoku(board)
     feasible = set(s.find_feasible(4, 4))
     self.assertEqual(feasible, {3, 7, 8})
     return
Example #7
0
 def test_iter_box(self):
     board = self.easy_board
     s = Sodoku(board)
     self.assertTrue({4, 5, 2}, set(s.get_fixed(s.iter_box(4, 4))))
     return
Example #8
0
 def test_valid_001(self):
     board = self.easy_board
     s = Sodoku(board)
     self.assertTrue(s.is_valid())
     return
Example #9
0
 def test_iter_row(self):
     board = self.easy_board
     s = Sodoku(board)
     self.assertTrue({2, 5, 4}, set(s.get_fixed(s.iter_row(4))))
     return
Example #10
0
 def test_iter_col(self):
     board = self.easy_board
     s = Sodoku(board)
     self.assertTrue({1, 5, 9, 6}, set(s.get_fixed(s.iter_col(4))))
     return
Example #11
0
 def test000(self):
     board = self.easy_board
     str(Sodoku(board))
     return
Example #12
0
 def test_solve_ai_se(self):
     board = ai_SE_board
     s = solve(Sodoku(board))
     self.assertTrue(s.is_solved())
     self.assertTrue(verify_solves(s, board))
     return
Example #13
0
 def test_solve_min_clues(self):
     board = min_clues_board
     s = solve(Sodoku(board))
     self.assertTrue(s.is_solved())
     self.assertTrue(verify_solves(s, board))
     return
Example #14
0
 def test_solve006(self):
     board = board006
     s = solve(Sodoku(board))
     self.assertTrue(s.is_solved())
     self.assertTrue(verify_solves(s, board))
     return
Example #15
0
#!/usr/bin/python

from sodoku import Sodoku

from copy import copy, deepcopy

sodoku = Sodoku()

sodoku.displayTable()


print sodoku.fillSodoku2()