summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--search.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/search.py b/search.py
index 72c40d5..863c863 100644
--- a/search.py
+++ b/search.py
@@ -168,7 +168,7 @@ def breadthFirstSearch(problem):
def uniformCostSearch(problem):
"""Search the node of least total cost first."""
- "*** YOUR CODE HERE ***"
+
# The only differences between the search functions:
# 1. Cost: Lambda function to get the total cost of a node
# 2. Nodes: Data structure to store the nodes
@@ -186,7 +186,7 @@ def uniformCostSearch(problem):
node = nodes.pop()
# If the node has been traversed by a cheaper path, skip it
- if visited.has_key(node[0]) and visited[node[0]] < cost(node):
+ if visited.has_key(node[0]) and visited[node[0]] <= cost(node):
continue
# Add set the value at the nodes index to the cost