lua-astar icon indicating copy to clipboard operation
lua-astar copied to clipboard

getBestOpenNode() is O(n)

Open GloryFish opened this issue 13 years ago • 1 comments

Replace the linear table lookup in getBestOpenNode with a MinHeap pop.

Need to implement a min heap. Replace astar.on with the heap. Check to see if astar.o needs to be replaced.

GloryFish avatar Jan 13 '11 17:01 GloryFish

Here's a python implementation using an array for the underlying data https://github.com/berkona/pymazegen/blob/master/priority_queue.py

You'd have to implement your own geometric expansion for arrays (python uses an oldSize * 9/8 + 1 algorithm), but overall it should be compatible with lua

berkona avatar Jan 23 '13 17:01 berkona