https://github.com/tigeryant/a-star-pathfinding-algorithm
A star pathfinding algorithm
https://github.com/tigeryant/a-star-pathfinding-algorithm
a-star-algorithm pathfinding-algorithm pygame
Last synced: about 2 months ago
JSON representation
A star pathfinding algorithm
- Host: GitHub
- URL: https://github.com/tigeryant/a-star-pathfinding-algorithm
- Owner: tigeryant
- Created: 2021-10-13T19:03:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-30T01:30:27.000Z (about 3 years ago)
- Last Synced: 2025-01-07T21:11:33.194Z (3 months ago)
- Topics: a-star-algorithm, pathfinding-algorithm, pygame
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A-star-pathfinding-algorithm
## Introduction
This is an implementation of the A star pathfinding algorithm using Python. This project was inspired by both the YouTube channel 'Tech with Tim' and a medium article by Nicolas Swift on the topic.## Operation
The program draws a grid of 'nodes' (squares) on the window, with a barrier around the edge of the grid. The user can then click the left mouse button to choose a 'start' node, and then click it again to choose an 'end' node. Further clicks will create 'barriers' (non-traversable nodes). When the spacebar is pressed, the algorithm will run, showing the pathfinding process in real time. Nodes change colour to indicate membership of the 'open' or 'closed' set. If the end node is found, the path back to the start is traced. If no path is found "Failed to find path" is printed to the console. The following screenshots show the program in action.
![]()
![]()
![]()
## Heuristic
In this implementation, diagonal movement is not allowed. The heuristic used for calculating the distance between two nodes is Manhattan distance, as opposed to Euclidian distance.