Skip to content

Here is a compilation of my learning on path finding algorithms. I did case study from scratch and implementing BFS, DFS and A* into practical summary using pygame.

License

Notifications You must be signed in to change notification settings

SaladinIART/Maze_Solver

Repository files navigation

Maze_Solver

Overview

This project is a hands-on exploration of fundamental pathfinding algorithms: Breadth-First Search (BFS), Depth-First Search (DFS), and A Search*, brought to life through Pygame visualizations. The implementation is designed to demonstrate how these algorithms traverse a maze to find the optimal path from a starting point to a goal.

This repository serves as a compilation of case studies on pathfinding, illustrating how these algorithms operate in real-world scenarios that are crucial in fields like robotics and AI navigation.

Features

  • Visual Maze Solver: The algorithms are visualized using Pygame, showing the traversal process in real time.
  • Multiple Algorithms: Users can explore BFS, DFS, and A* Search, understanding the strengths and weaknesses of each.
  • Interactive Experience: Users can easily run the project and experiment with different maze configurations.

Table of Contents

  1. Getting Started
  2. Installation
  3. Usage Instructions
  4. Algorithm Explanations
  5. File Descriptions
  6. Future Improvements
  7. Contributing
  8. License
  9. Acknowledgments

Getting Started

This section will guide you through setting up the Maze Solver project on your local machine to get it running.

Installation

To run this project, ensure Python and Pygame are installed on your system. Follow these steps:

  1. Clone the Repository:
  1. Install Dependencies: Use pip to install Pygame:
  • pip install pygame All dependencies will be installed automatically.

Usage Instructions

Once the dependencies are installed, the project can be run using the following steps:

Open a Terminal: Navigate to the project directory. Run the Main Script:

  • python Maze_Solver_v1.31.py
  1. Keyboard Controls:
  • Press B to run Breadth-First Search (BFS).
  • Press D to run Depth-First Search (DFS).
  • Press A to run A Search*.
  1. Maze Visualization: The maze will be displayed, and the selected algorithm will begin solving it, visualizing the traversal in real time.

Algorithm Explanations

  1. Breadth-First Search (BFS):

    • Description: BFS explores the maze level by level, ensuring that the shortest path is found. It uses a queue to manage the nodes.
    • Strengths: Guarantees the shortest path in an unweighted maze.
    • Weaknesses: Can be memory-intensive for large mazes.
  2. Depth-First Search (DFS):

    • Description: DFS dives deep into paths before backtracking, using a stack structure.
    • Strengths: Memory-efficient compared to BFS.
    • Weaknesses: Does not guarantee the shortest path; may explore inefficient routes.
  3. A* Search:

    • Description: A* uses a heuristic (such as the Manhattan distance) to guide the search, balancing efficiency and accuracy.
    • Strengths: Efficient for finding the shortest path in a weighted maze.
    • Weaknesses: Heuristic choice can impact performance.

File Descriptions

  • Basic_map.py: Contains basic maze configurations.
  • Maze_Solver_v1.31.py: Main script for running the maze-solving algorithms.
  • Maze_Reconfigure.py: Script for experimenting with different maze setups.
  • map_generator.py: Utility for generating random maze maps.
  • README.md: This file, detailing the project.

Future Improvements

  • Enhanced Heuristics: Experimenting with different heuristics to improve A* performance.
  • More Algorithms: Adding Dijkstra's algorithm and bidirectional search.
  • Interactive GUI: Developing a graphical user interface for easier configuration and experimentation.

Contributing

Contributions are welcome! Please follow these steps if you'd like to contribute:

  1. Fork the Repository
  2. Create a Branch for your feature or bug fix:
    • git checkout -b feature-name
  3. Commiyt your changes:
    • git commit -m "Describe your feature or fix"
  4. Push to your branch:
    • git push origin feature-name
  5. Open a Pull Request on the main repository.

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for more details.

Acknowledgments

  • Pygame Community: For providing extensive resources and support.
  • Open-Source Contributors: To everyone who contributes to making coding projects more accessible and innovative.

Final Notes

This documentation is designed to be beginner-friendly and accessible. Feedback is always welcome to improve clarity and usability. Happy coding!

About

Here is a compilation of my learning on path finding algorithms. I did case study from scratch and implementing BFS, DFS and A* into practical summary using pygame.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages