This project is a simple user interface for visualizing pathfinding algorithms. Currently, it only implements the Breadth-First Search (BFS) algorithm. The application allows users to interactively set start and end points, draw walls, and clear the grid. The BFS algorithm then finds the shortest path from the start point to the end point, navigating around the walls. The project uses the SFML multimedia library for the graphical interface, PLOG for logging, and a game engine based on a YouTube tutorial.
-
Starting the Application: After installing the application, open it. You should see a grid displayed on the screen.
-
Drawing Walls: To draw walls, hold down the left shift key and click with the left mouse button on the cells where you want the walls to be. These cells will change color to indicate that they are walls.
-
Setting the Start Point: To set the start point, simply click on a cell in the grid with the left mouse button. The selected cell will change color to indicate that it is the start point.
-
Setting the End Point: To set the end point, click on a different cell with the right mouse button. This cell will also change color to indicate that it is the end point.
-
Running the Pathfinding Algorithm: After setting the start point, end point the algorithm will find the shortest path from the start point to the end point, navigating around the walls. The path will be displayed on the grid.
-
Clearing the Grid: To clear the grid and start over, press the 'C' key. This will remove the start point, end point, walls, and path, returning the grid to its initial state.
Remember, the application uses the Breadth-First Search (BFS) algorithm for pathfinding. This algorithm guarantees to find the shortest path, but it may not be the fastest algorithm if the grid is large.
| Key | Function |
|---|---|
| LShift + Left Mouse | Draw a wall |
| Left Mouse | set start point |
| Right Mouse | Set endpoint |
| C | Clear the Grid |
Make shure sfml and dependencies are installed
sudo apt install libsfml-dev
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libx11-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libglew1.5-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libsndfile1-dev
sudo apt-get install libopenal-devEnter the project root with terminal
cmake . .
cmake --build . --config ReleaseThe prebuild was compiled for linux (ubuntu) amd64.
- SFML: https://github.com/SFML/SFML
- Multimedia Libary
- PLOG: https://github.com/SergiusTheBest/plog
- Logging Libary
- SFML Game Engine (src/engine) based on https://www.youtube.com/watch?v=tgXEws1Ef8s&list=PLorQc--wocbdLeis03PUbSuzceAUFH4YY
