– A* for Solving a Maze For this assignment, you will implement the A* algorithm to find an exit out of a maze. Your goal is to return the instructions for solving the maze and show the configuration after each move. The maze is a rectangular grid containing passageways, walls, and a single exit point that the agent must reach. The agent can move in four directions, but cannot move to a location containing a wall. The agent’s position can wrap-around, meaning that if the agent is in the leftmost location and the rightmost location of the same row is not a wall, then the agent can still move left. Requirements For this assignment, you are given base Python 3 code that executes a uniform cost search for a similar maze problem, but without the possibility of wrap-around moves. So download this code first, and then do the following: 1. Modify that code so it solves the maze problem using the A* algorithm and allowing for wrap-around moves. 2. Make sure your heuristic takes into account the wrap-around possibility. Remember, heuristic needs to satisfy the admissibility and consistency properties. 4. Your program needs to work correctly for all inputs. The maze itself is loaded from the mp1-2021-input.txt file. This file could be different for testing purposes. The shape of the maze could also vary, although the start and end coordinates will be fixed. Additional Requirements 1. The name of your source code file should be mp1.py. All your code should be within a single file. 2. You can only import numpy and queue packages. 3. Your code should follow good coding practices, including good use of whitespace and use of both inline and block comments. 4. You need to use meaningful identifier names that conform to standard naming conventions. 5. At the top of each file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name. 6. The output should exactly match the sample output shown on the last page. Note that for a different input state, the output may be different. I will be testing on a different input than shown in the sample. Sample Program Output 1 START [[0 1 1 0 1] [0 4 0 0 1] [0 0 1 1 1] [1 0 0 0 0] [1 1 0 1 0] [1 0 0 1 0] [1 0 0 1 0] [1 0 1 1 0] [1 0 0 0 0] [0 2 1 1 1]] Move 1 ACTION: left [[0 1 1 0 1] [4 0 0 0 1] [0 0 1 1 1] [1 0 0 0 0] [1 1 0 1 0] [1 0 0 1 0] [1 0 0 1 0] [1 0 1 1 0] [1 0 0 0 0] [0 2 1 1 1]] Move 2 ACTION: up [[4 1 1 0 1] [0 0 0 0 1] [0 0 1 1 1] [1 0 0 0 0] [1 1 0 1 0] [1 0 0 1 0] [1 0 0 1 0] [1 0 1 1 0] [1 0 0 0 0] [0 2 1 1 1]] Move 3 ACTION: up [[0 1 1 0 1] [0 0 0 0 1] [0 0 1 1 1] [1 0 0 0 0] [1 1 0 1 0] [1 0 0 1 0] [1 0 0 1 0] [1 0 1 1 0] [1 0 0 0 0] [4 2 1 1 1]] Move 4 ACTION: right [[0 1 1 0 1] [0 0 0 0 1] [0 0 1 1 1] [1 0 0 0 0] [1 1 0 1 0] [1 0 0 1 0] [1 0 0 1 0] [1 0 1 1 0] [1 0 0 0 0] [0 4 1 1 1]] Number of states visited = 7 Sample Program Output 2 Artificial Intelligence MP1: A* search algorithm implementation for a maze SEMESTER: Spring 2021 NAME: [name] START [[1 1 1 0 1 0] [0 4 0 0 1 0] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [0 2 1 1 1 0]] Move 1 ACTION: left [[1 1 1 0 1 0] [4 0 0 0 1 0] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [0 2 1 1 1 0]] Move 2 ACTION: left [[1 1 1 0 1 0] [0 0 0 0 1 4] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [0 2 1 1 1 0]] Move 3 ACTION: up [[1 1 1 0 1 4] [0 0 0 0 1 0] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [0 2 1 1 1 0]] Move 4 ACTION: up [[1 1 1 0 1 0] [0 0 0 0 1 0] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [0 2 1 1 1 4]] Move 5 ACTION: right [[1 1 1 0 1 0] [0 0 0 0 1 0] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [4 2 1 1 1 0]] Move 6 ACTION: right [[1 1 1 0 1 0] [0 0 0 0 1 0] [0 0 1 1 1 0] [1 0 0 0 0 0] [1 1 0 1 0 1] [1 0 0 1 0 1] [1 0 0 1 0 1] [1 0 1 1 0 1] [1 0 0 0 0 0] [0 4 1 1 1 0]] Number of states visited = 13
Get Free Quote!
413 Experts Online