From 4d246422ac7357d8bd6c701923fe4ae140669bdb Mon Sep 17 00:00:00 2001
From: Michael Mutote <130656746+mr1Michael@users.noreply.github.com>
Date: Wed, 18 Oct 2023 15:39:59 +0200
Subject: [PATCH] 22202956 first commit breadth first search, algorithm done.
 tested with Maze problem

---
 Breath-First Search/breadth_first_search.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/Breath-First Search/breadth_first_search.py b/Breath-First Search/breadth_first_search.py
index 038881f..b24cdc9 100644
--- a/Breath-First Search/breadth_first_search.py	
+++ b/Breath-First Search/breadth_first_search.py	
@@ -1,21 +1,19 @@
 import queue
-import is_goal
-import Sucessors
 
 
-def BreadthFirstSearch(state):
-    """accepts start state"""
+def BreadthFirstSearch(state, successor, isgoal):
+    """accepts start state, Please do not change this function"""
     toDo = queue.Queue()
     toDo.put([state])
     explored = {state}
     while not toDo.empty():
         path = toDo.get()
         current = path[-1]
-        if is_goal.isgoal(current):
+        if isgoal(current):
             return path
-        for next_state in Sucessors.sucessor(current):
-            if not (next_state in explored):
+        for next_state in successor(current):
+            if next_state not in explored:
                 explored.add(next_state)
-                path.append(next_state)
-                toDo.put(path)
+                path2 = path + [next_state]
+                toDo.put(path2)
     return "Error Path not found"
-- 
GitLab