To view this content, you need to install Java from java.com

Source code: astar4 class drawing

Click on the grid to relocate the target. Press a key with the mouse over the grid to fill in a grid square. The closed list nodes are in yellow with the logical pathway as a thin yellow line. The open list nodes are in green. The number in the top right hand corner of the nodes is the cost moving from that node to the target. The bottom right hand number is the order in which the closed list nodes were created. The code has been slowed down so the process can be viewed.

Edit: Funnily enough this isn't A* properly implemented. It's closer to BFS, but I've got proper A* in my library.

Built with Processing