Exemple #1
0
    def test_2_finishes(self):
        text_file = Maze.open_map(wall_maze)
        lb = Maze(None, text_file)
        lb.finishes = [(1, 1), (38, 1)]

        lb.start = (20, 1)
        path = solve_maze(lb, 0)
        path.pop(0)
        self.assertEqual(path[-1], (38, 1))  # second finish is closer

        lb.start = (15, 1)
        path = solve_maze(lb, 0)
        path.pop(0)
        self.assertEqual(path[-1], (1, 1))  # first finish is closer
Exemple #2
0
 def test_incorrect_maze_params(self):
     text_file = Maze.open_map(straight_maze)
     lb = Maze(None, text_file)
     lb.start = None
     lb.finishes = [None]
     lb.bombs = -1
     self.assertRaises(ValueError, lambda: solve_maze(lb, 0))