Pathfinding Visualizer A*


What is this A* algorithm ?

Simply put, it is an algorithm that aims to find the shortest possible path between two locations. __

Why A* Search Algorithm?

Informally speaking, A* Search algorithms, unlike other traversal techniques, it has “brains”. What it means is that it is really a smart algorithm which separates it from the other conventional algorithms. And it is also worth mentioning that many games and web-based maps use this algorithm to find the shortest path very efficiently (approximation).


Setup

Just open the execubles everthing is precompiled so everything should work wihout a problem :))

Utilization


  1. First you need to designate your start and end point. Your first two left clicks will asign your start and respective your end point
  2. If you wana put an obstacle you just need to press your right click on the coresponding square. You can also hold your click to place multiples obstacles.
  3. If you want to change any point on the map just press right click instead of left and the coresponding point will be deleted.
  4. After you set up your path you can press SPACE to start the simulation. 5, If you wanna reset the entire program don’t worry you don’t need to close it just press C on your keboard
  5. Have fun when learning how A* works ?

Examples

Simple example Complex example

Explication

Explanation Consider a square grid having many obstacles and we are given a starting cell and a target cell. We want to reach the target cell (if possible) from the starting cell as quickly as possible. Here A* Search Algorithm comes to the rescue. What A* Search Algorithm does is that at each step it picks the node according to a value-‘f’ which is a parameter equal to the sum of two other parameters – ‘g’ and ‘h’. At each step it picks the node/cell having the lowest ‘f’, and process that node/cell. We define ‘g’ and ‘h’ as simply as possible below g = the movement cost to move from the starting point to a given square on the grid, following the path generated to get there. h = the estimated movement cost to move from that given square on the grid to the final destination. This is often referred to as the heuristic, which is nothing but a kind of smart guess. We really don’t know the actual distance until we find the path, because all sorts of things can be in the way (walls, water, etc.). There can be many ways to calculate this ‘Simpleh’ which are discussed in the later sections.

GitHub

View Github