SHARE
TWEET

Untitled

a guest Oct 19th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top