#!/usr/bin/env python3 """Jump-distance route between two planets/systems, from FIO's system graph (not PRUNplanner, which doesn't model travel). Straight-line ly is the Dijkstra weight (scales with FTL fuel/time); jump count shown alongside. tools/route.py ZV-759c ZV-194a # Deimos -> Nike tools/route.py Deimos "Ironforge" # names also work """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from puga import route def main(): if len(sys.argv) != 3: sys.exit("usage: tools/route.py ") a, b = sys.argv[1], sys.argv[2] src = route.resolve_system(a) dst = route.resolve_system(b) if src == dst: print(f"{a} and {b} are in the same system - 0 jumps") return r = route.shortest_path(src, dst) if r is None: print(f"no connected route found between {a} and {b}") return print(f"{a} -> {b}: {r['jumps']} jumps, {r['distance_ly']:.1f} ly (straight-line sum along the jump path)") print("path: " + " -> ".join(r["path"])) if __name__ == "__main__": main()