diff --git a/cooperative_cuisine/configs/agents/random_agent.py b/cooperative_cuisine/configs/agents/random_agent.py index 4344e3a2d2d409a05d7a2e286b2124da9c4ae858..e72bd4b67a39a83087c7f9ddc496d93c49c596e1 100644 --- a/cooperative_cuisine/configs/agents/random_agent.py +++ b/cooperative_cuisine/configs/agents/random_agent.py @@ -22,7 +22,9 @@ from cooperative_cuisine.utils import custom_asdict_factory TIME_TO_STOP_ACTION = 3.0 -ADD_RANDOM_MOVEMENTS = True +ADD_RANDOM_MOVEMENTS = False +DIAGONAL_MOVEMENTS = False +AVOID_OTHER_PLAYERS = True def get_free_neighbours( @@ -90,8 +92,9 @@ async def agent(): continue if movement_graph is None: - movement_graph = create_movement_graph(state, diagonal=True) - + movement_graph = create_movement_graph( + state, diagonal=DIAGONAL_MOVEMENTS + ) if counters is None: counters = defaultdict(list) @@ -170,16 +173,17 @@ async def agent(): paths = [] for free in target_free_spaces: try: - modified_graph = restrict_movement_graph( - graph=movement_graph.copy(), - player_positions=[ - p["pos"] - for p in state["players"] - if p["id"] != args.player_id - ], - ) path = networkx.astar_path( - modified_graph, + restrict_movement_graph( + graph=movement_graph.copy(), + player_positions=[ + p["pos"] + for p in state["players"] + if p["id"] != args.player_id + ], + ) + if AVOID_OTHER_PLAYERS + else movement_graph, source, free, heuristic=astar_heuristic, @@ -314,7 +318,13 @@ async def agent(): random_counter = random.choice(all_counters) counter_type = random_counter["type"] task_args = random_counter["pos"] - print(args.player_hash, args.player_id, task_type, counter_type, task_args) + print( + args.player_hash, + args.player_id, + task_type, + counter_type, + task_args, + ) else: print(args.player_hash, args.player_id, task_type) task_args = None