Question: Artificial Intelligence Machine Problem 1 A * for Solving a Maze give a unique solution for this problem without plagarism with step by step clear
Artificial Intelligence
Machine Problem A for Solving a Maze
give a unique solution for this problem without plagarism with step by step clear explaination
IMPORTANT NOTICE: You do not have permission to share the description of this assignment or discuss it with anyone outside the
class. Also, you cannot share your code or solution in general with anyone, nor can you ask anyone for the code or solution.
Failure to adhere to this policy will result in a zero grade for the assignment and may result in a dismissal from Lewis University.
Introduction
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: 'down', 'right', 'left', and up but cannot move to
a location containing a wall.
Requirements
For this assignment, you are given base Python code that contains a part of the implementation. Download this code first, and
then do the following:
Determine a heuristic function that can be used with A to solve the search problem. Make sure the A heuristic satisfies
the admissibility and consistency properties.
Modify that code so it solves the maze problem using the A algorithm.
Modify the print statements from the base code to include your info in the printed heading.
Run the code and verify it finds the correct path and generates the right number of states visited.
Additional Requirements
The name of your source code file should be mppy All your code should be within a single file.
You can only import numpy, queue, and heapq packages.
Your code should follow good coding practices, including good use of whitespace and use of both inline and block
comments.
You need to use meaningful identifier names that conform to standard naming conventions.
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.
The output should exactly match the sample output shown on the last page.
What to Turn In
You will turn in the single mppy file using BlackBoard.
#usrbinenv python
# coding: utf
@author: szczurpi
This program implements a search algorithm for solving a grid maze
It allows moves in directions point cost for each move
import numpy as np
import queue # Needed for frontier queue
from heapq import heapify
class MazeState:
Stores information about each visited state within the search
# Define constants
SPACE
WALL
EXIT
START
END
maze nparray
dtypenpint
mazeEND EXIT
def initself confSTART, g predstateNone, predactionNone:
Initializes the state with information passed from the arguments
self.pos conf # Configuration of the state current coordinates
self.gcost g # Path cost
self.pred predstate # Predecesor state
self.actionfrompred predaction # Action from predecesor state to current state
### TODO heuristic value for Agreedy search ###
def hashself:
Returns a hash code so that it can be stored in a set data structure
return self.pos.hash
def eqself other:
Checks for equality of states by positions only
### TODO ###
def ltself other:
Allows for ordering the states by the path g cost
### TODO ###
def strself:
Returns the maze representation of the state
a nparrayselfmaze
aselfpos
return npstra
def isgoalself:
Returns true if current position is same as the exit position
### TODO ###
movenum # Used by showpath to count moves in the solution path
def showpathself:
Recursively outputs the list of moves and states along path
if self.pred is not None:
self.pred.showpath
if MazeState.movenum:
printSTART
else:
printMoveMazeState.movenum, 'ACTION: self.actionfrompred
MazeState.movenum MazeState.movenum
printself
def canmoveself move:
Returns true if agent can move in the given direction
### TODO ###
def gennextstateself move:
Generates a new M
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
