diff --git a/Breath-First Search/Sucessors.py b/Breath-First Search/Sucessors.py new file mode 100644 index 0000000000000000000000000000000000000000..f65ac2e988b134c37a0c6b3bc165da5955316fe1 --- /dev/null +++ b/Breath-First Search/Sucessors.py @@ -0,0 +1,3 @@ + +def sucessor(state): + return [] \ No newline at end of file diff --git a/Breath-First Search/breadth_first_search.py b/Breath-First Search/breadth_first_search.py new file mode 100644 index 0000000000000000000000000000000000000000..038881fd4f9f2c827e1da355c96d9156c4cab959 --- /dev/null +++ b/Breath-First Search/breadth_first_search.py @@ -0,0 +1,21 @@ +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" diff --git a/Breath-First Search/is_goal.py b/Breath-First Search/is_goal.py new file mode 100644 index 0000000000000000000000000000000000000000..e07ac1cb9bdf9341547619d06660c9ce519f5c40 --- /dev/null +++ b/Breath-First Search/is_goal.py @@ -0,0 +1,7 @@ + +def isgoal(state): + + return False + + +