29 lines
985 B
Python
Executable file
29 lines
985 B
Python
Executable file
#!.venv/bin/python
|
|
# I am but a silly little NixOS user who cannot use normal shebangs
|
|
from emis_funky_funktions import *
|
|
|
|
from sys import argv
|
|
from operator import eq
|
|
|
|
from a_star import pathfind_multi
|
|
from read_in import load_points, load_world_from_paths
|
|
from world import Point, World
|
|
from write_out import save_map
|
|
|
|
def main(terrain_path: str, elevation_path: str, checkpoints_path: str, image_output: str):
|
|
world = unwrap_r(load_world_from_paths(terrain_path, elevation_path))
|
|
checkpoints = unwrap_r(load_points(checkpoints_path))
|
|
print('All files loaded, begining search...')
|
|
maybe_path = pathfind_multi(
|
|
world.neighbors,
|
|
world.heuristic,
|
|
checkpoints
|
|
)
|
|
path, cost = unwrap_opt(maybe_path)
|
|
print(f'Path found!\n\nEstimated time: {cost//60_000_000} minutes')
|
|
path_length = unwrap_r(world.calculate_path_length(path))
|
|
print(f'Estimated length: {path_length/1_000_000:.1f} kilometers')
|
|
save_map(image_output, world, path)
|
|
|
|
if __name__ == '__main__':
|
|
main(*argv[1:]) |