Skip to content

Commit 8d23c2f

Browse files
committed
Rename delta by DIRECTIONS in all code
1 parent 0703210 commit 8d23c2f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

graphs/a_star.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def search(
7474
if x == goal[0] and y == goal[1]:
7575
found = True
7676
else:
77-
for i in range(len(delta)): # to try out different valid actions
78-
x2 = x + delta[i][0]
79-
y2 = y + delta[i][1]
77+
for i in range(len(DIRECTIONS)): # to try out different valid actions
78+
x2 = x + DIRECTIONS[i][0]
79+
y2 = y + DIRECTIONS[i][1]
8080
if x2 >= 0 and x2 < len(grid) and y2 >= 0 and y2 < len(grid[0]):
8181
if closed[x2][y2] == 0 and grid[x2][y2] == 0:
8282
g2 = g + cost
@@ -89,8 +89,8 @@ def search(
8989
y = goal[1]
9090
invpath.append([x, y]) # we get the reverse path from here
9191
while x != init[0] or y != init[1]:
92-
x2 = x - delta[action[x][y]][0]
93-
y2 = y - delta[action[x][y]][1]
92+
x2 = x - DIRECTIONS[action[x][y]][0]
93+
y2 = y - DIRECTIONS[action[x][y]][1]
9494
x = x2
9595
y = y2
9696
invpath.append([x, y])

0 commit comments

Comments
 (0)