A C++ implementation of the A* pathfinding algorithm, visualized using SDL2.
This project implements a visual simulation of the A* pathfinding algorithm over a circular 2D grid, rendered in real time using SDL2. The system represents a circular path using discrete Cartesian coordinates, enabling the A* algorithm to operate as it would on a standard 2D grid while maintaining the curvature of the path. This approach facilitates extending the algorithm to handle full circuits with arbitrary shapes, since the underlying computations are not tied to a specific coordinate system.
- Fully configurable parameters via
config.h - Resizeable window
| Key | Action |
|---|---|
Esc |
Quit the simulation |
Pathfinder
│
├── src/
│ ├── config.h
│ ├── main.cpp
│ ├── app/
│ │ ├── app.h / app.cpp
│ │ ├── input.h / input.cpp
│ │ └── window.h / window.cpp
│ ├── simulation/
│ │ └── a_star.h / a_star.cpp
│ └── renderer/
│ └── renderer.h / renderer.cpp
├── assets/
│ └── icon/
│ └── icon.bmp
├── externals/
│ └── SDL2-2.32.10/
├── CMakeLists.txt
├── LICENCE
└── README.md
📝 Notes:
- SDL2 is automatically setupped.
-
Open cmd
-
Clone this repository:
git clone https://github.com/LucaFeggi/Pathfinder
-
Enter the project root:
cd Pathfinder -
Generate project files:
cmake -B build -G "Visual Studio 17 2022" -
Build the project:
cmake --build build --config Release
-
Run the executable:
build\Release\Pathfinder.exe
📝 Notes:
- SDL2 must be installed on the system, if not already present.
- Make sure you’re running under the X11 display server (not Wayland), as SDL2 currently requires it.
- Open cmd
- Download SDL2 (optional):
sudo apt install libsdl2-dev
- Clone this repository:
git clone https://github.com/LucaFeggi/Pathfinder
- Enter the project root:
cd Pathfinder - Generate build files:
cmake -B build
- Compile the project:
cmake --build build --config Release
- Run the executable:
./build/Pathfinder
The idea for this pathfinding implementation was inspired by an algorithmic challenge received as part of the Race Up assignment from Università degli Studi di Padova.
A snapshot of the visualization after running the A* algorithm on the circular grid (