Refactor: Agent defuse mine under him

This commit is contained in:
Darek Golomski 2021-04-12 16:21:34 +02:00
parent de75ae3122
commit 6d34b95f8f

View File

@ -56,15 +56,14 @@ def main():
# TODO
# petla while dopóki env.mine_count != 0
# uwzglednienie czy bfs zwraca False i wtedy break
# for i in range(1):
# for i in range(2):
# while env.mine_count:
pg.time.delay(50)
path, actions = breadth_first_search(env.field, agent.x, agent.y, agent.direction)
print(path, actions)
if not path:
if not env.field[agent.y][agent.x].mine:
print("CHUJA")
break
if not path and not env.field[agent.y][agent.x].mine:
print("Nie ma więcej min!")
break
for action in actions:
print(action)
pg.event.post(pg.event.Event(pg.KEYDOWN, {'key': action}))