Question: Design a heuristic evaluation function for pacman AI agent. List the factors you want to add to the heuristic function Factors: a ) distance to

Design a heuristic
evaluation function for pacman AI
agent. List the factors you want to
add to the heuristic function
Factors:
a) distance to ghost
distance to food, distance to capsule( the earlier
to get the capsule, the higher point the pacman
can get
b) Weight for each factor
Wghost > Wcapsule >W food
c) H()= w1*f1+w2*f2.....
H()=3*dghost+(-1)* dCap+(-2)*dFood
code that needs to be modified:
def evalForPacman(self,state):
totalScore =0.0
dCapsule=0
dFood=0
if(len(self.game.capsulePos)):
dCapsule = minmanhattanDistance(self.game.capsulePos, state.pos)
if(len(self.game.foodPos)):
dFood=minmanhattanDistance(self.game.foodPos, state.pos)
dGhost=manhattanDistance(self.game.ghostPos[0],state.pos)
# step1: define and calculate totalScore for pacman AI agent based on the features of the game.
print(totalScore,",")
return totalScore

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 Programming Questions!