@@ -117,7 +117,7 @@ def calc_cost(self, node_a, node_b, weighted=False):
117117 def neighbors (
118118 self , node : GridNode ,
119119 diagonal_movement : DiagonalMovement = DiagonalMovement .never ,
120- include_non_walkable : bool = False
120+ include_non_walkables : bool = False
121121 ) -> List [GridNode ]:
122122 """
123123 get all neighbors of one node
@@ -134,7 +134,7 @@ def neighbors(
134134 else :
135135 north_y = y - 1
136136
137- if self .walkable (x , north_y ) or include_non_walkable and self .inside (x , north_y ):
137+ if self .walkable (x , north_y ) or include_non_walkables and self .inside (x , north_y ):
138138 neighbors .append (self .nodes [north_y ][x ])
139139 north = True
140140
@@ -144,7 +144,7 @@ def neighbors(
144144 else :
145145 east_x = x + 1
146146
147- if self .walkable (east_x , y ) or include_non_walkable and self .inside (east_x , y ):
147+ if self .walkable (east_x , y ) or include_non_walkables and self .inside (east_x , y ):
148148 neighbors .append (self .nodes [y ][east_x ])
149149 east = True
150150
@@ -153,7 +153,7 @@ def neighbors(
153153 south_y = 0
154154 else :
155155 south_y = y + 1
156- if self .walkable (x , south_y ) or include_non_walkable and self .inside (x , south_y ):
156+ if self .walkable (x , south_y ) or include_non_walkables and self .inside (x , south_y ):
157157 neighbors .append (self .nodes [south_y ][x ])
158158 south = True
159159
@@ -162,7 +162,7 @@ def neighbors(
162162 west_x = self .width - 1
163163 else :
164164 west_x = x - 1
165- if self .walkable (west_x , y ) or include_non_walkable and self .inside (west_x , y ):
165+ if self .walkable (west_x , y ) or include_non_walkables and self .inside (west_x , y ):
166166 neighbors .append (self .nodes [y ][west_x ])
167167 west = True
168168
@@ -196,7 +196,7 @@ def neighbors(
196196 nw_y = self .height - 1
197197 else :
198198 nw_y = y - 1
199- if self .walkable (nw_x , nw_y ) or include_non_walkable and self .inside (nw_x , nw_y ):
199+ if self .walkable (nw_x , nw_y ) or include_non_walkables and self .inside (nw_x , nw_y ):
200200 neighbors .append (self .nodes [nw_y ][nw_x ])
201201
202202 # ↗
@@ -209,7 +209,7 @@ def neighbors(
209209 ne_y = self .height - 1
210210 else :
211211 ne_y = y - 1
212- if self .walkable (ne_x , ne_y ) or include_non_walkable and self .inside (ne_x , ne_y ):
212+ if self .walkable (ne_x , ne_y ) or include_non_walkables and self .inside (ne_x , ne_y ):
213213 neighbors .append (self .nodes [ne_y ][ne_x ])
214214
215215 # ↘
@@ -222,7 +222,7 @@ def neighbors(
222222 se_y = 0
223223 else :
224224 se_y = y + 1
225- if self .walkable (se_x , se_y ) or include_non_walkable and self .inside (se_x , se_y ):
225+ if self .walkable (se_x , se_y ) or include_non_walkables and self .inside (se_x , se_y ):
226226 neighbors .append (self .nodes [se_y ][se_x ])
227227
228228 # ↙
@@ -235,7 +235,7 @@ def neighbors(
235235 sw_y = 0
236236 else :
237237 sw_y = y + 1
238- if self .walkable (sw_x , sw_y ) or include_non_walkable and self .inside (sw_x , sw_y ):
238+ if self .walkable (sw_x , sw_y ) or include_non_walkables and self .inside (sw_x , sw_y ):
239239 neighbors .append (self .nodes [sw_y ][sw_x ])
240240
241241 return neighbors
0 commit comments