@@ -854,17 +854,17 @@ def goal_dict_satistfied(goal_dict:dict, known_dict: dict)-> bool:
854854 return False
855855 return False
856856 self .logger .debug (f"Checking goal for agent { agent_addr } ." )
857- goal_conditions = self ._win_conditions_per_role [self .agents [agent_addr ][1 ]]
858- self .logger .debug (f"\t Goal conditions for { agent_addr } : { goal_conditions } ." )
859857 state = self ._agent_states [agent_addr ]
860858 # For each part of the state of the game, check if the conditions are met
859+ target_goal_state = self ._agent_goal_states [agent_addr ]
860+ self .logger .debug (f"\t Goal conditions: { target_goal_state } ." )
861861 goal_reached = {}
862- goal_reached ["networks" ] = set ( goal_conditions [ " known_networks" ]) <= set ( state .known_networks )
863- goal_reached ["known_hosts" ] = set ( goal_conditions [ " known_hosts" ]) <= set ( state .known_hosts )
864- goal_reached ["controlled_hosts" ] = set ( goal_conditions [ " controlled_hosts" ]) <= set ( state .controlled_hosts )
865- goal_reached ["services" ] = goal_dict_satistfied (goal_conditions [ " known_services" ] , state .known_services )
866- goal_reached ["data" ] = goal_dict_satistfied (goal_conditions [ " known_data" ] , state .known_data )
867- goal_reached ["known_blocks" ] = goal_dict_satistfied (goal_conditions [ " known_blocks" ] , state .known_blocks )
862+ goal_reached ["networks" ] = target_goal_state . known_networks <= state .known_networks
863+ goal_reached ["known_hosts" ] = target_goal_state . known_hosts <= state .known_hosts
864+ goal_reached ["controlled_hosts" ] = target_goal_state . controlled_hosts <= state .controlled_hosts
865+ goal_reached ["services" ] = goal_dict_satistfied (target_goal_state . known_services , state .known_services )
866+ goal_reached ["data" ] = goal_dict_satistfied (target_goal_state . known_data , state .known_data )
867+ goal_reached ["known_blocks" ] = goal_dict_satistfied (target_goal_state . known_blocks , state .known_blocks )
868868 self .logger .debug (f"\t { goal_reached } " )
869869 return all (goal_reached .values ())
870870
0 commit comments