bfs na przycisk b
This commit is contained in:
parent
34f3bb77f5
commit
8bb836ef06
14
app.py
14
app.py
@ -65,12 +65,6 @@ initBoard()
|
|||||||
agent = Agent(prefs.SPAWN_POINT[0], prefs.SPAWN_POINT[1], cells)
|
agent = Agent(prefs.SPAWN_POINT[0], prefs.SPAWN_POINT[1], cells)
|
||||||
|
|
||||||
target_x, target_y = 9,11
|
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():
|
def watekDlaSciezkiAgenta():
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
while True:
|
while True:
|
||||||
@ -86,9 +80,7 @@ def watekDlaSciezkiAgenta():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
watek = threading.Thread(target=watekDlaSciezkiAgenta)
|
|
||||||
watek.daemon = True
|
|
||||||
watek.start()
|
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
while running:
|
while running:
|
||||||
@ -120,6 +112,10 @@ while running:
|
|||||||
|
|
||||||
if keys[K_b]:
|
if keys[K_b]:
|
||||||
path = agent.bfs2(target_x, target_y)
|
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 pygame.key.get_pressed()[pygame.K_e]:
|
||||||
if agent.current_cell.interactableItem and pygame.time.get_ticks() - agent.last_interact_time > 500:
|
if agent.current_cell.interactableItem and pygame.time.get_ticks() - agent.last_interact_time > 500:
|
||||||
|
Loading…
Reference in New Issue
Block a user