[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] A* pathfinding demo
On Mon, 2005-12-05 at 08:49 +0100, Luzi Thoeny wrote:
> i made a very small, simple demo showing pathfinding with the A* algorithm.
The math.sqrt(dx*dx+dy*dy) for heuristic distance calculation is not
necessary. You could just use dx+dy, especially when you do not allow to
walk on diagonals.
See other tricks how to speed up the A* at Amit's pages:
http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
For my fast A* code, see function shortPath() in
http://ivo.danihelka.net/python/download/robohunt-0.1/src/space.py
It is based on Phil's astar() code, thanks.
--
Ivo Danihelka