Skip to content

Commit

Permalink
Bump TicTacToe environment to version 4
Browse files Browse the repository at this point in the history
  • Loading branch information
dm-ackerman committed Mar 20, 2024
1 parent f750754 commit 72ef62f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/api/wrappers/pz_wrappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions pettingzoo/classic/all_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pettingzoo/classic/tictactoe/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
This environment is part of the <a href='..'>classic environments</a>. 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 |
Expand Down Expand Up @@ -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,
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pettingzoo/test/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions test/all_parameter_combs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)],
Expand Down
4 changes: 2 additions & 2 deletions tutorials/LangChain/langchain_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tutorials/SB3/test/test_sb3_action_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
leduc_holdem_v4,
texas_holdem_no_limit_v6,
texas_holdem_v4,
tictactoe_v3,
tictactoe_v4,
)

pytest.importorskip("stable_baselines3")
Expand All @@ -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
]

Expand Down
4 changes: 2 additions & 2 deletions tutorials/Tianshou/2_training_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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__":
Expand Down
4 changes: 2 additions & 2 deletions tutorials/Tianshou/3_cli_and_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 72ef62f

Please sign in to comment.