Merge branch 'master' of git.francoispelletier.org:francois/ift7025-tp1
This commit is contained in:
commit
3c87d54f68
3 changed files with 16 additions and 4 deletions
|
@ -1,2 +1,6 @@
|
|||
# ift7025-tp1
|
||||
# IFT-7025 Hiver 2019 - Travail pratique #1
|
||||
|
||||
IFT-7025 Hiver 2019
|
||||
Travail pratique #1
|
||||
remis par François Pelletier 908144032
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ al.ca# search.py
|
|||
# (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
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue