Skip to content
Snippets Groups Projects

Resolve "simple pathfinding"

Merged Fabian Heinrich requested to merge 120-simple-pathfinding into dev
Files
5
@@ -23,7 +23,7 @@ from cooperative_cuisine.utils import custom_asdict_factory
TIME_TO_STOP_ACTION = 3.0
ADD_RANDOM_MOVEMENTS = False
DIAGONAL_MOVEMENTS = False
DIAGONAL_MOVEMENTS = True
AVOID_OTHER_PLAYERS = True
@@ -175,7 +175,7 @@ async def agent():
try:
path = networkx.astar_path(
restrict_movement_graph(
graph=movement_graph.copy(),
graph=movement_graph,
player_positions=[
p["pos"]
for p in state["players"]
@@ -207,6 +207,8 @@ async def agent():
do_movement = True
else:
# no paths available
print("NO PATHS")
# task_type = None
# task_args = None
do_movement = False
@@ -251,6 +253,7 @@ async def agent():
await websocket.recv()
else:
# Target reached here.
print("TARGET REACHED")
task_type = None
task_args = None
case "INTERACT":
@@ -307,9 +310,8 @@ async def agent():
...
if not task_type:
# task_type = random.choice(["GOTO"])
task_type = random.choice(["GOTO", "PUT"])
# task_type = random.choice(["GOTO", "PUT", "INTERACT"])
task_type = random.choice(["GOTO"])
threshold = datetime.now() + timedelta(seconds=TIME_TO_STOP_ACTION)
if task_type == "GOTO":
# counter_type = random.choice(list(counters.keys()))
Loading