1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

fix pathfinder A* using slightly suboptimal paths sometimes

This commit is contained in:
mat 2024-02-23 20:48:26 -06:00
parent ad33d06e5f
commit 28de14f984

View file

@ -78,7 +78,7 @@ where
.get(&neighbor.movement.target) .get(&neighbor.movement.target)
.map(|n| n.g_score) .map(|n| n.g_score)
.unwrap_or(f32::INFINITY); .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 heuristic = heuristic(neighbor.movement.target);
let f_score = tentative_g_score + heuristic; let f_score = tentative_g_score + heuristic;
nodes.insert( nodes.insert(