A fun experiment using the A* Pathfinding algorithm to find the shortest path between two given points.
Here is a small showcase of the project:
a.star.pathfinding.mp4
I have always been interested in mathematical algorithms and found that this was a fun one to implement in Python. I also got some experience with creating a GUI application in Windows.
You load up the folder in your favourite IDE and run the path_finding.py file.
- The blue dot is the start point.
- The green dot is the end point.
- The black dots are obstacles that the path can't go through. The path can however go diagonally between black dots.
When you start you can either choose to have 40%, 50% or 60% of the screen covered in black dots randomly by pressing the buttons on the right hand side. Or you can use manual input:
- Click the left mouse button to place a start point.
- Left click again to place an end point.
- Right click to place black dots, or hold right mouse button and drag mouse to place black dots.
When you are happy you press "Start algorithm" and the screen will visually show how the algorithm works its way from the start point to the end point. When it is complete it will show the shortest path and how many steps it had to take to get there.