diff --git a/path_search_algorthms/a_star.py b/path_search_algorthms/a_star.py index b2e4601..c3c1efe 100644 --- a/path_search_algorthms/a_star.py +++ b/path_search_algorthms/a_star.py @@ -1,7 +1,7 @@ from data_structures.heap import Heap from path_search_algorthms import a_star_utils as utils -def search_path(start_x: int, start_y: int, agent_rotation: utils.Rotation, target_x: int, target_y: int, array: list[list[int]]) -> list[str]: +def search_path(start_x: int, start_y: int, agent_rotation: utils.Rotation, target_x: int, target_y: int, array): start_node = utils.Node(start_x, start_y, agent_rotation) target_node = utils.Node(target_x, target_y, utils.Rotation.NONE) @@ -84,7 +84,7 @@ def search_path(start_x: int, start_y: int, agent_rotation: utils.Rotation, targ # if(neighbour not in search_list): # search_list.append(neighbour) -def trace_path(end_node: utils.Node) -> list[str]: +def trace_path(end_node: utils.Node): path = [] node = end_node diff --git a/path_search_algorthms/a_star_utils.py b/path_search_algorthms/a_star_utils.py index c0f98ce..20caee1 100644 --- a/path_search_algorthms/a_star_utils.py +++ b/path_search_algorthms/a_star_utils.py @@ -26,7 +26,7 @@ class Node: def f_cost(self): return self.g_cost + self.h_cost -def get_neighbours(node: 'Node', searched_list: list['Node'], array: list[list[int]]) -> list['Node']: +def get_neighbours(node, searched_list, array): neighbours = [] for offset_x in range (-1, 2): for offset_y in range (-1, 2): @@ -45,7 +45,7 @@ def get_neighbours(node: 'Node', searched_list: list['Node'], array: list[list[i # move cost schema: # - move from tile to tile: 10 # - add extra 10 (1 rotation) if it exists -def get_h_cost(start_node: Node, target_node: Node) -> int: +def get_h_cost(start_node: Node, target_node: Node): distance_x = abs(start_node.x - target_node.x) distance_y = abs(start_node.y - target_node.y) cost = (distance_x + distance_y) * 10 @@ -69,7 +69,7 @@ def get_neighbour_cost(start_node: Node, target_node: Node) -> int: return 30 # translate rotation change to move -def get_move(start_node: Node, target_node: Node) -> list[str]: +def get_move(start_node: Node, target_node: Node): rotate_change = get_rotate_change(start_node.rotation, target_node.rotation) if (rotate_change == 0): return ["forward"]