Python help just change pdf files to py files, already has code, instructions in homework, easy assignment make an offer
Python help just change pdf files to py files, already has code, instructions in homework, easy assignment make an offer
Week 5 and 6 Assignment In this project, we are going to implement depth and breadth first search for pacman to reach a food in a maze. The program consists of three files:, and You need to implement the Depth and Breadth first search in the file. Your task is: Method readMaze(filename) in reads a file filename that contains a maze. The program call the readMaze and pass it the maze1.txt. The file maze1.txt contains the following maze: **************** *P * ****** ***** ** * * * * ******** **** * * * ********* ****** * .* **************** (0, 0) Screen position The only thing that is changing in this problem is Pacman position. So, the state is agent (Pacman) position. After performing an action the agent position changes to a new position. However, we want to save the sequence of actions that are applied on Pacman to reach the food. So, our state is (actions, pacmanPos); where action is a set of actions; for example [‘l’, ‘u’, ‘l’, ‘l’] to indicate pacman moves from its start position: to the left, then up, the left, then left. See actions in next point. Actions available for the intelligent agent (Pacman) is [‘l’, ‘r’, ‘u’, ‘d’] for left, right, up and down; respectively. Left action changes Pacman by (0, -1) Right action changes Pacman by (0, 1) Up action changes Pacman by (-1, 0) Down action changes Pacman by (1, 0) The food is an image food5.png: Open the file study it very well, make sure you understand it, the most methods you will use, legalActions, Successor, isGoal and startState. Write down the isGoal() method. Write down the startState() method. Open the file, you will see the function search(). Inside search you will implement your breadth first search. To make your algorithm complete, write the graph search version of BFS where you should avoid exploring states that already explored; use explored list to record the explored states. Some libraries that you need will help you: p = pr.Problem() to get an instance of the problem class in the file. Note there is an import ProblemConfiguration as pr at the top of file. p.legalActions to get the actions from a current position: p.legalActions(currentPos) it will return a list of actions available from the current position currentPos of Pacman. The possible actions: ‘l’ for left, ‘r’ for right, ‘u’ for up and ‘d’ for down. p.successor to get the next position after applying the action on the current position: newPos = p.successor(action, currentPos); where newPos is a tuple (x, y). p.isGoal: method to check if the currentPos of Pacman is at the goal (food). This method returns either true or false: p.isGoal(currentPos) P.startState: methods that return the start state; that is currentPos of pacman: currentPos = p.startState(). Your Task: Implement the depth first search; if you completed the breadth first search, then change one line; which is the direction of inserting the new state to the frontier. To make your algorithm complete, write the graph search version of DFS where you should avoid exploring states that already explored; use explored list to record the explored states. Change the maze file in to maze2.txt; change the xStep and yStep in to 32 and 26; respectively, then run the program (if still the maze is not visible in your screen, then reduce more the xStep and yStep). How many states are explored using breadth search first? Declare a variable that count the number of explored nodes in explored list. What to submit: Source code of your program. This document with answers of point (a) and (b) in (5).

Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.