def aStar(self, graph, current, end):
    openList = set()
closedList = set()

def retracePath(c):

    def parentgen(c):
        while c:
            yield c
c = c.parent
result = [element for element in parentgen(c)]
result.reverse()
return result
openList.add(current)
while openList:
    current = sorted(openList, key=lambda inst: inst.H)[0]
if current == end:
    return retracePath(current)
openList.remove(current)
closedList.add(current)
for tile in graph[current]:
    if tile not in closedList:
        tile.H = (abs(end.x - tile.x) + abs(end.y - tile.y)) * 10
openList.add(tile)
tile.parent = current
return []
Python — ускорьте алгоритм поиска пути звезды