fix sorting

This commit is contained in:
matixezor 2021-04-26 16:56:48 +02:00
parent 4fae45b696
commit 95d77e72b8

View File

@ -31,17 +31,11 @@ def a_star(field: List[List[Tile]], start_x: int, start_y: int, start_direction:
neighbour_node == node_in_queue and neighbour_node.cost < node_in_queue.cost
]):
node_queue[index[0]] = neighbour_node
node_queue = sorted(node_queue, key=itemgetter(0))
node_queue.sort()
return False, False
def heuristic(a: Tuple[int, int], b: Tuple[int, int]):
(x1, y1) = a
(x2, y2) = b
return abs(x1 - x2) + abs(y1 - y2)
def nearest_bomb(a: Tuple[int, int], field: List[List[Tile]]):
min = 20
min_x = 0