pygame is
Simple DirectMedia Layer is
Site Swing
A* algorithm

A* algorithm

Cepheus (cepheus)





Home Page:


click to view original size account Comments

If you wish to leave a comment with your account, 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 - Cepheus - 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
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:

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 - Cepheus - 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

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

Sep 11, 2015

Sep 6, 2015

Aug 26, 2015

Aug 25, 2015

Aug 21, 2015

Aug 16, 2015

Jul 30, 2015

Jun 24, 2015

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