Skip to content

Commit

Permalink
fixed "determine_best_speed" in pathfinder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ctri-The-Third committed Dec 12, 2023
1 parent 0db186a commit 7eac78d
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions straders_sdk/pathfinder/pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,13 @@ def determine_fuel_cost(
def determine_best_speed(
self, source_wp: "Waypoint", target_wp: "Waypoint", fuel_capacity=400
):
speeds = ["CRUISE", "BURN", "DRIFT", "STEALTH"]
best_speed = "DRIFT"
best_time = float("inf")
for speed in speeds:
new_time = self.calc_travel_time_between_wps_with_fuel(
source_wp, target_wp, speed=speed, fuel_capacity=fuel_capacity
)
if new_time < best_time:
best_time = new_time
best_speed = speed
return best_speed
cost = self.determine_fuel_cost(source_wp, target_wp)
if cost * 2 < fuel_capacity:
return "BURN"
elif cost < fuel_capacity:
return "CRUISE"
else:
return "DRIFT"

def load_jump_graph_from_db(self):
graph = Graph()
Expand Down

0 comments on commit 7eac78d

Please sign in to comment.