SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
N.B this is a pacman game sample program in python
Question
Implement A* graph search in the empty function aStarSearch in search.py. A* takes a heuristic
function as an argument. Heuristics take two arguments: a state in the search problem (the main
argument), and the problem itself (for reference information). The nullHeuristic heuristic
function in search.py is a trivial example.
You can test your A* implementation on the original problem of finding a path through a maze
to a fixed position using the Manhattan distance heuristic (implemented already as
manhattanHeuristic in searchAgents.py).
python pacman.py -l bigMaze -z .5 -p SearchAgent -a
fn=astar,heuristic=manhattanHeuristic
You should see that A* finds the optimal solution slightly faster than uniform cost search (about
549 vs. 620 search nodes expanded in our implementation, but ties in priority may make your
numbers differ slightly). What happens on openMaze for the various search strategies?
search.py
# search.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attribution Information: The Pacman AI projects were developed at UC Berkeley.
# The core projects and autograders were primarily created by John DeNero
# (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu).
# Student side autograding was added by Brad Miller, Nick Hay, and
# Pieter Abbeel (pabbeel@cs.berkeley.edu).
"""
In search.py, you will implement generic search algorithms which are called by
Pacman agents (in searchAgents.py).
"""
import util
class SearchProblem:
"""
This class outlines the structure of a search problem, but doesn't implement
any of the methods (in object-oriented terminology: an abstract class).
You do not need to change anything in this class, ever.
"""
def getStartState(self):
"""
Returns the start state for the search problem.
"""
util.raiseNotDefined()
def isGoalState(self, state):
"""
state: Search state
Returns True if and only if the state is a valid goal state.
"""
util.raiseNotDefined()
def getSuccessors(self, state):
"""
state: Search state
For a given state, this should return a list of triples, (successor,
action, stepCost), where 'successor' is a successor to the current
state, 'action' is the action required to get there, and 'stepCost' is
the incremental cost of expanding to that successor.
"""
util.raiseNotDefined()
def getCostOfActions(self, actions):
"""
actions: A list of actions to take
This method returns the total cost of a particular sequence of actions.
The sequence must be composed of legal moves.
"""
util.raiseNotDefined()
def tinyMazeSearch(problem):
"""
Returns a sequence of moves that solves tinyMaze. For any other maze, the
sequence of moves will be incorrect, so only use this for tinyMaze.
"""
from game import Directions
s = Directions.SOUTH
w = Directions.WEST
return [s, s, w, s, w, w, s, w]
def depthFirstSearch(problem):
"""
Search the deepest nodes in the search tree first.
Your search algorithm needs to return a list of actions that reaches the
goal. Make sure to implement a graph search algorithm.
To get started, you might want to try some of these simple commands to
understand the search problem that is being passed in:
print "Start:", problem.getStartState()
print "Is the start a goal?", problem.isGoalState(problem.getStartState())
print "Start's successors:", problem.getSuccessors(problem.getStartState())
"""
"*** YOUR CODE HERE ***"
util.raiseNotDefined()
def breadthFirstSearch(problem):
"""Search the shallowest nodes in the search tree first."""
"*** YOUR CODE HERE ***"
util.raiseNotDefined()
def uniformCostSearch(problem):
"""Search the node of least total cost first."""
"*** YOUR CODE HERE ***"
util.raiseNotDefined()
def nullHeuristic(state, problem=None):
"""
A heuristic function estimates the cost from the current state to the nearest
goal in the provided SearchProblem. This heuristic is trivial.
"""
return 0
def aStarSearch(problem, heuristic=nullHeuristic):
"""Search the node that has the lowest combined cost and heuristic first."""
"*** YOUR CODE HERE ***"
util.raiseNotDefined()
# Abbreviations
bfs = breadthFirstSearch
dfs = depthFirstSearch
astar = aStarSearch
ucs = uniformCostSearch
searchAgent.py
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9
part 10
part 11
part 12
# searchAgents.py # Licensing Information: You are free to use or extend these projects for #
educational purposes provided that (1) you do not distribute or publish. # solutions, (2) you
retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to
http://ai.berkeley.edu. # # Attribution Information: The Pacman AI projects were developed at
UC Berkeley. # The core projects and autograders were primarily created by John DeNero #
(deneroucs.berkeley.edu) and Dan Klein (kleln@cs,berkeley,edu). # Student side autograding
was added by Brad Miller, Nick Hay, and # Pieter Abbeel (pabbeel@cs.berkeley.edu). This file
contains all of the agents that can be selected to control Pacman. To select an agent, use the '-p'
option when running pacman.py. Arguments can be passed to your agent using ' a. For example,
to load a searchAgent that uses depth first search (d+5), run the following command: python
pacman.py - p SearchAgent - a fn= depthFirstsearch Commands to invoke other search strategies
can be found in the project description. Please only change the parts of the flle you are asked to.
Look for the lines that say "*** YOUR CODE HERE ***" The parts you fill in start about 3/4 of
the way down. Follow the project description for details. Good luck and happy searching! from
game import Directions from game import Agent from game import Actions import util import
time import search Class GoWestAgent (Agent): "An agent that goes West until it can' t." def
getaction (self, state):
"The agent receives a GameState (defined in pacman.py)." if Directions.WEST in
state.getLegalPacmanActions(): return Directions.WEST else: return Directions.STOP
##################################################
###### # This portion is written for you, but will only work # after you fill in parts of
search.py
##################################################
######### clas 5 SearchAgent (Agent): inw This very general search agent finds a path
using a supplied search algorithm for a supplied search problem, then returns actions to follow
that path. As a default, this agent runs DFS on a PositionsearchProblem to find location (1,1)
Options for fn include: depthFirstsearch or df5 breadthfirstsearch or bfs Note: You should NOT
change any code in Searchagent heuristic='nu11Heuristic'): # Warning: 5ome advanced Python
magic is employed below to find the right functions and problems # Get the search function
from the name and heuristic if fn not in dir (search): raise AttributeError (fn+' is not a search
function in search.py.") func = getattr ( search, fn) if 'heuristic' not in func._code_. co_varnames:
print ((' [SearchAgent] using function +fn)) self. searchFunction = func else: if heuristic in
list(globals().keys()): heur = globals () [heuristic ] elif heuristic in dir(search): heur = getattr
(search, heuristic) else:
If you want to *store* information to be reused in other calls to the heuristic, there is a dictionary
called problem. heuristicinfo that you can use. For example, if you only want to count the walls
once and store that value, try: problem.heuristicinfo[ wallCount'] = problem.walls.count()
subsequent calls to this heuristic can access problem.heuristicinfor 'wallCount'] min position,
foodgrid = state **** YOUR CODE HERE ***" return b class ClosestDotSearchAgent
(SearchAgent): "Search for all food using a sequence of searches" def registerInitialstate(self,
state); self.actions =[] currentstate = state while (currentstate.getFood ()count()>) :
nextPathSegment = self.findPathToClosestDot (currentstate) # The missing piece self.actions t=
nextPathsegment for action in nextpathsegment: legal = currentstate,getlegalActions( ) If action
not in legal: t=(str (action), str(currentstate)) raise Exception(' findPathToclosestDot returned an
illegal move: %5 ! ln%5%t) currentstate = currentstate.generatesuccessor (, action )
self.actionindex =0 print('Path found with cost %d.' % len(self.actions)) def
findPathToClosestDot(self, gamestate); winit Returns a path (a list of actions) to the closest dot,
starting from gamestate. anin # Here are some useful elements of the startstate startPosition =
gamestate. getPacmanPosition() food = gamestate getFood () walls = gameState getwalls ()
problem = AnyFoodSearchProblem (gameState) "*** YOUR CODE HERE ***" util.
raisenotDefined () Class AnyFoodSearchProblem(PositionsearchProblem): min A search
problem for finding a path to any food. This search problem is just like the
PositionsearchProblem, but has a
different goal test, which you need to fill in below. The state space and successor function do not
need to be changed. The class definition above,
AnyFoodSearchProblem(PositionSearchProblem), inherits the methods of the
PositionsearchProblem. You can use this search problem to help you fill in the
findPathToclosestDot method. mn" def init__(self, gamestate): "Stores information from the
gamestate. You don't need to change this." # Store the food for later reference: self. food =
gamestate. getFood () # Store info for the Positionsearchproblem (no need to change this)
self.wa115 = gamestate.getwal1s() self. startstate = gameState. getPacmanPosition () self. costFn
= lambda x:1 self._visited, self._visitedlist, self._expanded ={},[],0 # DO NOT CHANGE def
isGoalstate(self, state): isin The state is Pacman's position. Fill this in with a goal test that will
complete the problem definition. x,y=5tate "*** YOUR CODE HERE **** util.raisenotDefined
() def mazeDistance(point1, point2, gamestate): mwn Returns the maze distance between any
two points, using the search functions you have already built. The gamestate can be any game
state -- Pacman's position in that state is ignored. Example usage: mazeDistance (2,4),(5,6),
gamestate) This might be a useful helper function for your Approximatesearchagent. mn" x1,y1=
point 1 x2,yz= pointz wa11s = gamestate + getwal15()

Mais conteúdo relacionado

Semelhante a N.B this is a pacman game sample program in pythonQuestionImplem.pdf

Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionPaul Irish
 
OO JS for AS3 Devs
OO JS for AS3 DevsOO JS for AS3 Devs
OO JS for AS3 DevsJason Hanson
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfatulkapoor33
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KThomas Fuchs
 
Why is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosWhy is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosDivante
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery PluginsJörn Zaefferer
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesSiarhei Barysiuk
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScriptkvangork
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascriptkvangork
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testingVincent Pradeilles
 
Reliable Javascript
Reliable Javascript Reliable Javascript
Reliable Javascript Glenn Stovall
 
Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Alberto Naranjo
 
How to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in RHow to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in RPaul Bradshaw
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretssmueller_sandsmedia
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfaromalcom
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leetjohndaviddalton
 

Semelhante a N.B this is a pacman game sample program in pythonQuestionImplem.pdf (20)

Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
OO JS for AS3 Devs
OO JS for AS3 DevsOO JS for AS3 Devs
OO JS for AS3 Devs
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdf
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
 
Why is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosWhy is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenarios
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery Plugins
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testing
 
Reliable Javascript
Reliable Javascript Reliable Javascript
Reliable Javascript
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.
 
How to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in RHow to generate a 100+ page website using parameterisation in R
How to generate a 100+ page website using parameterisation in R
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leet
 

Mais de mkagarwalma

OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdfOLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdfmkagarwalma
 
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdfNeed help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdfmkagarwalma
 
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdfObtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdfmkagarwalma
 
Observation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdfObservation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdfmkagarwalma
 
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdfNSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdfmkagarwalma
 
Now that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdfNow that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdfmkagarwalma
 
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdfNogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdfNeed Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdfmkagarwalma
 
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdfNEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfNeed Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfNeed Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfmkagarwalma
 
Nancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfNancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfmkagarwalma
 
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfNakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfmkagarwalma
 
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfMountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfmkagarwalma
 
More than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfMore than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfmkagarwalma
 
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfMonique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfmkagarwalma
 
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfMesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfmkagarwalma
 
Miguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfMiguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfmkagarwalma
 
Mia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfMia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfmkagarwalma
 
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfMichael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfmkagarwalma
 

Mais de mkagarwalma (20)

OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdfOLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
 
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdfNeed help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
 
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdfObtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
 
Observation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdfObservation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdf
 
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdfNSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
 
Now that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdfNow that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdf
 
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdfNogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
 
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdfNeed Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdf
 
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdfNEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
 
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfNeed Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
 
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfNeed Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
 
Nancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfNancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdf
 
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfNakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
 
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfMountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
 
More than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfMore than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdf
 
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfMonique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
 
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfMesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
 
Miguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfMiguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdf
 
Mia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfMia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdf
 
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfMichael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
 

Último

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 

Último (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

N.B this is a pacman game sample program in pythonQuestionImplem.pdf

  • 1. N.B this is a pacman game sample program in python Question Implement A* graph search in the empty function aStarSearch in search.py. A* takes a heuristic function as an argument. Heuristics take two arguments: a state in the search problem (the main argument), and the problem itself (for reference information). The nullHeuristic heuristic function in search.py is a trivial example. You can test your A* implementation on the original problem of finding a path through a maze to a fixed position using the Manhattan distance heuristic (implemented already as manhattanHeuristic in searchAgents.py). python pacman.py -l bigMaze -z .5 -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic You should see that A* finds the optimal solution slightly faster than uniform cost search (about 549 vs. 620 search nodes expanded in our implementation, but ties in priority may make your numbers differ slightly). What happens on openMaze for the various search strategies? search.py # search.py # --------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # Attribution Information: The Pacman AI projects were developed at UC Berkeley. # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel (pabbeel@cs.berkeley.edu). """ In search.py, you will implement generic search algorithms which are called by Pacman agents (in searchAgents.py). """ import util
  • 2. class SearchProblem: """ This class outlines the structure of a search problem, but doesn't implement any of the methods (in object-oriented terminology: an abstract class). You do not need to change anything in this class, ever. """ def getStartState(self): """ Returns the start state for the search problem. """ util.raiseNotDefined() def isGoalState(self, state): """ state: Search state Returns True if and only if the state is a valid goal state. """ util.raiseNotDefined() def getSuccessors(self, state): """ state: Search state For a given state, this should return a list of triples, (successor, action, stepCost), where 'successor' is a successor to the current state, 'action' is the action required to get there, and 'stepCost' is the incremental cost of expanding to that successor. """ util.raiseNotDefined() def getCostOfActions(self, actions): """ actions: A list of actions to take
  • 3. This method returns the total cost of a particular sequence of actions. The sequence must be composed of legal moves. """ util.raiseNotDefined() def tinyMazeSearch(problem): """ Returns a sequence of moves that solves tinyMaze. For any other maze, the sequence of moves will be incorrect, so only use this for tinyMaze. """ from game import Directions s = Directions.SOUTH w = Directions.WEST return [s, s, w, s, w, w, s, w] def depthFirstSearch(problem): """ Search the deepest nodes in the search tree first. Your search algorithm needs to return a list of actions that reaches the goal. Make sure to implement a graph search algorithm. To get started, you might want to try some of these simple commands to understand the search problem that is being passed in: print "Start:", problem.getStartState() print "Is the start a goal?", problem.isGoalState(problem.getStartState()) print "Start's successors:", problem.getSuccessors(problem.getStartState()) """ "*** YOUR CODE HERE ***" util.raiseNotDefined() def breadthFirstSearch(problem): """Search the shallowest nodes in the search tree first.""" "*** YOUR CODE HERE ***"
  • 4. util.raiseNotDefined() def uniformCostSearch(problem): """Search the node of least total cost first.""" "*** YOUR CODE HERE ***" util.raiseNotDefined() def nullHeuristic(state, problem=None): """ A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial. """ return 0 def aStarSearch(problem, heuristic=nullHeuristic): """Search the node that has the lowest combined cost and heuristic first.""" "*** YOUR CODE HERE ***" util.raiseNotDefined() # Abbreviations bfs = breadthFirstSearch dfs = depthFirstSearch astar = aStarSearch ucs = uniformCostSearch searchAgent.py part 1 part 2 part 3 part 4 part 5 part 6 part 7 part 8 part 9 part 10 part 11 part 12
  • 5. # searchAgents.py # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish. # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # Attribution Information: The Pacman AI projects were developed at UC Berkeley. # The core projects and autograders were primarily created by John DeNero # (deneroucs.berkeley.edu) and Dan Klein (kleln@cs,berkeley,edu). # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel (pabbeel@cs.berkeley.edu). This file contains all of the agents that can be selected to control Pacman. To select an agent, use the '-p' option when running pacman.py. Arguments can be passed to your agent using ' a. For example, to load a searchAgent that uses depth first search (d+5), run the following command: python pacman.py - p SearchAgent - a fn= depthFirstsearch Commands to invoke other search strategies can be found in the project description. Please only change the parts of the flle you are asked to. Look for the lines that say "*** YOUR CODE HERE ***" The parts you fill in start about 3/4 of the way down. Follow the project description for details. Good luck and happy searching! from game import Directions from game import Agent from game import Actions import util import time import search Class GoWestAgent (Agent): "An agent that goes West until it can' t." def getaction (self, state): "The agent receives a GameState (defined in pacman.py)." if Directions.WEST in state.getLegalPacmanActions(): return Directions.WEST else: return Directions.STOP ################################################## ###### # This portion is written for you, but will only work # after you fill in parts of search.py ################################################## ######### clas 5 SearchAgent (Agent): inw This very general search agent finds a path using a supplied search algorithm for a supplied search problem, then returns actions to follow that path. As a default, this agent runs DFS on a PositionsearchProblem to find location (1,1) Options for fn include: depthFirstsearch or df5 breadthfirstsearch or bfs Note: You should NOT change any code in Searchagent heuristic='nu11Heuristic'): # Warning: 5ome advanced Python magic is employed below to find the right functions and problems # Get the search function from the name and heuristic if fn not in dir (search): raise AttributeError (fn+' is not a search function in search.py.") func = getattr ( search, fn) if 'heuristic' not in func._code_. co_varnames: print ((' [SearchAgent] using function +fn)) self. searchFunction = func else: if heuristic in list(globals().keys()): heur = globals () [heuristic ] elif heuristic in dir(search): heur = getattr (search, heuristic) else:
  • 6. If you want to *store* information to be reused in other calls to the heuristic, there is a dictionary called problem. heuristicinfo that you can use. For example, if you only want to count the walls once and store that value, try: problem.heuristicinfo[ wallCount'] = problem.walls.count() subsequent calls to this heuristic can access problem.heuristicinfor 'wallCount'] min position, foodgrid = state **** YOUR CODE HERE ***" return b class ClosestDotSearchAgent (SearchAgent): "Search for all food using a sequence of searches" def registerInitialstate(self, state); self.actions =[] currentstate = state while (currentstate.getFood ()count()>) : nextPathSegment = self.findPathToClosestDot (currentstate) # The missing piece self.actions t= nextPathsegment for action in nextpathsegment: legal = currentstate,getlegalActions( ) If action not in legal: t=(str (action), str(currentstate)) raise Exception(' findPathToclosestDot returned an illegal move: %5 ! ln%5%t) currentstate = currentstate.generatesuccessor (, action ) self.actionindex =0 print('Path found with cost %d.' % len(self.actions)) def findPathToClosestDot(self, gamestate); winit Returns a path (a list of actions) to the closest dot, starting from gamestate. anin # Here are some useful elements of the startstate startPosition = gamestate. getPacmanPosition() food = gamestate getFood () walls = gameState getwalls () problem = AnyFoodSearchProblem (gameState) "*** YOUR CODE HERE ***" util. raisenotDefined () Class AnyFoodSearchProblem(PositionsearchProblem): min A search problem for finding a path to any food. This search problem is just like the PositionsearchProblem, but has a
  • 7. different goal test, which you need to fill in below. The state space and successor function do not need to be changed. The class definition above, AnyFoodSearchProblem(PositionSearchProblem), inherits the methods of the PositionsearchProblem. You can use this search problem to help you fill in the findPathToclosestDot method. mn" def init__(self, gamestate): "Stores information from the gamestate. You don't need to change this." # Store the food for later reference: self. food = gamestate. getFood () # Store info for the Positionsearchproblem (no need to change this) self.wa115 = gamestate.getwal1s() self. startstate = gameState. getPacmanPosition () self. costFn = lambda x:1 self._visited, self._visitedlist, self._expanded ={},[],0 # DO NOT CHANGE def isGoalstate(self, state): isin The state is Pacman's position. Fill this in with a goal test that will complete the problem definition. x,y=5tate "*** YOUR CODE HERE **** util.raisenotDefined () def mazeDistance(point1, point2, gamestate): mwn Returns the maze distance between any two points, using the search functions you have already built. The gamestate can be any game state -- Pacman's position in that state is ignored. Example usage: mazeDistance (2,4),(5,6), gamestate) This might be a useful helper function for your Approximatesearchagent. mn" x1,y1= point 1 x2,yz= pointz wa11s = gamestate + getwal15()