Find a Way - Recode
A pathfinding demo demonstrating A*
Sean J McKiernan
This is a simple pathfinding demo that I made investigating A*.
- Mouse left button: add start/goal, draw barriers
- Mouse right button: delete start/goal/barriers
(clicking the text on the screen triggers and toggles functions if you don't want to memorize hotkeys)
- Space: Start
- Enter: Restart
- i: Reset to initial state
- 1,2,3: Switch between Rook, Queen, and Knight movement
- d: Toggle animation on/off
- Esc: Quit
Pygame.org account Comments
Ppaterson 2011-12-03 17:49:04
You might also want to check out networkx. I have been using this in a couple of my games and it is very fast and flexible. You make a graph of your 'board' and then use the shortest path functions to find a path, either weighted or not.
I can share some code if you are interested.
Gamer90030 2013-07-05 20:04:17
AGH WHY IS EVERYTHING A ZIP FILE I CAN'T OPEN ZIP FILES D:
Mekire 2013-07-08 00:20:41
Seriously? It would take you two seconds googling to find a program that can unzip for you, if indeed you really can't do it.
If you REALLY can't unzip a zip under any circumstance then copy the code from the repository. >.>
MentalAtrophy 2014-02-11 06:49:12
Hey, mate, is it cool if I incorporate your solver module into one of my projects and modify the heuristics? I've done some testing with it already and it works really well for real-time pathfinding of multiple entities if I throttle the number of Star.evaluate() calls based on the total number of entities that are actively updating their pathfinding.
Edit: Nevermind, I made my own anyway. I borrowed your idea of separating the search into its own evaluate() method though, because I liked that instead of burying the whole thing in a while loop.
Real name 2017-08-30 13:35:23.353640IDK how to build A* pathfinder (I got 3 versions, and three of them don't works)
ridgen 2018-02-15 16:39:52.221017Nice