Skip to content

Commit fb60756

Browse files
Added Doctest Mode
1 parent de19acb commit fb60756

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

searches/astar.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ def astar(
8282
# Goal check: reconstruct the path by following parents backward
8383
if current == goal:
8484
path: list[Node] = []
85-
while current is not None:
86-
path.append(current)
87-
current = parent[current]
85+
cur: Node | None = current
86+
while cur is not None:
87+
path.append(cur)
88+
cur = parent[cur]
8889
return path[::-1] # reverse to (start ... goal)
8990

9091
# Explore current's neighbors

0 commit comments

Comments
 (0)