views:

2291

answers:

5

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!

+1  A: 

Here's a C# implementation done by one of the people who build the language.

Joel Coehoorn
+1  A: 

A VB6 implementation.

http://herbert.gandraxa.com/herbert/pfa.asp

This is particularly useful because you can step through the process and get a good understanding of how the algorithm works. This can be quite valuable when converting the algorithm to another language.

G Mastros
+1  A: 

Here's a C++ implementation. It's fairly well tested by now, and used in commercial video games and various AI projects.

http://code.google.com/p/a-star-algorithm-implementation/

And there's a tutorial, which I actually wrote first:

http://www.geocities.com/jheyesjones/astar

justinhj
+2  A: 

Here is a JavaScript implementation 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.

Edit: I have Updated the implementation. There is also an online demo

Brian Grinstead
A: 

An AS 3 example... http://www.dauntless.be/astar/

Chris