Simple grid-based pathfinding! Algorithm is implemented using C++17 but graphics is made with help of SFML in 2.5.1 version. A* is useful when we need to get a path of an entity to the goal point. Such a situation usually happens in games.
Every type of tile is represented by specified color:
By clicking on the grid with LPM, the user can set targeted ( ) and starting node (
) alternately. If both are set, the user can press "SOLVE" button. After that, the program computes the path which can be seen as cyan tiles (
). In the top left corner, there's an informational window which displays time which was required to perform the calculation.
By pressing the grid with PPM, the user sets the obstacles ( ) for the path.
User can reset obstacles by pressing "RESET OBSTACLES" button.
And reset the path by pressing "RESET" button.
In the bottom right corner there's a switch button which can change between "DIAG ON" and "DIAG OFF" which means diagonal search on the grid.
AStar Algorithm Explanation Part 1
AStar Wikipedia page
A Star (A*) Path Finding C++