kjsahakian/a-star-java

Calling calcShortestPath() twice leads to infinite loop

Opened this issue · 1 comments

What steps will reproduce the problem?

aStarMap = new AreaMap(mapWidth, mapHeight, obstacleMap);
aStarHeuristic = new ClosestHeuristic(this);
aStarSearch = new AStar(aStarMap, aStarHeuristic);
...
aStarSearch.calcShortestPath(...)
aStarSearch.calcShortestPath(...)


What is the expected output? What do you see instead?

At the second call to aStarSearch.calcShortestPath(...) the method 
AStar.reconstructPath() hangs in an infinite loop.


Please provide any additional information below.

I could easily solve this problem by adding the following as first line to 
AStar.reconstructPath():

map.clear();

Original issue reported on code.google.com by hai...@gmail.com on 2 Feb 2013 at 11:52

well that, and add a break/return statement to the condition that checks if 
current node is the same as goal node, which restricts diagonal movements. I 
was in the same situation and when I debugged it...the openList size was not 
reducing rather increasing......

Original comment by freelanc...@gmail.com on 6 Mar 2014 at 12:37