pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
A* Algorithm

A* Algorithm

Charlie Harrison (theratking)

Tags:

Description

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

Screenshot


click to view original size

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

September 20, 2011 10:50pm - Charlie Harrison - nickname: (theratking)
Feel free to use any part of the code as long as I'm credited. Thank you for your kind words!
January 25, 2011 11:58pm - Charlie Harrison - nickname: (theratking)
the Astar Maze program also uses a custom made binary heap module if you feel like checking it out (I'm new to data structures so it might be crude). There is a heap module standard in python now, but I kinda wanted to try my hand at making one myself.
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Jul 28, 2014

Jul 22, 2014

Jul 21, 2014

Jul 20, 2014

Jul 19, 2014

Jul 15, 2014

Jul 10, 2014

Jul 9, 2014

Jun 27, 2014



Jun 24, 2014

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