@@ -153,8 +153,8 @@ def trace_path(cell_details: List[List[Cell]], dest: Tuple[int, int]) -> None:
153
153
>>> cell_details[1][1].parent_i = 0
154
154
>>> cell_details[1][1].parent_j = 0
155
155
>>> trace_path(cell_details, (1, 1))
156
- The Path is
157
- -> (0, 0) -> (1, 1)
156
+ The Path is
157
+ -> (0, 0) -> (1, 1)
158
158
"""
159
159
print ("The Path is " )
160
160
path = []
@@ -186,7 +186,9 @@ def trace_path(cell_details: List[List[Cell]], dest: Tuple[int, int]) -> None:
186
186
# Implement the A* search algorithm
187
187
188
188
189
- def a_star_search (grid : List [List [int ]], src : Tuple [int , int ], dest : Tuple [int , int ]) -> None :
189
+ def a_star_search (
190
+ grid : List [List [int ]], src : Tuple [int , int ], dest : Tuple [int , int ]
191
+ ) -> None :
190
192
"""
191
193
Perform the A* search to find the shortest path from source to destination.
192
194
@@ -206,8 +208,8 @@ def a_star_search(grid: List[List[int]], src: Tuple[int, int], dest: Tuple[int,
206
208
... ]
207
209
>>> a_star_search(grid, (0, 0), (2, 2))
208
210
The destination cell is found
209
- The Path is
210
- -> (0, 0) -> (1, 1) -> (2, 2)
211
+ The Path is
212
+ -> (0, 0) -> (1, 1) -> (2, 2)
211
213
>>> a_star_search(grid, (0, 0), (1, 1))
212
214
Source or the destination is blocked
213
215
"""
@@ -315,7 +317,7 @@ def a_star_search(grid: List[List[int]], src: Tuple[int, int], dest: Tuple[int,
315
317
print ("Failed to find the destination cell" )
316
318
317
319
318
- # Driver Code
320
+ # Driver Code
319
321
320
322
if __name__ == "__main__" :
321
323
"""
@@ -349,4 +351,3 @@ def a_star_search(grid: List[List[int]], src: Tuple[int, int], dest: Tuple[int,
349
351
350
352
# Run the A* search algorithm
351
353
a_star_search (grid , src , dest )
352
-
0 commit comments