uncomment while loop

This commit is contained in:
matixezor 2021-05-18 18:44:28 +02:00
parent afb9d0e7dd
commit 0545233f43

View File

@ -76,23 +76,23 @@ def main():
elif event.type == pg.KEYDOWN:
if event.key == pg.K_t:
print('Starting to clear the sector')
# while env.mine_count:
print('-' * 20)
# path, actions = breadth_first_search(env.field, agent.x, agent.y, agent.direction)
goal = breadth_first_search(env.field, agent.x, agent.y, agent.direction, True)
path, actions = a_star(env.field, agent.x, agent.y, agent.direction, goal)
while env.mine_count:
print('-' * 20)
# path, actions = breadth_first_search(env.field, agent.x, agent.y, agent.direction)
goal = breadth_first_search(env.field, agent.x, agent.y, agent.direction, True)
path, actions = a_star(env.field, agent.x, agent.y, agent.direction, goal)
if not path and not env.field[agent.y][agent.x].mine:
print('Unable to find path, rocks are in the way')
break
print(f'Path{path}')
if not path and not env.field[agent.y][agent.x].mine:
print('Unable to find path, rocks are in the way')
break
print(f'Path{path}')
print(f'Actions:{actions}')
for action in actions:
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': action}))
print(f'Actions:{actions}')
for action in actions:
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': action}))
handle_keys(env, agent, game_ui, factory)
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': pg.K_SPACE}))
handle_keys(env, agent, game_ui, factory)
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': pg.K_SPACE}))
print('Sector clear')
else: