Exemple #1
0
 def test_rotate_clockwise(self):
     lines = board.get_lines("sudoku_boards/hardest.txt")
     for line in lines:
         game_board = board.convert_str_to_2d_board(line.replace("\n", ""))
         generator.rotate_clockwise(game_board)
         result = solver.solve_sudoku(game_board, False)
         self.assertEqual(result, True)
Exemple #2
0
 def test_switch_numbers(self):
     lines = board.get_lines("sudoku_boards/hardest.txt")
     for line in lines:
         game_board = board.convert_str_to_2d_board(line.replace("\n", ""))
         for _ in range(10):
             generator.switch_numbers(game_board, randint(1, 9), randint(1, 9))
         result = solver.solve_sudoku(game_board, False)
         self.assertEqual(result, True)
Exemple #3
0
 def test_switch_block_row(self):
     lines = board.get_lines("sudoku_boards/hardest.txt")
     for line in lines:
         game_board = board.convert_str_to_2d_board(line.replace("\n", ""))
         for _ in range(10):
             index1 = randint(0, 2)
             index2 = randint(0, 2)
             generator.switch_block_row(game_board, index1, index2)
         result = solver.solve_sudoku(game_board, False)
         self.assertEqual(result, True)
Exemple #4
0
 def test_hardest(self):
     lines = board.get_lines("sudoku_boards/hardest.txt")
     self.check(lines)
Exemple #5
0
 def test_easy5(self):
     lines = board.get_lines("sudoku_boards/easy5.txt")
     self.check(lines)
Exemple #6
0
def get_base_grid():
    unsolved_lines = get_lines("sudoku_boards/easy5.txt")
    index = randint(0, len(unsolved_lines) - 1)
    grid = convert_str_to_2d_board(unsolved_lines[index])
    return grid