Skip to content

Commit 40d85d5

Browse files
Modified the a_star [dot] py for making readable (TheAlgorithms#4576)
1 parent a4b7d12 commit 40d85d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphs/a_star.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def search(grid, init, goal, cost, heuristic):
4444
x = init[0]
4545
y = init[1]
4646
g = 0
47-
f = g + heuristic[init[0]][init[0]]
47+
f = g + heuristic[x][y] # cost from starting cell to destination cell
4848
cell = [[f, g, x, y]]
4949

5050
found = False # flag that is set when search is complete

0 commit comments

Comments
 (0)