ajout commentaire et clarification code

This commit is contained in:
Francois Pelletier 2019-02-16 21:19:13 -05:00
parent e4cca7e1fa
commit db544fb125
2 changed files with 11 additions and 3 deletions

View file

@ -10,6 +10,10 @@
# (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).
#
# IFT-7025 Hier 2019
# François Pelletier
# 908144032
"""

View file

@ -10,7 +10,10 @@
# (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).
#
# IFT-7025 Hier 2019
# François Pelletier
# 908144032
"""
This file contains all of the agents that can be selected to control Pacman. To
@ -307,7 +310,7 @@ class CornersProblem(search.SearchProblem):
"*** YOUR CODE HERE ***"
currentPosition, currentCornerSet = state
# print "Validation du but a ", currentPosition, "Coins restants: ", currentCornerSet
# On atteint le but s'il reste un seul coin a atteindre, et que c'est l'etat actuel
# On atteint le but s'il restait un seul coin a atteindre, et que c'est l'etat actuel
# print "But atteint"
return (len(currentCornerSet)==1 and currentPosition in currentCornerSet)
@ -393,7 +396,8 @@ def cornersHeuristic(state, problem):
# Liste des distances de Manhattan vers les sommets restants
mh=[]
for i in range(nb_corners):
mh.append(util.manhattanDistance(currentPosition,currentCornerList[i]))
current_distance = util.manhattanDistance(currentPosition,currentCornerList[i])
mh.append(current_distance)
# On retourne la plus grande distance, qui est le meilleur scenario possible pour terminer
return max(mh)