feat: agent independently moves to target

This commit is contained in:
MlodyJacky 2024-05-04 13:30:12 +02:00
parent d186c2de5c
commit b7f186562b

21
app.py
View File

@ -89,10 +89,27 @@ target_x, target_y = 4,8
#target_x, target_y = 11,11
#WYWOLUJEMY FUNKCJE SZUKAJACA LISTY AKCJI
shortest_path = agent.bfs2(target_x, target_y)
print("Najkrótsza ścieżka:", shortest_path)
path = agent.bfs2(target_x, target_y)
print("Najkrótsza ścieżka:", path)
def watekDlaSciezkiAgenta():
time.sleep(3)
while True:
if len(path) > 0:
element = path.pop(0)
print(element)
if element =="left":
agent.rotate_left()
if element =="right":
agent.rotate_right()
if element =="forward":
agent.move_direction()
time.sleep(1)
watek = threading.Thread(target=watekDlaSciezkiAgenta)
watek.daemon = True
watek.start()
running = True
while running: