2026-rff_mp/pomelovsd/ExitMaze/Strategies/path.py

14 lines
301 B
Python
Raw Normal View History

2026-05-25 10:45:18 +00:00
def restore(parent, start, exit):
2026-05-22 20:34:48 +00:00
if exit not in parent and start != exit:
2026-05-25 13:02:23 +00:00
return []
2026-05-22 20:34:48 +00:00
path = []
2026-05-25 13:02:23 +00:00
current = exit
2026-05-22 20:34:48 +00:00
2026-05-25 13:02:23 +00:00
while current != start:
2026-05-22 20:34:48 +00:00
path.append(current)
current = parent[current]
path.append(start)
path.reverse()
return path