diff --git a/bfs.py b/bfs.py index 0e29f49..3f219da 100644 --- a/bfs.py +++ b/bfs.py @@ -14,8 +14,9 @@ def bfs(istate, goalx, goaly): return steps element = successors(state) - explored.append(state) + explored.append((state.xpos, state.ypos, state.orientation)) for value in element : - if value not in explored and value not in fringe: + val = (value.xpos, value.ypos, value.orientation) + if val not in explored: fringe.append(value) return False diff --git a/main.py b/main.py index 90191dc..b9b865a 100644 --- a/main.py +++ b/main.py @@ -68,7 +68,7 @@ def main(): run = False #keys_pressed = pygame.key.get_pressed() draw_window(agent, fields) - steps = bfs(State(None, None, 0, 0, 'E'), 250, 100) + steps = bfs(State(None, None, 0, 0, 'E'), 250, 700) for interm in steps: if interm.action == 'LEFT': agent.direction = (agent.direction - 1) % 4