Sadaguchi

Untitled

May 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def dfs(self):
  2.         closedset = set()
  3.         fringle = util.Stack()
  4.         fringle.push(self.fromNode)
  5.         while fringle.isEmpty() == 0:
  6.             state, path = (fringle.pop(),[])
  7.             if (self.isGoalState(state)):
  8.                 return path
  9.             if (state not in closedset):
  10.                 closedset.add(state)
  11.                 for i in self.getSuccessors(state, set):
  12.                     fringle.push((i[0], path + [i[1]]))
Advertisement
Add Comment
Please, Sign In to add comment