AStar v1.1
A simple python implementation of the A* (a-star) path finding algorithm. The source contains the algorithm and a simple proof-of-concept example using pygame.
The code only implements support for a plain square map but it should be fairly simple to implement support for any map type. If you have any questions regarding this don't hesitate to ask.
AStarExample Instructions
Edit the map by first selecting a tile type. The blocking tiles can not be passed. The walkable tiles has values from 1-4 (also known as move cost) where 1 represents easy terrain (low cost) and 4 is rough terrain (high cost). You can also place the start and ending points.
When you are finished editing press the Find path button and the AStar algorithm will try to find the path with the lowest cost. If any path is found it will be displayed with white lines.
Screenshot
Related links
Downloads
- AStar_v1.1.tar.gz - Current version.
No License
Both the AStar implementation and the example code is public domain.
Comment this project:
yihuang 2010-03-07 04:37:00
why not use heapq module to implement openset.
thanks for sharing this nice little program. I added it to the example set of shed skin, an experimental (restricted) python-to-C++ compiler I've been working on. it becomes about 30 times faster here, but I haven't done precise measurements. please see http://shedskin.googlecode.com, source, for the slightly modified program. thanks again.
This is an interesting demo, and I might try to incorporate it into an RTS I am working on. Only have buildings so far though. Thanks for posting it!
nice, that's a good work
I liked about this algorithm too. It's a nice, useful and not too hard.
Like you and thousands of others, I had to make my own version of it.
I'm quite curious and I like to read how other coders have done the same thing.
Thanks. :)
Here is mine: http://kks.cabal.fi/A-star
