bfs na przycisk b

This commit is contained in:
Uni 2024-05-08 19:23:53 +02:00
parent 34f3bb77f5
commit 8bb836ef06

14
app.py
View File

@ -65,12 +65,6 @@ initBoard()
agent = Agent(prefs.SPAWN_POINT[0], prefs.SPAWN_POINT[1], cells)
target_x, target_y = 9,11
#WYWOLUJEMY FUNKCJE SZUKAJACA LISTY AKCJI
path = agent.bfs2(target_x, target_y)
print("Najkrótsza ścieżka:", path)
def watekDlaSciezkiAgenta():
time.sleep(3)
while True:
@ -86,9 +80,7 @@ def watekDlaSciezkiAgenta():
time.sleep(1)
watek = threading.Thread(target=watekDlaSciezkiAgenta)
watek.daemon = True
watek.start()
running = True
while running:
@ -120,6 +112,10 @@ while running:
if keys[K_b]:
path = agent.bfs2(target_x, target_y)
print("Najkrótsza ścieżka:", path)
watek = threading.Thread(target=watekDlaSciezkiAgenta)
watek.daemon = True
watek.start()
if pygame.key.get_pressed()[pygame.K_e]:
if agent.current_cell.interactableItem and pygame.time.get_ticks() - agent.last_interact_time > 500: