From 857cfb4c7735e34f8cd1512369d5b1d3c6697418 Mon Sep 17 00:00:00 2001 From: Robert Hafner Date: Sat, 13 Feb 2016 16:03:58 -0800 Subject: [PATCH] Corrected bug caused by improper swap testing --- astar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astar.js b/astar.js index b6969ef..bb57b1d 100644 --- a/astar.js +++ b/astar.js @@ -388,7 +388,7 @@ BinaryHeap.prototype = { // Do the same checks for the other child. if (child2N < length) { child2 = content[child2N]; - if ( scoreFunction(child2) < (swap >= 0 ? elemScore : child1Score)) { + if ( scoreFunction(child2) < (swap < 0 ? elemScore : child1Score)) { swap = child2N; } }