Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dfs(self):
- closedset = set()
- fringle = util.Stack()
- fringle.push(self.fromNode)
- while fringle.isEmpty() == 0:
- state, path = (fringle.pop(),[])
- if (self.isGoalState(state)):
- return path
- if (state not in closedset):
- closedset.add(state)
- for i in self.getSuccessors(state, set):
- fringle.push((i[0], path + [i[1]]))
Advertisement
Add Comment
Please, Sign In to add comment