This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

theguywholikeslinux
theguywholikeslinux presents ...

2011/11/27

A* Waypoint Pathfining

This is essencially tje same as my previous A* pathfinder (http://www.greenfoot.org/scenarios/3459) only this time it is using waypoints. This is because in a real world example I couldn't have every single pixel as a node, so instead I have a few waypoints that can represent large chunks of passable or un-passable areas with much fewer nodes.

Source is available under a GPL 3.0 licence or later.

The numbers in the middle of the lines represent the cost to travel between two nodes. The arrows represent which directions you can travel. In this example you can travel both ways so there are two arrows on each line.
Once you start the search each node that is explored turns yellow and all the new unexplored nodes (open nodes) that have been found have a yellow line and a respectively coloured arrow pointing to them. Any red arrows occour when a node is explored and there is a node you can travel to from it that has already been found. Once the pathfinder has found the path the whole route turns green.

================HOW TO PLAY=================
To place the Start (green) node press "s" and then click where you would like it to be.
To place the Finish (red) node press "f" and then click where you would like it to be.
PRESS THE [SPACE] BAR TO START THE SEARCH :)

6322 views / 20 in the last 7 days

1 vote | 0 in the last 7 days

Tags: mouse simulation demo with-source algorithm a* pathfinding prototype

open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on Sun Nov 27 21:18:09 UTC 2011 Misc
RFC

Want to leave a comment? You must first log in.

Who likes this?

bourne