{"id":22347667,"url":"https://github.com/ayax537/breadth-first-search-bfs-maze-solver","last_synced_at":"2025-03-26T10:43:01.310Z","repository":{"id":262229471,"uuid":"886605353","full_name":"ayax537/Breadth-First-Search-BFS-Maze-Solver","owner":"ayax537","description":"This Python script implements the Breadth First Search (BFS) algorithm to solve a maze using the Turtle graphics library. The program visually represents the maze and the search process, allowing users to observe how BFS explores paths to find a solution.","archived":false,"fork":false,"pushed_at":"2024-11-11T09:26:10.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T12:12:25.156Z","etag":null,"topics":["ai","bfs-algorithm","bfs-search"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ayax537.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-11T09:24:59.000Z","updated_at":"2024-11-11T09:27:54.000Z","dependencies_parsed_at":"2024-11-11T10:39:12.420Z","dependency_job_id":null,"html_url":"https://github.com/ayax537/Breadth-First-Search-BFS-Maze-Solver","commit_stats":null,"previous_names":["ayax537/breadth-first-search-bfs-maze-solver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayax537%2FBreadth-First-Search-BFS-Maze-Solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayax537%2FBreadth-First-Search-BFS-Maze-Solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayax537%2FBreadth-First-Search-BFS-Maze-Solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayax537%2FBreadth-First-Search-BFS-Maze-Solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayax537","download_url":"https://codeload.github.com/ayax537/Breadth-First-Search-BFS-Maze-Solver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245641317,"owners_count":20648637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","bfs-algorithm","bfs-search"],"created_at":"2024-12-04T10:10:13.664Z","updated_at":"2025-03-26T10:43:01.285Z","avatar_url":"https://github.com/ayax537.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Breadth-First-Search-BFS-Maze-Solver\n# Overview\nThis Python script implements the Breadth First Search (BFS) algorithm to solve a maze using the Turtle graphics library. The program visually represents the maze and the search process, allowing users to observe how BFS explores paths to find a solution.\n\n# Key Components\n1. Turtle Graphics Setup\nThe script creates a Turtle graphics window with:\nA black background.\nA title \"A Maze Solving Program.\"\nDimensions set to 1300x700 pixels.\n2. Maze Representation\nThe maze is defined using a grid of characters:\n+ represents walls.\n  (space) represents open paths.\ns marks the starting position.\ne marks the ending position.\n3. Turtle Classes\nFive turtle classes are defined to represent different elements of the maze:\nMaze (white turtle): Stamps the walls of the maze.\nGreen turtle: Marks cells that have been visited during the search.\nBlue turtle: Indicates frontier cells currently being explored.\nRed turtle: Represents the starting position.\nYellow turtle: Represents the ending position and the solution path.\n4. Maze Setup Function\nThe setup_maze function initializes the maze based on the provided grid:\nIt iterates through each character in the grid, determining the positions of walls, paths, the start, and the end points.\nTurtles are moved to their respective positions and stamped to visualize the maze layout.\n5. BFS Search Function\nThe search function implements the BFS algorithm:\nIt uses a queue (deque) to track the current cells being explored.\nThe algorithm explores possible moves (up, down, left, right) and marks cells as visited.\nIf a cell is part of the path and has not been visited, it is added to the queue.\nThe search continues until the end position is reached.\n6. Backtracking to Find the Solution Path\nThe backRoute function is called once the end is reached:\nIt retraces the path from the end back to the start, marking the solution path with the yellow turtle.\n7. Execution Flow\nThe maze is set up, the BFS search is performed, and the solution path is visualized.\nThe program ends when the user clicks on the Turtle graphics window.\n# Conclusion\nThis script serves as an educational tool for understanding how the Breadth First Search algorithm works in the context of maze solving. The visual representation through Turtle graphics makes it engaging and helps illustrate the algorithm's systematic exploration of paths. Users can modify the grid to test different maze configurations, enhancing their understanding of BFS.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayax537%2Fbreadth-first-search-bfs-maze-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayax537%2Fbreadth-first-search-bfs-maze-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayax537%2Fbreadth-first-search-bfs-maze-solver/lists"}