PRUNplanner doesn't model travel, so nothing in the project could answer "how far is planet X" until now. Builds a graph from /systemstars (698 systems, real jump connections + 3D coordinates) and runs Dijkstra weighted by straight-line ly (what FTL fuel/time actually scale with), reporting jump count alongside. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
#!/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 <from planet/system> <to planet/system>")
|
|
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()
|