ItsTheRai / a-star-java

Automatically exported from code.google.com/p/a-star-java
0 stars 0 forks source link

Calling calcShortestPath() twice leads to infinite loop #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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