Advertisement
Sadaguchi

Untitled

Mar 25th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def uniformCostSearch(problem):
  2.     closedset = set()
  3.     fringle = util.PriorityQueue()
  4.     fringle.push((problem.getStartState(),[]),0)
  5.     while fringle.isEmpty() == False:
  6.         state, path = fringle.pop()
  7.         if (problem.isGoalState(state)):
  8.             return path
  9.         if (state not in closedset):
  10.             closedset.add(state)
  11.             for i in problem.getSuccessors(state):
  12.                 fringle.push((i[0], path + [i[1]]),((problem.getCostOfActions(),[])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement