예제 #1
0
 def test_multiple_pathes(self):
     maze = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [1, 0, 1, 1, 1],
             [1, 0, 0, 0, 1], [1, 0, 1, 1, 1]]
     solution = [[1, 1, 1, 1, 1], [2, 2, 0, 0, 1], [1, 2, 1, 1, 1],
                 [1, 2, 0, 0, 1], [1, 2, 1, 1, 1]]
     solve_maze(maze)
     self.assertEqual(maze, solution)
예제 #2
0
 def test_curved_path(self):
     maze = [[1, 1, 1, 1, 1], [0, 0, 1, 0, 0], [1, 0, 1, 0, 1],
             [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]
     solution = [[1, 1, 1, 1, 1], [2, 2, 1, 2, 2], [1, 2, 1, 2, 1],
                 [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]
     solve_maze(maze)
     self.assertEqual(maze, solution)
예제 #3
0
 def test_complex_maze(self):
     maze = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0],
             [1, 1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1],
             [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1],
             [1, 0, 1, 1, 1, 1, 1]]
     solution = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 2, 2, 2, 2],
                 [1, 1, 1, 2, 1, 1, 1], [1, 0, 1, 2, 2, 2, 1],
                 [1, 0, 1, 1, 1, 2, 1], [1, 2, 2, 2, 2, 2, 1],
                 [1, 2, 1, 1, 1, 1, 1]]
     solve_maze(maze)
     self.assertEqual(maze, solution)
예제 #4
0
 def test_vertical_single_path(self):
     maze = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1]]
     solution = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [1, 1, 1, 1, 1]]
     solve_maze(maze)
     self.assertEqual(maze, solution)
예제 #5
0
 def test_horizontal_single_path(self):
     maze = [[1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1]]
     solution = [[1, 2, 1], [1, 2, 1], [1, 2, 1], [1, 2, 1], [1, 2, 1]]
     solve_maze(maze)
     self.assertEqual(maze, solution)