uncomment while loop
This commit is contained in:
parent
afb9d0e7dd
commit
0545233f43
28
src/main.py
28
src/main.py
@ -76,23 +76,23 @@ def main():
|
|||||||
elif event.type == pg.KEYDOWN:
|
elif event.type == pg.KEYDOWN:
|
||||||
if event.key == pg.K_t:
|
if event.key == pg.K_t:
|
||||||
print('Starting to clear the sector')
|
print('Starting to clear the sector')
|
||||||
# while env.mine_count:
|
while env.mine_count:
|
||||||
print('-' * 20)
|
print('-' * 20)
|
||||||
# path, actions = breadth_first_search(env.field, agent.x, agent.y, agent.direction)
|
# 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)
|
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)
|
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:
|
if not path and not env.field[agent.y][agent.x].mine:
|
||||||
print('Unable to find path, rocks are in the way')
|
print('Unable to find path, rocks are in the way')
|
||||||
break
|
break
|
||||||
print(f'Path{path}')
|
print(f'Path{path}')
|
||||||
|
|
||||||
print(f'Actions:{actions}')
|
print(f'Actions:{actions}')
|
||||||
for action in actions:
|
for action in actions:
|
||||||
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': action}))
|
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': action}))
|
||||||
|
|
||||||
handle_keys(env, agent, game_ui, factory)
|
handle_keys(env, agent, game_ui, factory)
|
||||||
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': pg.K_SPACE}))
|
pg.fastevent.post(pg.event.Event(pg.KEYDOWN, {'key': pg.K_SPACE}))
|
||||||
|
|
||||||
print('Sector clear')
|
print('Sector clear')
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user