Coder Social home page Coder Social logo

tauseef-hilal / pathfinding-visualizer Goto Github PK

View Code? Open in Web Editor NEW
206.0 3.0 21.0 10.4 MB

Pathfinding visualizations with Python and Pygame

License: MIT License

Python 100.00%
pathfinder pathfinding pathfinding-algorithms pathfinding-visualizer maze-solver maze-solver-visualization pygame python maze-generation-algorithms

pathfinding-visualizer's Introduction

Pathfinding Visualizer

A pathfinding visualizer made in Python and Pygame. This project aims to provide a fun and interactive way to learn about popular pathfinding algorithms such as Dijkstra's, A* and other supported algorithms.

Demonstration.mp4

Screenshots

A* Search Dijkstra's Search
Greedy Best-First Search Breadth-First Search
Depth-First Search Results

Features

  • Visualizes popular pathfinding algorithms such as Dijkstra's and A*.
  • Visualizes popular maze generation algorithms like Recursive division and Prim's algorithm.
  • Feature to run all algorithms b2b to compare their performance.
  • Step-by-step animation of the search process, allowing you to see how the algorithms work.
  • Option to place obstacles on the grid to create custom maps.
  • Selectable starting and ending points on the grid.
  • Configurable speed of the animation.
  • Configurable grid size
  • Clean and intuitive user interface.

Supported Algorithms

The following pathfinding algorithms are currently supported in this visualizer:

  1. Depth First Search (DFS): A traversal-based algorithm that goes as far as possible along each branch before backtracking. Not commonly used for pathfinding.
  2. Breadth First Search (BFS): A traversal-based algorithm that explores all neighbors of a node before moving on to the next level. Guaranteed to find the shortest path in unweighted graphs.
  3. Greedy Best First Search: A heuristic search algorithm that prioritizes visiting nodes closest to the goal. Not guaranteed to find the shortest path, but often faster.
  4. A* Search: A heuristic search algorithm that combines the strengths of BFS and greedy best first search. Efficient for many types of graphs.
  5. Dijkstra's Search: A shortest path algorithm that uses a priority queue to prioritize visiting nodes with the smallest known cost. Guaranteed to find the shortest path in weighted graphs.

Each algorithm uses a different approach to finding the shortest path between two points on a graph. Choose the one that best fits your use case and watch it in action.

Requirements

  • Python 3.10 and above: You can download the latest version of Python from the official website (https://www.python.org/downloads/).
  • Pygame: You can install Pygame by running 'pip install pygame' in your terminal.

Usage

  • Download the project repository to your local machine.
  • Navigate to the project directory.
  • Run python3 run.pyw if on Linux or Mac
  • Run python run.pyw if on Windows

Command Line Arguments

  1. --cell-size Usage: python run.pyw --cell-size:<int>

Contributing

This project is open to contributions, bug reports, and suggestions. If you've found a bug or have a suggestion, please open an issue.

License

This project is licensed under the MIT License.

Enjoy visualizing pathfinding algorithms!

pathfinding-visualizer's People

Contributors

tauseef-hilal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pathfinding-visualizer's Issues

Run errror: run.py

Command: python3 run.py

pygame 2.1.2 (SDL 2.0.16, Python 3.9.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "..../Pathfinding-Visualizer/run.py", line 1, in <module>
    from src.main import main
  File "..../Pathfinding-Visualizer/src/main.py", line 4, in <module>
    from src.state import State
  File "..../Pathfinding-Visualizer/src/state.py", line 2, in <module>
    from src.widgets import Label
  File "..../Pathfinding-Visualizer/src/widgets.py", line 308
    match child.alignment:
          ^
SyntaxError: invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.