Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jkeresman01/pathfinding-visualizer
Visualization tool for path finding algorithms(BFS, DFS, Dijkstra, A*)
https://github.com/jkeresman01/pathfinding-visualizer
Last synced: about 1 month ago
JSON representation
Visualization tool for path finding algorithms(BFS, DFS, Dijkstra, A*)
- Host: GitHub
- URL: https://github.com/jkeresman01/pathfinding-visualizer
- Owner: jkeresman01
- Created: 2024-05-28T16:30:29.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-28T19:34:01.000Z (7 months ago)
- Last Synced: 2024-05-29T08:13:52.590Z (7 months ago)
- Language: C++
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pathfinding Visualizer #
This tool is designed to visualize various pathfinding algorithms including BFS, DFS, and Dijkstra's algorithm.
It's built using the SFML library. You can learn more about SFML here: [SFML Documentation](https://www.sfml-dev.org/documentation/2.6.1/).
Upon starting the application, you'll be presented with a menu where you can choose between the following modes:
- Maze Solving
- Wall Building## Available Options ##
| Key Combination | Description |
|----------------------------|--------------------------------------------------|
| `` | Reset the grid |
| `` | Start Depth First Search algorithm |
| `` | Start Breadth First Search algorithm |
| `` | Start Dijkstra's algorithm |
| `Space + Left Mouse Click` | Position the start node |
| `Space + Right Mouse Click`| Position the end node |
| `Enter + Left Mouse Click` | Put walls around the grid |
| `ESC` | Return to the start menu |## Maze Solving ##
A maze is a puzzle that involves navigating through a network of paths to find a route from start to finish. There are numerous algorithms for generating mazes based on graph theory, such as Randomized DFS, Iterative Randomized Kruskal's Algorithm, and Iterative Randomized Prim's Algorithm.For this tool, a variation of Randomized DFS (Recursive Backtracking) is used. Once your maze is generated, you can start testing out the pathfinding algorithms.
![maze](https://github.com/jkeresman01/Pathfinding-visualizer/assets/165517653/e251d24c-4272-4bcb-b9e9-289fa0650ac9)
## Wall Building ##
In this mode, you can build walls and observe how different algorithms navigate around them to find the shortest path.![cpp](https://github.com/jkeresman01/Pathfinding-visualizer/assets/165517653/95befe9d-0665-430b-baf5-eae45ccf43cb)
### Example with No Walls ###
![bfs](https://github.com/jkeresman01/Pathfinding-visualizer/assets/165517653/607efa2a-ca2d-4521-9142-38d5c21ca8cf)### Example with Random Walls ###
![wall](https://github.com/jkeresman01/Pathfinding-visualizer/assets/165517653/3859c0ab-3664-4077-bc69-f9b7bd8adbb6)## Starting the application ##
If the version of SFML that you want to install is available in the official repository, then install it using your package manager.
For example, on Debian, Ubuntu you would do:
```
sudo apt-get install libsfml-dev
```Now you will need to compile the program:
```
g++ -c *cpp
```In case you installed SFML to a non-standard path, you'll need to tell the compiler where to find the SFML headers:
```
g++ -std=c++17 -c *cpp -I/include
```You must then link the compiled file to the SFML libraries in order to get the final executable.
```
g++ *.o -o find-path -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
```
You can now execute the compiled program:
```
./find-path
```### Build and run the game with CMake ###
Install SFML using your package manager, for example, on Debian, Ubuntu you would do:
``` shell
sudo apt-get install libsfml-dev
```Clone the repository
``` shell
git clone https://github.com/jkeresman01/Pathfinding-visualizer
```Build and Run the game:
``` shell
cd Pathfinding-visualizer
mkdir build && cd build
cmake ..
make
./find-path
```
## Useful Resources ##| Resource | Link |
|-----------------------------|-------------------------------------------------------------------------------------------|
| Maze Generation Algorithms | [Wikipedia: Maze Generation Algorithm](https://en.wikipedia.org/wiki/Maze_generation_algorithm) |
| Dijkstra's Algorithm | [Wikipedia: Dijkstra's Algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) |