2026-rff_mp/pomelovsd/ExitMaze/Strategies/path.py
2026-05-25 16:02:23 +03:00

14 lines
301 B
Python

def restore(parent, start, exit):
if exit not in parent and start != exit:
return []
path = []
current = exit
while current != start:
path.append(current)
current = parent[current]
path.append(start)
path.reverse()
return path