From 02c38bfe43b34ae34d2067fac6486286a00350ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Mon, 4 Feb 2019 00:29:24 -0500 Subject: [PATCH] ajout de commentaires --- search/search.py | 8 ++++---- search/searchAgents.py | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/search/search.py b/search/search.py index d2b9aae..76be37b 100644 --- a/search/search.py +++ b/search/search.py @@ -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() diff --git a/search/searchAgents.py b/search/searchAgents.py index 068b623..4e018db 100644 --- a/search/searchAgents.py +++ b/search/searchAgents.py @@ -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