How do I implement an A* pathfinding algorithm, with movement costs for every programming language?

IQpierce picture IQpierce · Sep 17, 2008 · Viewed 35.9k times · Source

Can we get people to post code of simple, optimized implementations of the A* pathfinding algorithm, in every single language?

This is mostly for fun and to play with what stackoverflow itself is capable of... although I actually am interested in getting an ActionScript 3 version of this.

But the idea is that this "Question" will continue to be updated eternally into the future, even as different programming languages are created!

I don't know of any other place online where you can see pseudocode "translated" into many (much less every) different language. Seems like it's a worthwhile resource, and while not necessarily what this site was designed for, there's no harm in trying it out and seeing if it turns out to be a worthwhile thing that stackoverflow could be used for!

Answer

Brian Grinstead picture Brian Grinstead · Jun 3, 2009

Here is a JavaScript implementation, along with source code and an online demo I did as a hobby/research project.

It is very simple, but you can change some of the params (grid size, # of walls, debugging info on/off). It will show you the calculated f(x), g(x), and h(x) values for each node that is inspected.

The demo page implementation uses jQuery.