Zaktualizuj 'graph_search.py'

ograniczenie wartości graphSearch do nieujemnych
This commit is contained in:
Jakub Chmielecki 2023-04-16 15:42:10 +02:00
parent f0fe5b42c1
commit d2f973307f

View File

@ -54,6 +54,8 @@ class Search:
explored.append(elem)
for (action, state_x, state_y, state_angle) in self.succ(elem.state):
if state_x < 0 or state_y < 0: # check if any of the values is negative
continue
if [state_x, state_y, state_angle] not in fringe and [state_x, state_y, state_angle] not in explored:
x = Node([state_x, state_y, state_angle])
x.parent = elem