Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. frontier=util.Stack()
  2. frontier.push(problem.getStartState())
  3. mylist=[]
  4. while True:
  5. if frontier.isEmpty():
  6. return []
  7. current=frontier.pop()
  8. print 'current'
  9. print current
  10. if problem.isGoalState(current)==True:
  11. return mylist
  12. mylist.append(current)
  13. info=problem.getSuccessors(current)
  14. info.sort()
  15. for i in info:
  16. st=i[0]
  17. moment_list=[]
  18. while True:
  19. if frontier.isEmpty()==True:
  20. break
  21. re=frontier.pop()
  22. moment_list.append(re)
  23. for k in range(len(moment_list),0):
  24. frontier.push(moment_list[k])
  25. print 'moment_list'
  26. print moment_list
  27. print 'st'
  28. print st
  29. if st in mylist:
  30. if st in moment_list:
  31. continue
  32. else:
  33. frontier.push(st)
  34. else:
  35. frontier.push(st)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement