|
|
|
@ -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()
|
|
|
|
|
|
|
|
|
|