完成附加实验

master
huangjielun 3 years ago
parent bb551fb0f1
commit 566a42c81f

@ -552,11 +552,11 @@ class ClosestDotSearchAgent(SearchAgent):
"*** YOUR CODE HERE ***"
Result = []
Visited = []
Heap = util.PriorityQueue()
Queue = util.PriorityQueue()
startState = (problem.getStartState(),[],0)
Heap.push(startState,startState[2])
while not Heap.isEmpty():
(state,path,cost) = Heap.pop()
Queue.push(startState,startState[2])
while not Queue.isEmpty():
(state,path,cost) = Queue.pop()
if problem.isGoalState(state):
Result = path
break
@ -566,7 +566,7 @@ class ClosestDotSearchAgent(SearchAgent):
newPath = path + [currentPath]
newCost = cost + currentCost
newState = (currentState,newPath,newCost)
Heap.push(newState,newCost)
Queue.push(newState,newCost)
return Result
util.raiseNotDefined()

Binary file not shown.
Loading…
Cancel
Save