From 313db28dd448c27321660cd6d062a6ba20b548c8 Mon Sep 17 00:00:00 2001 From: Jeffer Peng Date: Thu, 29 Apr 2021 22:52:37 -0400 Subject: [PATCH] update agent DoneCreteria --- examples/game_of_tag/game_of_tag.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/game_of_tag/game_of_tag.py b/examples/game_of_tag/game_of_tag.py index fafd3620cb..36d05d51dd 100644 --- a/examples/game_of_tag/game_of_tag.py +++ b/examples/game_of_tag/game_of_tag.py @@ -30,7 +30,7 @@ from smarts.env.rllib_hiway_env import RLlibHiWayEnv from smarts.core.agent import AgentSpec, Agent from smarts.core.controllers import ActionSpaceType -from smarts.core.agent_interface import AgentInterface, AgentType, DoneCriteria +from smarts.core.agent_interface import AgentInterface, AgentType, DoneCriteria, AgentsAliveDoneCriteria, AgentsListAlive from smarts.core.utils.file import copy_tree @@ -105,6 +105,16 @@ def stop_all(self): off_route=False, wrong_way=False, collision=True, + agents_alive=AgentsAliveDoneCriteria( + agent_lists_alive=[ + AgentsListAlive( + agents_list=PREY_IDS, minimum_agents_alive_in_list=1 + ), + AgentsListAlive( + agents_list=PREDATOR_IDS, minimum_agents_alive_in_list=1 + ), + ] + ), ) for agent_id in PREDATOR_IDS: