Retrace the path from parents to parents until start node
(self, node: Node | None)
| 166 | ] |
| 167 | |
| 168 | def retrace_path(self, node: Node | None) -> Path: |
| 169 | """ |
| 170 | Retrace the path from parents to parents until start node |
| 171 | """ |
| 172 | current_node = node |
| 173 | path = [] |
| 174 | while current_node is not None: |
| 175 | path.append((current_node.pos_y, current_node.pos_x)) |
| 176 | current_node = current_node.parent |
| 177 | path.reverse() |
| 178 | return path |
| 179 | |
| 180 | |
| 181 | if __name__ == "__main__": |