Naprawiono bug z DFS

This commit is contained in:
Anna Nowak 2019-05-13 09:09:48 +02:00
parent 9b22d4a166
commit 1963068dd6

View File

@ -12,14 +12,15 @@ def DFS(grid, available_movement, gc_moveset, depth=0):
possible_goals.append([a,b-1]) possible_goals.append([a,b-1])
house_in_area = False house_in_area = False
for location in possible_goals: for location in possible_goals:
try: if location[0]>=0 and location[1]>=0:
cell = grid[location[0]][location[1]] try:
if(type(cell) == House and cell.container.is_full and cell.unvisited): cell = grid[location[0]][location[1]]
cell.unvisited = False if(type(cell) == House and cell.container.is_full and cell.unvisited):
house_in_area = True cell.unvisited = False
break house_in_area = True
except: break
continue except:
continue
if(house_in_area): if(house_in_area):
xy = gc_moveset[-1] xy = gc_moveset[-1]
gc_moveset.append("pick_garbage") gc_moveset.append("pick_garbage")