def show_path_optimal(self): start = (0, 0) end = (5, 5) robot = Robot(self.map, start, end, "Optimal") print(robot.maps) print("Optimal path from file {}".format(robot.get_min_path()))
def test_min_path_up_down_right_optimal_implementation(self): expected_route = [ 'D', 'D', 'R', 'R', 'U', 'U', 'R', 'R', 'D', 'D', 'D', 'D' ] robot = Robot(get_5x5_map_up_down_right(), (0, 0), (4, 4)) answer = robot.get_min_path() self.assertEqual(answer, expected_route)
def show_path_naive(self): start = (0, 0) end = (5, 5) robot = Robot(self.map, start, end, "Naive") print(robot.maps) print("Naive (right down) path from file {}".format( robot.get_min_path()))
def show_path_up_righ_down_left(self): maps = Map( "1 20 1 1 1 1 1 1 20 1 20 20 20 1 1 20 20 20 1 20 20 20 20 1 1") start = (0, 0) end = (4, 4) robot = Robot(maps, start, end, "Optimal") print("Map with up down right left") print(robot.maps) print("Optimal path from file {}".format(robot.get_min_path()))
def test_min_path_2x2_naive_implementation(self): expected_route = ['R', 'D'] robot = Robot(get_2x2_map(), (0, 0), (1, 1), "Naive") answer = robot.get_min_path() self.assertEqual(answer, expected_route)
def test_min_path_example_optimal_implementation(self): expected_route = ['R', 'R', 'D', 'D', 'R', 'D', 'D', 'R', 'R', 'D'] robot = Robot(get_map(), (0, 0), (4, 4)) answer = robot.get_min_path() self.assertEqual(answer, expected_route)