Skip to content

Instantly share code, notes, and snippets.

@kartikkukreja
Last active August 29, 2015 14:22
Show Gist options
  • Save kartikkukreja/56208c903ccc2996b7d7 to your computer and use it in GitHub Desktop.
Save kartikkukreja/56208c903ccc2996b7d7 to your computer and use it in GitHub Desktop.
Tree Search Algorithm
def treeSearch(problem, strategy):
strategy.push(problem.getStartState())
while not strategy.empty():
node = strategy.pop()
if problem.isGoalState(node):
return node[1]
for move in problem.getSuccessors(node):
strategy.push(move)
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment