def show_current_policy_and_map(self): """ For visualization of the maze and policy when using the A* planner. :return: None """ vis = Visualizer(self.maze_map.dim) vis.draw_maze(Maze('known_maze.txt')) vis.draw_policy(reversed(self.planner.policy), self.location, self.heading) vis.show_window()
from MazeMap import MazeMap from AStarPlanner import AStarPlanner from Visualizer import Visualizer from Position import Position from Direction import Direction from maze import Maze import sys from GoalHeuristic import GoalHeuristic if __name__ == '__main__': file_path = str(sys.argv[1]) maze_map = MazeMap(file_path=file_path) maze = Maze(file_path) planner = AStarPlanner(maze_map, GoalHeuristic(maze.dim)) vis = Visualizer(maze_map.dim) start_pos = Position(0,0) start_head = Direction(0) planner.replan(start_pos, start_head) vis.draw_maze(maze) vis.draw_policy(reversed(planner.policy), start_pos, start_head) print "Number of moves: ", len(planner.policy) vis.show_window()