bgrins / javascript-astar

A* Search / Pathfinding Algorithm in Javascript
https://briangrinstead.com/blog/astar-search-algorithm-in-javascript-updated/
MIT License
1.35k stars 324 forks source link

Can't find a path after a few search #44

Open wallpap3r opened 9 years ago

wallpap3r commented 9 years ago

currentNode.closed = true and didn't make it dirty so that when a new search begins, the function Graph.cleanDirty() may not reset the closed node, and finally it will result in no valid path

do a search and choose a nearby node for new target can easily reproduce it.

I added graph.makeDirty(currentNode) to fix it, but I didn't test it for a full round

wibimaster commented 9 years ago

+1

bibodha commented 9 years ago

+1

manthrax commented 8 years ago

I figured out that bug I think. The "closed" nodes aren't getting cleaned properly between searches. Look here for a fix:

https://github.com/bgrins/javascript-astar/issues/52