Skip to content

Commit

Permalink
fix pathfinder A* using slightly suboptimal paths sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Feb 24, 2024
1 parent ad33d06 commit 28de14f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion azalea/src/pathfinder/astar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ where
.get(&neighbor.movement.target)
.map(|n| n.g_score)
.unwrap_or(f32::INFINITY);
if tentative_g_score - neighbor_g_score < MIN_IMPROVEMENT {
if neighbor_g_score - tentative_g_score > MIN_IMPROVEMENT {
let heuristic = heuristic(neighbor.movement.target);
let f_score = tentative_g_score + heuristic;
nodes.insert(
Expand Down

0 comments on commit 28de14f

Please sign in to comment.