Skip to content

Commit d17036e

Browse files
committed
Merge pull request #1 from tedivm/patch-1
Corrected bug caused by improper swap testing
2 parents 1c6a44d + 857cfb4 commit d17036e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

astar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ BinaryHeap.prototype = {
388388
// Do the same checks for the other child.
389389
if (child2N < length) {
390390
child2 = content[child2N];
391-
if ( scoreFunction(child2) < (swap >= 0 ? elemScore : child1Score)) {
391+
if ( scoreFunction(child2) < (swap < 0 ? elemScore : child1Score)) {
392392
swap = child2N;
393393
}
394394
}

0 commit comments

Comments
 (0)