Skip to main content

AStar

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.


John Eriksson
(wmjoers)
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.

Example 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.

Links

Home Page
http://arainyday.se

Releases

AStar 1.1 — 10 Feb, 2006

AStar 1.0 — 8 Feb, 2006

Pygame.org account Comments

  • Chelo_c 2011-12-02 19:20:29

    Awsome, thanks!

  • Earlo 2013-07-17 14:05:22

    Hmm, is it possible to get this use diagonal movement?

    siraH 2015-03-12 05:36:36

    Yea you'd have to check diagonal nodes. Read about the A* algorithm on wikipedia and look at the pseudo code :)

  • dhari 2014-11-05 03:29:21

    Hi,
    I'm unable to see the source code.. I'm looking for A* path finding since a very long time.. Can you please help me in this regard.