예제 #1
0
 def test_open_cell_and_3bvs(self):
     game = Game(5, 5, 1)
     game.mine_map = np.array([
         [1, 1, 0, 0, 1],
         [0, 0, 0, 1, 0],
         [0, 0, 0, 0, 0],
         [1, 0, 0, 0, 1],
         [0, 0, 0, 0, 0],
     ])
     game.fill_numbers()
     game.open_cell((4, 2))
     self.assertEqual(game.get_3bvs(), 10)
예제 #2
0
 def test_bfs_number_cell(self):
     game = Game(5, 5, 1)
     game.mine_map = np.array([
         [1, 1, 0, 0, 1],
         [0, 0, 0, 1, 0],
         [0, 0, 0, 0, 0],
         [1, 0, 0, 0, 1],
         [0, 0, 0, 0, 0],
     ])
     game.fill_numbers()
     expected = {(3, 2), (3, 3), (3, 1), (2, 1), (2, 3), (4, 3), (2, 2),
                 (4, 2), (4, 1)}
     actual1 = game.bfs((4, 2))
     actual2 = game.bfs((3, 2))
     self.assertEqual(actual1, actual2)
     self.assertEqual(actual1, expected)