Skip to content

Commit 857cfb4

Browse files
committed
Corrected bug caused by improper swap testing
1 parent 1c6a44d commit 857cfb4

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)