Built pathfinding visualizer in Python using pygame. Using A star algorithm to find the shortest-path and Generate the grid using maze-generation algorithm and add the ability of controlling the grid structure and the distribution of the blocks and the position of the source and the destination.
This astar pathfinding algorithm is an informed search algorithm which means it is much more efficient that your standard algorithms like breadth first search or depth first search
- Users can select the start and end node and set them in any place on the grid by clicking left mouse button.
- Users can optionally choose to clear the nodes or draw walls by dragging the right mouse button and left mouse button respectively.
- Users can optionally randomize the walls in the maze and add more walls by dragging the mouse.
- user can clear and reset the grid by just pressing the
C
key. - Finally to start the path visualization algorithm press
SPACEBAR
, sit back and watch the vizualization algorithm run.
- A* is a graph traversal and path search algorithm, which is often used in computer science due to its completeness, optimality, and optimal efficiency. One major practical drawback is its O(bd) space complexity, as it stores all generated nodes in memory. Thus, in practical travel-routing systems, it is generally outperformed by algorithms which can pre-process the graph to attain better performance, as well as memory-bounded approaches; however, A* is still the best solution in many cases.
PLEASE FEEL FREE TO FORK THE PROJECT AND START CONTRIBUTING. :)
python modules
import pygame
Your laptop with python 3.6.x (onwards) installed.
NOTE: Those with Linux and MacOSX would have Python installed by default, no action required.
Windows: Download the version for your laptop via https://www.python.org/downloads/
NOTES In your preferred editor, make sure indentation is set to "4 spaces".
- Make sure you have pygame installed in python otherwise code may fail, to install pygame in your machine > open python in your terminal then type
pip install pygame
to install.⚠️
- Clone or download repositiory: https://github.com/arevish/A-PathFinding-Visualizer.git
- In source folder, run
python3 'main.py'
to start program, optionally, run with--help
argument to see other runtime options.