Add MORE detail to main
This commit is contained in:
parent
92c545fab1
commit
cdcbee5fdf
13
main.py
13
main.py
|
@ -4,6 +4,7 @@ from emis_funky_funktions import *
|
||||||
|
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from operator import eq
|
from operator import eq
|
||||||
|
from time import perf_counter_ns
|
||||||
|
|
||||||
from a_star import pathfind_multi
|
from a_star import pathfind_multi
|
||||||
from read_in import load_points, load_world_from_paths
|
from read_in import load_points, load_world_from_paths
|
||||||
|
@ -11,18 +12,24 @@ from world import Point, World
|
||||||
from write_out import save_map
|
from write_out import save_map
|
||||||
|
|
||||||
def main(terrain_path: str, elevation_path: str, checkpoints_path: str, image_output: str):
|
def main(terrain_path: str, elevation_path: str, checkpoints_path: str, image_output: str):
|
||||||
|
start_time = perf_counter_ns()
|
||||||
world = unwrap_r(load_world_from_paths(terrain_path, elevation_path))
|
world = unwrap_r(load_world_from_paths(terrain_path, elevation_path))
|
||||||
checkpoints = unwrap_r(load_points(checkpoints_path))
|
checkpoints = unwrap_r(load_points(checkpoints_path))
|
||||||
print('All files loaded, begining search...')
|
print('All files loaded, begining search...', end = ' ')
|
||||||
|
loaded_time = perf_counter_ns()
|
||||||
maybe_path = pathfind_multi(
|
maybe_path = pathfind_multi(
|
||||||
world.neighbors,
|
world.neighbors,
|
||||||
world.heuristic,
|
world.heuristic,
|
||||||
checkpoints
|
checkpoints
|
||||||
)
|
)
|
||||||
|
finish_time = perf_counter_ns()
|
||||||
path, cost = unwrap_opt(maybe_path)
|
path, cost = unwrap_opt(maybe_path)
|
||||||
print(f'Path found!\n\nEstimated time: {cost//60_000_000} minutes')
|
print(f'Path found!\n')
|
||||||
|
print(f'Loading resources completed in {(loaded_time - start_time) // 1_000_000}ms')
|
||||||
|
print(f'Search completed in {(finish_time - loaded_time) // 1_000_000}ms\n')
|
||||||
|
print(f'Estimated travel time: {cost//60_000_000} minutes')
|
||||||
path_length = unwrap_r(world.calculate_path_length(path))
|
path_length = unwrap_r(world.calculate_path_length(path))
|
||||||
print(f'Estimated length: {path_length/1_000_000:.1f} kilometers')
|
print(f'Total path length: {path_length/1_000_000:.1f} kilometers')
|
||||||
save_map(image_output, world, path)
|
save_map(image_output, world, path)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue