ajout de commentaires
This commit is contained in:
parent
db5810d5d1
commit
02c38bfe43
2 changed files with 7 additions and 6 deletions
|
@ -114,7 +114,7 @@ def depthFirstSearch(problem):
|
|||
# Dans ce cas, ajouter le noeud et le chemin pour s'y rendre a la pile
|
||||
# print "Ajout du noeud a la pile: ", succNoeudCourant
|
||||
maPile.push((succNoeudCourant,listeDirections+[succDirection]))
|
||||
print "pas de solution"
|
||||
# print "pas de solution"
|
||||
util.raiseNotDefined()
|
||||
|
||||
def breadthFirstSearch(problem):
|
||||
|
@ -146,7 +146,7 @@ def breadthFirstSearch(problem):
|
|||
# Dans ce cas, ajouter le noeud et le chemin pour s'y rendre a la file
|
||||
#print "Ajout du noeud a la file: ", succNoeudCourant
|
||||
maFile.push((succNoeudCourant,listeDirections+[succDirection]))
|
||||
print "pas de solution"
|
||||
# print "pas de solution"
|
||||
util.raiseNotDefined()
|
||||
|
||||
def uniformCostSearch(problem):
|
||||
|
@ -192,7 +192,7 @@ def uniformCostSearch(problem):
|
|||
elif (succNoeudCourant in [i[0] for i in maFileEtat.heap]):
|
||||
maFileEtat.update(succNoeudCourant,succCostChemin)
|
||||
listeDirections = maFileChemin.pop()
|
||||
print "pas de solution"
|
||||
# print "pas de solution"
|
||||
util.raiseNotDefined()
|
||||
|
||||
def nullHeuristic(state, problem=None):
|
||||
|
@ -245,7 +245,7 @@ def aStarSearch(problem, heuristic=nullHeuristic):
|
|||
elif (succNoeudCourant in [i[0] for i in maFileEtat.heap]):
|
||||
maFileEtat.update(succNoeudCourant,succCostChemin)
|
||||
listeDirections = maFileChemin.pop()
|
||||
print "pas de solution"
|
||||
# print "pas de solution"
|
||||
util.raiseNotDefined()
|
||||
|
||||
|
||||
|
|
|
@ -288,6 +288,7 @@ class CornersProblem(search.SearchProblem):
|
|||
# Please add any code here which you would like to use
|
||||
# in initializing the problem
|
||||
"*** YOUR CODE HERE ***"
|
||||
# Je prends un set, vu que le tuple est immutable
|
||||
self.cornerSet = {(1,1), (1,top), (right, 1), (right, top)}
|
||||
self.defaultCost = 1
|
||||
|
||||
|
@ -305,11 +306,11 @@ class CornersProblem(search.SearchProblem):
|
|||
"""
|
||||
"*** YOUR CODE HERE ***"
|
||||
currentPosition, currentCornerSet = state
|
||||
print "Validation du but a ", currentPosition, "Coins restants: ", currentCornerSet
|
||||
# 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
|
||||
if len(currentCornerSet)==1:
|
||||
if currentPosition in currentCornerSet:
|
||||
print "But atteint"
|
||||
# print "But atteint"
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue