From c419cf3f0d7d21cb6558783f0a5a27acaa4336e9 Mon Sep 17 00:00:00 2001
From: Michael Mutote <130656746+mr1Michael@users.noreply.github.com>
Date: Wed, 18 Oct 2023 12:45:01 +0200
Subject: [PATCH] 22202956 first commit breadth first search, algorithm done.
 Is_goal and Successors is jst skeleton code

---
 Breath-First Search/Sucessors.py            |  3 +++
 Breath-First Search/breadth_first_search.py | 21 +++++++++++++++++++++
 Breath-First Search/is_goal.py              |  7 +++++++
 3 files changed, 31 insertions(+)
 create mode 100644 Breath-First Search/Sucessors.py
 create mode 100644 Breath-First Search/breadth_first_search.py
 create mode 100644 Breath-First Search/is_goal.py

diff --git a/Breath-First Search/Sucessors.py b/Breath-First Search/Sucessors.py
new file mode 100644
index 0000000..f65ac2e
--- /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 0000000..038881f
--- /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 0000000..e07ac1c
--- /dev/null
+++ b/Breath-First Search/is_goal.py	
@@ -0,0 +1,7 @@
+
+def isgoal(state):
+
+    return False
+
+
+
-- 
GitLab