Refactor: Agent defuse mine under him
This commit is contained in:
parent
de75ae3122
commit
6d34b95f8f
@ -56,15 +56,14 @@ def main():
|
|||||||
# TODO
|
# TODO
|
||||||
# petla while dopóki env.mine_count != 0
|
# petla while dopóki env.mine_count != 0
|
||||||
# uwzglednienie czy bfs zwraca False i wtedy break
|
# uwzglednienie czy bfs zwraca False i wtedy break
|
||||||
# for i in range(1):
|
# for i in range(2):
|
||||||
# while env.mine_count:
|
# while env.mine_count:
|
||||||
pg.time.delay(50)
|
pg.time.delay(50)
|
||||||
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)
|
||||||
print(path, actions)
|
print(path, actions)
|
||||||
if not path:
|
if not path and not env.field[agent.y][agent.x].mine:
|
||||||
if not env.field[agent.y][agent.x].mine:
|
print("Nie ma więcej min!")
|
||||||
print("CHUJA")
|
break
|
||||||
break
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
print(action)
|
print(action)
|
||||||
pg.event.post(pg.event.Event(pg.KEYDOWN, {'key': action}))
|
pg.event.post(pg.event.Event(pg.KEYDOWN, {'key': action}))
|
||||||
|
Loading…
Reference in New Issue
Block a user