docs(nav): add docstrings
This commit is contained in:
parent
ed677a320b
commit
41e657b6aa
1 changed files with 3 additions and 0 deletions
3
nav.py
3
nav.py
|
|
@ -35,16 +35,19 @@ LAUNCH_FUEL = 380.0 # tonnes of fuel to escape Earth's gravity
|
||||||
|
|
||||||
|
|
||||||
def distance(a, b):
|
def distance(a, b):
|
||||||
|
"""Return the distance between two neighboring waypoints."""
|
||||||
if (a, b) in DISTANCES:
|
if (a, b) in DISTANCES:
|
||||||
return DISTANCES[(a, b)]
|
return DISTANCES[(a, b)]
|
||||||
return DISTANCES[(b, a)]
|
return DISTANCES[(b, a)]
|
||||||
|
|
||||||
|
|
||||||
def legs(route):
|
def legs(route):
|
||||||
|
"""Return the legs (pairs of consecutive waypoints) of a route."""
|
||||||
return [(route[i], route[i + 1]) for i in range(len(route) - 1)]
|
return [(route[i], route[i + 1]) for i in range(len(route) - 1)]
|
||||||
|
|
||||||
|
|
||||||
def plan(destination):
|
def plan(destination):
|
||||||
|
"""Return route, distance, travel time (days) and fuel (t)."""
|
||||||
route = ROUTES[destination]
|
route = ROUTES[destination]
|
||||||
total = 0.0
|
total = 0.0
|
||||||
fuel = 0.0
|
fuel = 0.0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue