Question: n searchAgents.py, youll find a fully implemented SearchAgent, which plans out a path through Pacmans world and then executes that path step-by-step. The search algorithms

n searchAgents.py, youll find a fully implemented SearchAgent, which plans out a path through Pacmans world and then executes that path step-by-step. The search algorithms for formulating a plan are not implemented thats your job.\ \ First, test that the SearchAgent is working correctly by running:\ \ python pacman.py -l tinyMaze -p SearchAgent -a fn=tinyMazeSearch\ CopyCopy\ The command above tells the SearchAgent to use tinyMazeSearch as its search algorithm, which is implemented in search.py. Pacman should navigate the maze successfully.\ \ Now its time to write full-fledged generic search functions to help Pacman plan routes! Pseudocode for the search algorithms youll write can be found in the lecture slides. Remember that a search node must contain not only a state but also the information necessary to reconstruct the path (plan) which gets to that state.\ \ Important note: All of your search functions need to return a list of actions that will lead the agent from the start to the goal. These actions all have to be legal moves (valid directions, no moving through walls).\ \ Important note: Make sure to use the Stack, Queue and PriorityQueue data structures provided to you in util.py! These data structure implementations have particular properties which are required for compatibility with the autograder.\ \ Hint: Each algorithm is very similar. Algorithms for DFS, BFS, UCS, and A* differ only in the details of how the fringe is managed. So, concentrate on getting DFS right and the rest should be relatively straightforward. Indeed, one possible implementation requires only a single generic search method which is configured with an algorithm-specific queuing strategy. (Your implementation need not be of this form to receive full credit).\ \ Implement the depth-first search (DFS) algorithm in the depthFirstSearch function in search.py. To make your algorithm complete, write the graph search version of DFS, which avoids expanding any already visited states.\ \ Your code should quickly find a solution for:\ \ python pacman.py -l tinyMaze -p SearchAgent\ python pacman.py -l mediumMaze -p SearchAgent\ python pacman.py -l bigMaze -z .5 -p SearchAgent\ CopyCopy\ The Pacman board will show an overlay of the states explored, and the order in which they were explored (brighter red means earlier exploration). Is the exploration order what you would have expected? Does Pacman actually go to all the explored squares on his way to the goal?\ \ Hint: If you use a Stack as your data structure, the solution found by your DFS algorithm for mediumMaze should have a length of 130 (provided you push successors onto the fringe in the order provided by getSuccessors; you might get 246 if you push them in the reverse order). Is this a least cost solution? If not, think about what depth-first search is doing wrong.\ \ Grading: Please run the below command to see if your implementation passes all the autograder test cases.\ \ python autograder.py -q q1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!