pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing

A* algorithm - 1.0.2

Michael Vandborg (cepheus)

Tags:

Description

This is a demonstration of the A* algorithm. I've written it in a way that is hopefully easy to understand.

Changes

Optimizations by Fredrik Corneliusson.

Links

Home Page: http://vandb.org/
Source: http://vandb.org/files/astar-1.0.2.zip

Screenshot


click to view original size

Releases

A* algorithm - 1.0.2 - Dec 10, 2009
A* algorithm - 1.0.1 - Oct 6, 2009
A* algorithm - 1.0.0 - Oct 1, 2009

Comments

If you wish to leave a comment, please sign in first.

June 20, 2010 6:47am - Mayec Rancel - nickname: (mayec)
I noticed that it lacks the option to avoid diagonal movement when moving around corners. It's easy to add, by adding some if statements inside inspect_adjacent(), to skip inspecting certain diagonals if an adjacent non-diagonal node is impassable.
December 10, 2009 3:52am - Michael Vandborg - nickname: (cepheus)
Hi Fredrik, I'm glad you liked it. I took a look at your optimization and they're great. Your optimization of the code is about as easy to understand as the original code with the added benefit of a major speedup, so I've merged the changes - thanks for your contribution :)
November 7, 2009 2:45pm - Fredrik Corneliusson - nickname: (tomten) - 4/5
Great!
I needed this for a game I'm tinkering with and this was one of the cleanest A-Star implementations I found.

However to try and make it a bit more realistic performence wise for my maps I optimize it a bit (but I do not think it hurt readability too much).

With my test map I managed to get a X10 speedup (and a less memory usage by using __slots__ for the node object).

I added my version here:
http://turb-game.googlecode.com/files/astar-1.0.1_fc.zip

Feel free to merger the changes if you feel it's appropriate.

Warning: I cannot guarantee I've not broken the algorithm but at least I managed to reproduce the screen shoot.
October 5, 2009 7:37am - Michael Vandborg - nickname: (cepheus)
Aye, it should. I think I'll fix it in the next update.
October 1, 2009 11:45am - Carsten Eggers - nickname: (masterlee)
When pressing enter old values should be removed
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Sep 1, 2010


Aug 29, 2010



Aug 28, 2010

Aug 26, 2010

Aug 25, 2010

Aug 24, 2010

Aug 21, 2010

Aug 19, 2010

Aug 18, 2010

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)