Report as inappropriate.
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 :)
Want to leave a comment? You must first log in.