Skip to main content

A* Algorithm

Two python programs using the A* algorithm.


Charlie Harrison
(theratking)

Controls for all programs:

left click - set path

right click - draw and erase walls

s - save the map you've drawn (write a full path if you want it in any other folders but the folder with the main program in it)

l - load a map (write the entire path + name if the file isn't in the folder with the main program)

q - erase the entire map

 

Controls for ASTAR INDEPTH

arrow keys - move the "guy"

space - make the guy go along his path

 

Controls for ASTAR MAZE:

m - toggles on and off whether the guy "knows" about his map. If m is on, your character has a "fog of war" and will try to get to the endpoint of the path even though he doesn't necessarily know how. It's fun watching the really low level AI try to get places.

(note, you can't edit the map in this mode)

 

Astar Indepth: This program takes an indepth look at the algorithm for those interested (I was). Basically whenever the path needs to be updated, you get shown exactly what the program is doing. Feel free to take a look at the source code and see if you can understand it (I used some weird data structures that might not be very user friendly)

 

Astar Maze: this is a more fun approach to the algorithm. Simply clicking will move your "guy" to the point of interest using the fastest possible route.

Links

Home Page
http://www.mediafire.com/?pqn8jyqh6qa0nq7

Releases

Pygame.org account Comments

  • Maarten De Paepe 2011-09-15 13:39:45

    Hi Charlie,

    I was looking for an Astar implementation in python that filled my needs. Yours was best to understand and to implement into the game I am writing. I have tweeked it a little bit so that it is not able to make diagonal moves. (As I am no pathfinding specialist, I don't know if a feature like that was already implemented)

    Unfortunately, the files I downloaded did not contain a license. Hence my question, what is the license for your Astar implementation, and would it be ok for you if I used it in my code? Of course you will be credited.

    Thank you very much, and good job on the code.

    Kind regards