Skip to content
Snippets Groups Projects
Commit c419cf3f authored by Michael Mutote's avatar Michael Mutote
Browse files

22202956

first commit breadth first search, algorithm done. Is_goal and Successors is jst skeleton code
parent 29291563
No related branches found
No related tags found
No related merge requests found
def sucessor(state):
return []
\ No newline at end of file
import queue
import is_goal
import Sucessors
def BreadthFirstSearch(state):
"""accepts start state"""
toDo = queue.Queue()
toDo.put([state])
explored = {state}
while not toDo.empty():
path = toDo.get()
current = path[-1]
if is_goal.isgoal(current):
return path
for next_state in Sucessors.sucessor(current):
if not (next_state in explored):
explored.add(next_state)
path.append(next_state)
toDo.put(path)
return "Error Path not found"
def isgoal(state):
return False
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment