Skip to content

Commit

Permalink
fix: wrong logic
Browse files Browse the repository at this point in the history
  • Loading branch information
auspham committed Jan 3, 2024
1 parent 9e7c3e3 commit da05013
Show file tree
Hide file tree
Showing 5 changed files with 7,692 additions and 6,319 deletions.
2 changes: 1 addition & 1 deletion dist/byakugan.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
closeSet.push(remove);
for (var i = 0; i < current.neighbours.length; i++) {
var neighbour = current.neighbours[i];
if (neighbour.isObstacle() || !closeSet.includes(neighbour)) {
if (!neighbour.isObstacle() && !closeSet.includes(neighbour)) {
var tempG = current.g + this.distance(current, neighbour);
if (!openSet.includes(neighbour) || tempG < neighbour.g) {
neighbour.updateScore(tempG, this.distance(neighbour, end));
Expand Down
Loading

0 comments on commit da05013

Please sign in to comment.