56011223035Ban / a-star-java

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

Else if conditon in calcShortestPath always fails #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
As "map.getDistanceBetween(current, neighbor)" gives a distance which is always 
positive,  
"neighborDistanceFromStart" is always greater than 
"current.getDistanceFromStart()"..

Thus
"else if(neighborDistanceFromStart < current.getDistanceFromStart()) 
{neighborIsBetter = true;}"
is never satisfied.

Possible solution:
Change Else if condition to 
"else if(neighborDistanceFromStart < neighbor.getDistanceFromStart()) 
{neighborIsBetter = true;}"

Original issue reported on code.google.com by itsprajw...@gmail.com on 13 Sep 2013 at 11:49