File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ def search(
74
74
if x == goal [0 ] and y == goal [1 ]:
75
75
found = True
76
76
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 ]
80
80
if x2 >= 0 and x2 < len (grid ) and y2 >= 0 and y2 < len (grid [0 ]):
81
81
if closed [x2 ][y2 ] == 0 and grid [x2 ][y2 ] == 0 :
82
82
g2 = g + cost
@@ -89,8 +89,8 @@ def search(
89
89
y = goal [1 ]
90
90
invpath .append ([x , y ]) # we get the reverse path from here
91
91
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 ]
94
94
x = x2
95
95
y = y2
96
96
invpath .append ([x , y ])
You can’t perform that action at this time.
0 commit comments