Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frontier=util.Stack()
- frontier.push(problem.getStartState())
- mylist=[]
- while True:
- if frontier.isEmpty():
- return []
- current=frontier.pop()
- print 'current'
- print current
- if problem.isGoalState(current)==True:
- return mylist
- mylist.append(current)
- info=problem.getSuccessors(current)
- info.sort()
- for i in info:
- st=i[0]
- moment_list=[]
- while True:
- if frontier.isEmpty()==True:
- break
- re=frontier.pop()
- moment_list.append(re)
- for k in range(len(moment_list),0):
- frontier.push(moment_list[k])
- print 'moment_list'
- print moment_list
- print 'st'
- print st
- if st in mylist:
- if st in moment_list:
- continue
- else:
- frontier.push(st)
- else:
- frontier.push(st)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement