I created my first version of an A* Pathfinding Demo. It is an applet further down this page, so you will need Java installed. Basically, you can draw a map by setting a start point, end point, and drawings walls. Then press Start to watch the algorithm think its way through.
Keep in mind, you are still allowed to have multiple starting or end points, but it will only lose the highest grid number of each when the algorithm starts. It costs 10 units to move left, right, up, or down and it costs 14 to move on the diagonal.
If you pause AStar, any map changes at that time will also do nothing to change how the algorithm will finish.
Here are a few instructions:
- To set a wall, click on a square once. It will turn red.
- To set a start point, click on a square twice. It will turn to a wall on the first click, but the next sets it to a blue start point.
- To set an end point, click on a square three times. Just like above, it will turn to a purple end point.
- To clear a grid square to just be walkable, click on it until it turns white again.
- Just click Start when you are ready to go. It will work its way through, color coding each block to show its status and if it belongs to the open or closed lists in the algorithm. You can pause at any time. At the end, it will trace in pink, the path it wants to take.
- You can adjust the speed as to how fast it runs by inputting a new number when AStar is stopped.