From 72ef62fb0c6fdac9e16e32f94564b349ddd5efa2 Mon Sep 17 00:00:00 2001 From: David Ackerman <145808634+dm-ackerman@users.noreply.github.com> Date: Wed, 20 Mar 2024 03:04:31 +0000 Subject: [PATCH] Bump TicTacToe environment to version 4 --- docs/api/wrappers/pz_wrappers.md | 4 ++-- pettingzoo/classic/all_modules.py | 4 ++-- pettingzoo/classic/tictactoe/tictactoe.py | 4 ++-- pettingzoo/classic/{tictactoe_v3.py => tictactoe_v4.py} | 0 pettingzoo/test/api_test.py | 4 ++-- test/all_parameter_combs_test.py | 4 ++-- tutorials/LangChain/langchain_example.py | 4 ++-- tutorials/SB3/test/test_sb3_action_mask.py | 4 ++-- tutorials/Tianshou/2_training_agents.py | 4 ++-- tutorials/Tianshou/3_cli_and_logging.py | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) rename pettingzoo/classic/{tictactoe_v3.py => tictactoe_v4.py} (100%) diff --git a/docs/api/wrappers/pz_wrappers.md b/docs/api/wrappers/pz_wrappers.md index d3eb21c38..08eba7bd4 100644 --- a/docs/api/wrappers/pz_wrappers.md +++ b/docs/api/wrappers/pz_wrappers.md @@ -65,8 +65,8 @@ You can apply these wrappers to your environment in a similar manner to the belo To wrap an AEC environment: ```python from pettingzoo.utils import TerminateIllegalWrapper -from pettingzoo.classic import tictactoe_v3 -env = tictactoe_v3.env() +from pettingzoo.classic import tictactoe_v4 +env = tictactoe_v4.env() env = TerminateIllegalWrapper(env, illegal_reward=-1) env.reset() diff --git a/pettingzoo/classic/all_modules.py b/pettingzoo/classic/all_modules.py index e9291d15d..621d1c9d3 100644 --- a/pettingzoo/classic/all_modules.py +++ b/pettingzoo/classic/all_modules.py @@ -8,14 +8,14 @@ rps_v2, texas_holdem_no_limit_v6, texas_holdem_v4, - tictactoe_v3, + tictactoe_v4, ) classic_environments = { "classic/chess_v6": chess_v6, "classic/rps_v2": rps_v2, "classic/connect_four_v3": connect_four_v3, - "classic/tictactoe_v3": tictactoe_v3, + "classic/tictactoe_v4": tictactoe_v4, "classic/leduc_holdem_v4": leduc_holdem_v4, "classic/texas_holdem_v4": texas_holdem_v4, "classic/texas_holdem_no_limit_v6": texas_holdem_no_limit_v6, diff --git a/pettingzoo/classic/tictactoe/tictactoe.py b/pettingzoo/classic/tictactoe/tictactoe.py index e95f6ce46..3d4c96fe6 100644 --- a/pettingzoo/classic/tictactoe/tictactoe.py +++ b/pettingzoo/classic/tictactoe/tictactoe.py @@ -9,7 +9,7 @@ This environment is part of the classic environments. Please read that page first for general information. -| Import | `from pettingzoo.classic import tictactoe_v3` | +| Import | `from pettingzoo.classic import tictactoe_v4` | |--------------------|-----------------------------------------------| | Actions | Discrete | | Parallel API | Yes | @@ -112,7 +112,7 @@ def env(**kwargs): class raw_env(AECEnv, EzPickle): metadata = { "render_modes": ["human", "rgb_array"], - "name": "tictactoe_v3", + "name": "tictactoe_v4", "is_parallelizable": False, "render_fps": 1, } diff --git a/pettingzoo/classic/tictactoe_v3.py b/pettingzoo/classic/tictactoe_v4.py similarity index 100% rename from pettingzoo/classic/tictactoe_v3.py rename to pettingzoo/classic/tictactoe_v4.py diff --git a/pettingzoo/test/api_test.py b/pettingzoo/test/api_test.py index f8718579c..4b461274f 100644 --- a/pettingzoo/test/api_test.py +++ b/pettingzoo/test/api_test.py @@ -73,7 +73,7 @@ def action_mask(): "go_v5", "chess_v6", "connect_four_v3", - "tictactoe_v3", + "tictactoe_v4", "gin_rummy_v4", ] env_graphical_obs = ["knights_archers_zombies_v10"] @@ -96,7 +96,7 @@ def action_mask(): "knights_archers_zombies_v10", "chess_v6", "connect_four_v3", - "tictactoe_v3", + "tictactoe_v4", "gin_rummy_v4", ] env_diff_agent_obs_size = [ diff --git a/test/all_parameter_combs_test.py b/test/all_parameter_combs_test.py index cff5a7cc3..e853c498c 100644 --- a/test/all_parameter_combs_test.py +++ b/test/all_parameter_combs_test.py @@ -43,7 +43,7 @@ rps_v2, texas_holdem_no_limit_v6, texas_holdem_v4, - tictactoe_v3, + tictactoe_v4, ) from pettingzoo.mpe import ( simple_adversary_v3, @@ -104,7 +104,7 @@ ["classic/connect_four_v3", connect_four_v3, dict()], ["classic/rps_v2", rps_v2, dict()], ["classic/chess_v6", chess_v6, dict()], - ["classic/tictactoe_v3", tictactoe_v3, dict()], + ["classic/tictactoe_v4", tictactoe_v4, dict()], ["classic/gin_rummy_v4", gin_rummy_v4, dict()], ["classic/gin_rummy_v4", gin_rummy_v4, dict(opponents_hand_visible=True)], ["mpe/simple_v3", simple_v3, dict(max_cycles=50)], diff --git a/tutorials/LangChain/langchain_example.py b/tutorials/LangChain/langchain_example.py index 5b88bfcc5..9730e0212 100644 --- a/tutorials/LangChain/langchain_example.py +++ b/tutorials/LangChain/langchain_example.py @@ -37,9 +37,9 @@ def rock_paper_scissors(): def tic_tac_toe(): - from pettingzoo.classic import tictactoe_v3 + from pettingzoo.classic import tictactoe_v4 - env = tictactoe_v3.env(render_mode="human") + env = tictactoe_v4.env(render_mode="human") agents = { name: ActionMaskAgent(name=name, model=ChatOpenAI(temperature=0.2), env=env) for name in env.possible_agents diff --git a/tutorials/SB3/test/test_sb3_action_mask.py b/tutorials/SB3/test/test_sb3_action_mask.py index 3835af393..b7613c023 100644 --- a/tutorials/SB3/test/test_sb3_action_mask.py +++ b/tutorials/SB3/test/test_sb3_action_mask.py @@ -10,7 +10,7 @@ leduc_holdem_v4, texas_holdem_no_limit_v6, texas_holdem_v4, - tictactoe_v3, + tictactoe_v4, ) pytest.importorskip("stable_baselines3") @@ -30,7 +30,7 @@ MEDIUM_ENVS = [ leduc_holdem_v4, # with 10x as many steps it gets higher total rewards (9 vs -9), 0.52 winrate, and 0.92 vs 0.83 total scores hanabi_v5, # even with 10x as many steps, total score seems to always be tied between the two agents - tictactoe_v3, # even with 10x as many steps, agent still loses every time (most likely an error somewhere) + tictactoe_v4, # even with 10x as many steps, agent still loses every time (most likely an error somewhere) chess_v6, # difficult to train because games take so long, performance varies heavily ] diff --git a/tutorials/Tianshou/2_training_agents.py b/tutorials/Tianshou/2_training_agents.py index 30ae1b159..19395b80a 100644 --- a/tutorials/Tianshou/2_training_agents.py +++ b/tutorials/Tianshou/2_training_agents.py @@ -22,7 +22,7 @@ from tianshou.trainer import offpolicy_trainer from tianshou.utils.net.common import Net -from pettingzoo.classic import tictactoe_v3 +from pettingzoo.classic import tictactoe_v4 def _get_agents( @@ -64,7 +64,7 @@ def _get_agents( def _get_env(): """This function is needed to provide callables for DummyVectorEnv.""" - return PettingZooEnv(tictactoe_v3.env()) + return PettingZooEnv(tictactoe_v4.env()) if __name__ == "__main__": diff --git a/tutorials/Tianshou/3_cli_and_logging.py b/tutorials/Tianshou/3_cli_and_logging.py index b11abe574..9526ec68e 100644 --- a/tutorials/Tianshou/3_cli_and_logging.py +++ b/tutorials/Tianshou/3_cli_and_logging.py @@ -26,7 +26,7 @@ from tianshou.utils.net.common import Net from torch.utils.tensorboard import SummaryWriter -from pettingzoo.classic import tictactoe_v3 +from pettingzoo.classic import tictactoe_v4 def get_parser() -> argparse.ArgumentParser: @@ -146,7 +146,7 @@ def get_agents( def get_env(render_mode=None): - return PettingZooEnv(tictactoe_v3.env(render_mode=render_mode)) + return PettingZooEnv(tictactoe_v4.env(render_mode=render_mode)) def train_agent(