A* Pathfinding Algorithm Demo Applet
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.
To understand what it is doing, refer to the tutorial A* Pathfinding For Beginners and my original article called A* Pathfinding Algorithm.
AStar Demo Applet
If you enjoyed this post, then make sure you subscribe to my RSS feed or subscribe for email updates. Only one email a day and only if there was a new post.
Related Posts
A* Pathfinding Algorithm Version 2 Demo Applet
A* Pathfinding Algorithm
Website Builder
Vegas
Stormtroopers - Photo Of The Day
Category: Computers
Original Post: Tuesday, March 4th, 2008
2 Comments
sn Says:
2009-11-22 01:30:26
nice applet..thnx
Ivan Says:
2011-05-29 22:30:07
Hola, alguien tiene el código del DEMO??? por favor