movement_planning #2
5
bfs.py
5
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
|
||||
|
2
main.py
2
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
|
||||
|
Loading…
Reference in New Issue
Block a user