-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
95 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from enum import Enum | ||
|
||
|
||
class FlightMode(str, Enum): | ||
CRUISE = "CRUISE" | ||
DRIFT = "DRIFT" | ||
BURN = "BURN" | ||
STEALTH = "STEALTH" | ||
|
||
|
||
class NavState(str, Enum): | ||
DOCK = "DOCK" | ||
ORBIT = "ORBIT" | ||
IN_TRANSIT = "IN_TRANSIT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from autotraders.util import parse_time | ||
from autotraders.time import parse_time | ||
|
||
|
||
class Survey: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import sys | ||
from datetime import datetime, timezone | ||
|
||
|
||
def parse_time(time: str) -> datetime: | ||
if sys.version_info.minor >= 11: | ||
return datetime.fromisoformat(time) | ||
else: | ||
try: | ||
d = datetime.strptime(time, "%Y-%m-%dT%H:%M:%S.%fZ") | ||
except ValueError: | ||
try: | ||
d = datetime.strptime(time, "%Y-%m-%dT%H:%M:%SZ") | ||
except ValueError: | ||
d = datetime.fromisoformat(time) | ||
d = d.replace(tzinfo=timezone.utc) | ||
return d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,23 @@ | ||
import sys | ||
from datetime import datetime, timezone | ||
|
||
|
||
def parse_time(time: str) -> datetime: | ||
if sys.version_info.minor >= 11: | ||
return datetime.fromisoformat(time) | ||
else: | ||
try: | ||
d = datetime.strptime(time, "%Y-%m-%dT%H:%M:%S.%fZ") | ||
except ValueError: | ||
try: | ||
d = datetime.strptime(time, "%Y-%m-%dT%H:%M:%SZ") | ||
except ValueError: | ||
d = datetime.fromisoformat(time) | ||
d = d.replace(tzinfo=timezone.utc) | ||
return d | ||
from autotraders.ship.states import FlightMode | ||
|
||
|
||
def travel_fuel(distance, mode): | ||
if mode == "CRUISE": | ||
if mode == FlightMode.CRUISE: | ||
return distance | ||
elif mode == "DRIFT": | ||
elif mode == FlightMode.DRIFT: | ||
return 1 | ||
elif mode == "BURN": | ||
elif mode == FlightMode.BURN: | ||
return 2 * distance | ||
elif mode == "STEALTH": | ||
elif mode == FlightMode.STEALTH: | ||
return distance | ||
|
||
|
||
def travel_time(distance, ship_speed, mode): | ||
if mode == "CRUISE": | ||
if mode == FlightMode.CRUISE: | ||
return 15 + 10 * distance / ship_speed | ||
elif mode == "DRIFT": | ||
elif mode == FlightMode.DRIFT: | ||
return 15 + 100 * distance / ship_speed | ||
elif mode == "BURN": | ||
elif mode == FlightMode.BURN: | ||
return 15 + 5 * distance / ship_speed | ||
elif mode == "STEALTH": | ||
elif mode == FlightMode.STEALTH: | ||
return 15 + 20 * distance / ship_speed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters