From 6d34b95f8f2d4c6a8c7a32e4bef2343603a1ad35 Mon Sep 17 00:00:00 2001 From: Darek Golomski Date: Mon, 12 Apr 2021 16:21:34 +0200 Subject: [PATCH] Refactor: Agent defuse mine under him --- src/main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.py b/src/main.py index b00d900..56b8c91 100644 --- a/src/main.py +++ b/src/main.py @@ -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}))