From b98c2af65fd8ca56a4090d5e7942421a6b8b2a9e Mon Sep 17 00:00:00 2001 From: RushivArora Date: Tue, 7 Jun 2022 22:39:15 -0400 Subject: [PATCH 1/5] Test Fix Push --- .../atari/basketball_pong/basketball_pong.py | 20 ++++++++++++ pettingzoo/atari/basketball_pong_v3.py | 25 +++------------ pettingzoo/atari/boxing/boxing.py | 17 ++++++++++ pettingzoo/atari/boxing_v2.py | 18 +---------- pettingzoo/atari/combat_plane/combat_plane.py | 27 ++++++++++++++++ pettingzoo/atari/combat_plane_v2.py | 28 +---------------- pettingzoo/atari/combat_tank/combat_tank.py | 30 ++++++++++++++++++ pettingzoo/atari/combat_tank_v2.py | 31 +------------------ pettingzoo/atari/double_dunk/double_dunk.py | 17 ++++++++++ pettingzoo/atari/double_dunk_v3.py | 18 +---------- .../entombed_competitive.py | 17 ++++++++++ pettingzoo/atari/entombed_competitive_v3.py | 18 +---------- .../entombed_cooperative.py | 17 ++++++++++ pettingzoo/atari/entombed_cooperative_v3.py | 18 +---------- pettingzoo/atari/flag_capture/flag_capture.py | 17 ++++++++++ pettingzoo/atari/flag_capture_v2.py | 18 +---------- pettingzoo/atari/foozpong/foozpong.py | 20 ++++++++++++ pettingzoo/atari/foozpong_v3.py | 21 +------------ pettingzoo/atari/ice_hockey/ice_hockey.py | 17 ++++++++++ pettingzoo/atari/ice_hockey_v2.py | 18 +---------- pettingzoo/atari/joust/joust.py | 17 ++++++++++ pettingzoo/atari/joust_v3.py | 18 +---------- pettingzoo/atari/mario_bros/mario_bros.py | 17 ++++++++++ pettingzoo/atari/mario_bros_v3.py | 18 +---------- 24 files changed, 249 insertions(+), 233 deletions(-) create mode 100644 pettingzoo/atari/basketball_pong/basketball_pong.py create mode 100644 pettingzoo/atari/boxing/boxing.py create mode 100644 pettingzoo/atari/combat_plane/combat_plane.py create mode 100644 pettingzoo/atari/combat_tank/combat_tank.py create mode 100644 pettingzoo/atari/double_dunk/double_dunk.py create mode 100644 pettingzoo/atari/entombed_competitive/entombed_competitive.py create mode 100644 pettingzoo/atari/entombed_cooperative/entombed_cooperative.py create mode 100644 pettingzoo/atari/flag_capture/flag_capture.py create mode 100644 pettingzoo/atari/foozpong/foozpong.py create mode 100644 pettingzoo/atari/ice_hockey/ice_hockey.py create mode 100644 pettingzoo/atari/joust/joust.py create mode 100644 pettingzoo/atari/mario_bros/mario_bros.py diff --git a/pettingzoo/atari/basketball_pong/basketball_pong.py b/pettingzoo/atari/basketball_pong/basketball_pong.py new file mode 100644 index 000000000..5e12f9992 --- /dev/null +++ b/pettingzoo/atari/basketball_pong/basketball_pong.py @@ -0,0 +1,20 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(num_players=2, **kwargs): + assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" + mode_mapping = {2: 45, 4: 49} + mode = mode_mapping[num_players] + return BaseAtariEnv( + game="pong", + num_players=num_players, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/basketball_pong_v3.py b/pettingzoo/atari/basketball_pong_v3.py index cd84a9d7e..af72e75bb 100644 --- a/pettingzoo/atari/basketball_pong_v3.py +++ b/pettingzoo/atari/basketball_pong_v3.py @@ -1,20 +1,5 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(num_players=2, **kwargs): - assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" - mode_mapping = {2: 45, 4: 49} - mode = mode_mapping[num_players] - return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .basketball_pong.basketball_pong import ( # noqa: F401 + env, + parallel_env, + raw_env, +) diff --git a/pettingzoo/atari/boxing/boxing.py b/pettingzoo/atari/boxing/boxing.py new file mode 100644 index 000000000..c80e724f1 --- /dev/null +++ b/pettingzoo/atari/boxing/boxing.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="boxing", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/boxing_v2.py b/pettingzoo/atari/boxing_v2.py index 29b090637..25141d584 100644 --- a/pettingzoo/atari/boxing_v2.py +++ b/pettingzoo/atari/boxing_v2.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="boxing", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .boxing.boxing import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/combat_plane/combat_plane.py b/pettingzoo/atari/combat_plane/combat_plane.py new file mode 100644 index 000000000..4d603b8fb --- /dev/null +++ b/pettingzoo/atari/combat_plane/combat_plane.py @@ -0,0 +1,27 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + +avaliable_versions = { + "bi-plane": 15, + "jet": 21, +} + + +def raw_env(game_version="bi-plane", guided_missile=True, **kwargs): + assert ( + game_version in avaliable_versions + ), "game_version must be either 'jet' or 'bi-plane'" + mode = avaliable_versions[game_version] + (0 if guided_missile else 1) + + return BaseAtariEnv( + game="combat", + num_players=2, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/combat_plane_v2.py b/pettingzoo/atari/combat_plane_v2.py index 9188212ff..842175ddd 100644 --- a/pettingzoo/atari/combat_plane_v2.py +++ b/pettingzoo/atari/combat_plane_v2.py @@ -1,27 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - -avaliable_versions = { - "bi-plane": 15, - "jet": 21, -} - - -def raw_env(game_version="bi-plane", guided_missile=True, **kwargs): - assert ( - game_version in avaliable_versions - ), "game_version must be either 'jet' or 'bi-plane'" - mode = avaliable_versions[game_version] + (0 if guided_missile else 1) - - return BaseAtariEnv( - game="combat", - num_players=2, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .combat_plane.combat_plane import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/combat_tank/combat_tank.py b/pettingzoo/atari/combat_tank/combat_tank.py new file mode 100644 index 000000000..3dc29694d --- /dev/null +++ b/pettingzoo/atari/combat_tank/combat_tank.py @@ -0,0 +1,30 @@ +import os +import warnings + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(has_maze=True, is_invisible=False, billiard_hit=True, **kwargs): + if has_maze is False and is_invisible is False and billiard_hit is False: + warnings.warn( + "combat_tank has interesting parameters to consider overriding including is_invisible, billiard_hit and has_maze" + ) + start_mapping = { + (False, False): 1, + (False, True): 8, + (True, False): 10, + (True, True): 13, + } + mode = start_mapping[(is_invisible, billiard_hit)] + has_maze + + return BaseAtariEnv( + game="combat", + num_players=2, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/combat_tank_v2.py b/pettingzoo/atari/combat_tank_v2.py index 78a794c00..3f3aaa61d 100644 --- a/pettingzoo/atari/combat_tank_v2.py +++ b/pettingzoo/atari/combat_tank_v2.py @@ -1,30 +1 @@ -import os -import warnings - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(has_maze=True, is_invisible=False, billiard_hit=True, **kwargs): - if has_maze is False and is_invisible is False and billiard_hit is False: - warnings.warn( - "combat_tank has interesting parameters to consider overriding including is_invisible, billiard_hit and has_maze" - ) - start_mapping = { - (False, False): 1, - (False, True): 8, - (True, False): 10, - (True, True): 13, - } - mode = start_mapping[(is_invisible, billiard_hit)] + has_maze - - return BaseAtariEnv( - game="combat", - num_players=2, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .combat_tank.combat_tank import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/double_dunk/double_dunk.py b/pettingzoo/atari/double_dunk/double_dunk.py new file mode 100644 index 000000000..4c4e60d6c --- /dev/null +++ b/pettingzoo/atari/double_dunk/double_dunk.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="double_dunk", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/double_dunk_v3.py b/pettingzoo/atari/double_dunk_v3.py index ec8c35a61..347be1242 100644 --- a/pettingzoo/atari/double_dunk_v3.py +++ b/pettingzoo/atari/double_dunk_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="double_dunk", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .double_dunk.double_dunk import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/entombed_competitive/entombed_competitive.py b/pettingzoo/atari/entombed_competitive/entombed_competitive.py new file mode 100644 index 000000000..f2d7add8b --- /dev/null +++ b/pettingzoo/atari/entombed_competitive/entombed_competitive.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="entombed", + num_players=2, + mode_num=2, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/entombed_competitive_v3.py b/pettingzoo/atari/entombed_competitive_v3.py index 3f4060288..c28330e0c 100644 --- a/pettingzoo/atari/entombed_competitive_v3.py +++ b/pettingzoo/atari/entombed_competitive_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="entombed", - num_players=2, - mode_num=2, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .entombed_competitive.entombed_competitive import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py b/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py new file mode 100644 index 000000000..6d4ad62cf --- /dev/null +++ b/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="entombed", + num_players=2, + mode_num=3, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/entombed_cooperative_v3.py b/pettingzoo/atari/entombed_cooperative_v3.py index 0009e0172..bdb548f4a 100644 --- a/pettingzoo/atari/entombed_cooperative_v3.py +++ b/pettingzoo/atari/entombed_cooperative_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="entombed", - num_players=2, - mode_num=3, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .entombed_cooperative.entombed_cooperative import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/flag_capture/flag_capture.py b/pettingzoo/atari/flag_capture/flag_capture.py new file mode 100644 index 000000000..b27a4aa41 --- /dev/null +++ b/pettingzoo/atari/flag_capture/flag_capture.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="flag_capture", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/flag_capture_v2.py b/pettingzoo/atari/flag_capture_v2.py index 752e54055..d901c3c8d 100644 --- a/pettingzoo/atari/flag_capture_v2.py +++ b/pettingzoo/atari/flag_capture_v2.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="flag_capture", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .flag_capture.flag_capture import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/foozpong/foozpong.py b/pettingzoo/atari/foozpong/foozpong.py new file mode 100644 index 000000000..8a9ffa0f0 --- /dev/null +++ b/pettingzoo/atari/foozpong/foozpong.py @@ -0,0 +1,20 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(num_players=4, **kwargs): + assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" + mode_mapping = {2: 19, 4: 21} + mode = mode_mapping[num_players] + return BaseAtariEnv( + game="pong", + num_players=num_players, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/foozpong_v3.py b/pettingzoo/atari/foozpong_v3.py index cf1a421a6..a871c658b 100644 --- a/pettingzoo/atari/foozpong_v3.py +++ b/pettingzoo/atari/foozpong_v3.py @@ -1,20 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(num_players=4, **kwargs): - assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" - mode_mapping = {2: 19, 4: 21} - mode = mode_mapping[num_players] - return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .foozpong.foozpong import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/ice_hockey/ice_hockey.py b/pettingzoo/atari/ice_hockey/ice_hockey.py new file mode 100644 index 000000000..ac5d0bb54 --- /dev/null +++ b/pettingzoo/atari/ice_hockey/ice_hockey.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="ice_hockey", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/ice_hockey_v2.py b/pettingzoo/atari/ice_hockey_v2.py index fdb9f2399..48b3a2c2c 100644 --- a/pettingzoo/atari/ice_hockey_v2.py +++ b/pettingzoo/atari/ice_hockey_v2.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="ice_hockey", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .ice_hockey.ice_hockey import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/joust/joust.py b/pettingzoo/atari/joust/joust.py new file mode 100644 index 000000000..7df613348 --- /dev/null +++ b/pettingzoo/atari/joust/joust.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="joust", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/joust_v3.py b/pettingzoo/atari/joust_v3.py index 98ed35e8e..e3597bc19 100644 --- a/pettingzoo/atari/joust_v3.py +++ b/pettingzoo/atari/joust_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="joust", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .joust.joust import env, raw_env, parallel_env # noqa: F401 diff --git a/pettingzoo/atari/mario_bros/mario_bros.py b/pettingzoo/atari/mario_bros/mario_bros.py new file mode 100644 index 000000000..336229074 --- /dev/null +++ b/pettingzoo/atari/mario_bros/mario_bros.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="mario_bros", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/mario_bros_v3.py b/pettingzoo/atari/mario_bros_v3.py index 3aca41756..99aeb8fe3 100644 --- a/pettingzoo/atari/mario_bros_v3.py +++ b/pettingzoo/atari/mario_bros_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="mario_bros", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .mario_bros.mario_bros import env, raw_env, parallel_env # noqa: F401 From 594f467493e4872f7354c3ecc0b471446080d5fb Mon Sep 17 00:00:00 2001 From: RushivArora Date: Thu, 9 Jun 2022 18:20:58 -0400 Subject: [PATCH 2/5] Remaining Atari Envs --- pettingzoo/atari/basketball_pong_v3.py | 6 +-- pettingzoo/atari/boxing_v2.py | 2 +- pettingzoo/atari/combat_plane_v2.py | 2 +- pettingzoo/atari/combat_tank_v2.py | 2 +- pettingzoo/atari/double_dunk_v3.py | 2 +- pettingzoo/atari/entombed_competitive_v3.py | 6 ++- pettingzoo/atari/entombed_cooperative_v3.py | 2 +- pettingzoo/atari/flag_capture_v2.py | 2 +- pettingzoo/atari/foozpong_v3.py | 2 +- pettingzoo/atari/ice_hockey_v2.py | 2 +- pettingzoo/atari/joust_v3.py | 2 +- pettingzoo/atari/mario_bros_v3.py | 2 +- pettingzoo/atari/maze_craze/maze_craze.py | 36 +++++++++++++++ pettingzoo/atari/maze_craze_v3.py | 37 +-------------- pettingzoo/atari/othello/othello.py | 17 +++++++ pettingzoo/atari/othello_v3.py | 18 +------- pettingzoo/atari/pong/pong.py | 45 ++++++++++++++++++ pettingzoo/atari/pong_v3.py | 46 +------------------ pettingzoo/atari/quadrapong/quadrapong.py | 19 ++++++++ pettingzoo/atari/quadrapong_v4.py | 20 +------- .../atari/space_invaders/space_invaders.py | 31 +++++++++++++ pettingzoo/atari/space_invaders_v2.py | 32 +------------ pettingzoo/atari/space_war/space_war.py | 17 +++++++ pettingzoo/atari/space_war_v2.py | 18 +------- pettingzoo/atari/surround/surround.py | 17 +++++++ pettingzoo/atari/surround_v2.py | 18 +------- pettingzoo/atari/tennis/tennis.py | 17 +++++++ pettingzoo/atari/tennis_v3.py | 18 +------- .../atari/video_checkers/video_checkers.py | 17 +++++++ pettingzoo/atari/video_checkers_v4.py | 18 +------- .../atari/volleyball_pong/volleyball_pong.py | 20 ++++++++ pettingzoo/atari/volleyball_pong_v3.py | 21 +-------- pettingzoo/atari/warlords/warlords.py | 17 +++++++ pettingzoo/atari/warlords_v3.py | 18 +------- .../atari/wizard_of_wor/wizard_of_wor.py | 17 +++++++ pettingzoo/atari/wizard_of_wor_v3.py | 18 +------- 36 files changed, 298 insertions(+), 286 deletions(-) create mode 100644 pettingzoo/atari/maze_craze/maze_craze.py create mode 100644 pettingzoo/atari/othello/othello.py create mode 100644 pettingzoo/atari/pong/pong.py create mode 100644 pettingzoo/atari/quadrapong/quadrapong.py create mode 100644 pettingzoo/atari/space_invaders/space_invaders.py create mode 100644 pettingzoo/atari/space_war/space_war.py create mode 100644 pettingzoo/atari/surround/surround.py create mode 100644 pettingzoo/atari/tennis/tennis.py create mode 100644 pettingzoo/atari/video_checkers/video_checkers.py create mode 100644 pettingzoo/atari/volleyball_pong/volleyball_pong.py create mode 100644 pettingzoo/atari/warlords/warlords.py create mode 100644 pettingzoo/atari/wizard_of_wor/wizard_of_wor.py diff --git a/pettingzoo/atari/basketball_pong_v3.py b/pettingzoo/atari/basketball_pong_v3.py index af72e75bb..684251c85 100644 --- a/pettingzoo/atari/basketball_pong_v3.py +++ b/pettingzoo/atari/basketball_pong_v3.py @@ -1,5 +1 @@ -from .basketball_pong.basketball_pong import ( # noqa: F401 - env, - parallel_env, - raw_env, -) +from .basketball_pong.basketball_pong import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/boxing_v2.py b/pettingzoo/atari/boxing_v2.py index 25141d584..42478e4fa 100644 --- a/pettingzoo/atari/boxing_v2.py +++ b/pettingzoo/atari/boxing_v2.py @@ -1 +1 @@ -from .boxing.boxing import env, raw_env, parallel_env # noqa: F401 +from .boxing.boxing import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/combat_plane_v2.py b/pettingzoo/atari/combat_plane_v2.py index 842175ddd..aae54e5f2 100644 --- a/pettingzoo/atari/combat_plane_v2.py +++ b/pettingzoo/atari/combat_plane_v2.py @@ -1 +1 @@ -from .combat_plane.combat_plane import env, raw_env, parallel_env # noqa: F401 +from .combat_plane.combat_plane import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/combat_tank_v2.py b/pettingzoo/atari/combat_tank_v2.py index 3f3aaa61d..fe1a96b52 100644 --- a/pettingzoo/atari/combat_tank_v2.py +++ b/pettingzoo/atari/combat_tank_v2.py @@ -1 +1 @@ -from .combat_tank.combat_tank import env, raw_env, parallel_env # noqa: F401 +from .combat_tank.combat_tank import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/double_dunk_v3.py b/pettingzoo/atari/double_dunk_v3.py index 347be1242..e4a88f287 100644 --- a/pettingzoo/atari/double_dunk_v3.py +++ b/pettingzoo/atari/double_dunk_v3.py @@ -1 +1 @@ -from .double_dunk.double_dunk import env, raw_env, parallel_env # noqa: F401 +from .double_dunk.double_dunk import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/entombed_competitive_v3.py b/pettingzoo/atari/entombed_competitive_v3.py index c28330e0c..010f90cfa 100644 --- a/pettingzoo/atari/entombed_competitive_v3.py +++ b/pettingzoo/atari/entombed_competitive_v3.py @@ -1 +1,5 @@ -from .entombed_competitive.entombed_competitive import env, raw_env, parallel_env # noqa: F401 +from .entombed_competitive.entombed_competitive import ( # noqa: F401 + env, + parallel_env, + raw_env, +) diff --git a/pettingzoo/atari/entombed_cooperative_v3.py b/pettingzoo/atari/entombed_cooperative_v3.py index bdb548f4a..f024a12ef 100644 --- a/pettingzoo/atari/entombed_cooperative_v3.py +++ b/pettingzoo/atari/entombed_cooperative_v3.py @@ -1 +1 @@ -from .entombed_cooperative.entombed_cooperative import env, raw_env, parallel_env # noqa: F401 +from .entombed_cooperative.entombed_cooperative import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/flag_capture_v2.py b/pettingzoo/atari/flag_capture_v2.py index d901c3c8d..17127f742 100644 --- a/pettingzoo/atari/flag_capture_v2.py +++ b/pettingzoo/atari/flag_capture_v2.py @@ -1 +1 @@ -from .flag_capture.flag_capture import env, raw_env, parallel_env # noqa: F401 +from .flag_capture.flag_capture import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/foozpong_v3.py b/pettingzoo/atari/foozpong_v3.py index a871c658b..56001c341 100644 --- a/pettingzoo/atari/foozpong_v3.py +++ b/pettingzoo/atari/foozpong_v3.py @@ -1 +1 @@ -from .foozpong.foozpong import env, raw_env, parallel_env # noqa: F401 +from .foozpong.foozpong import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/ice_hockey_v2.py b/pettingzoo/atari/ice_hockey_v2.py index 48b3a2c2c..b49c212c0 100644 --- a/pettingzoo/atari/ice_hockey_v2.py +++ b/pettingzoo/atari/ice_hockey_v2.py @@ -1 +1 @@ -from .ice_hockey.ice_hockey import env, raw_env, parallel_env # noqa: F401 +from .ice_hockey.ice_hockey import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/joust_v3.py b/pettingzoo/atari/joust_v3.py index e3597bc19..84f73c833 100644 --- a/pettingzoo/atari/joust_v3.py +++ b/pettingzoo/atari/joust_v3.py @@ -1 +1 @@ -from .joust.joust import env, raw_env, parallel_env # noqa: F401 +from .joust.joust import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/mario_bros_v3.py b/pettingzoo/atari/mario_bros_v3.py index 99aeb8fe3..ef8749aa7 100644 --- a/pettingzoo/atari/mario_bros_v3.py +++ b/pettingzoo/atari/mario_bros_v3.py @@ -1 +1 @@ -from .mario_bros.mario_bros import env, raw_env, parallel_env # noqa: F401 +from .mario_bros.mario_bros import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/maze_craze/maze_craze.py b/pettingzoo/atari/maze_craze/maze_craze.py new file mode 100644 index 000000000..881c70851 --- /dev/null +++ b/pettingzoo/atari/maze_craze/maze_craze.py @@ -0,0 +1,36 @@ +import os +import warnings + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + +avaliable_versions = { + "robbers": 2, + "race": 1, + "capture": 12, +} + + +def raw_env(game_version="robbers", visibilty_level=0, **kwargs): + if game_version == "robbers" and visibilty_level == 0: + warnings.warn( + "maze_craze has different versions of the game via the `game_version` argument, consider overriding." + ) + assert ( + game_version in avaliable_versions + ), f"`game_version` parameter must be one of {avaliable_versions.keys()}" + assert ( + 0 <= visibilty_level < 4 + ), "visibility level must be between 0 and 4, where 0 is 100% visibility and 3 is 0% visibility" + base_mode = (avaliable_versions[game_version] - 1) * 4 + mode = base_mode + visibilty_level + return BaseAtariEnv( + game="maze_craze", + num_players=2, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs, + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/maze_craze_v3.py b/pettingzoo/atari/maze_craze_v3.py index 4fe65eb34..d43822636 100644 --- a/pettingzoo/atari/maze_craze_v3.py +++ b/pettingzoo/atari/maze_craze_v3.py @@ -1,36 +1 @@ -import os -import warnings - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - -avaliable_versions = { - "robbers": 2, - "race": 1, - "capture": 12, -} - - -def raw_env(game_version="robbers", visibilty_level=0, **kwargs): - if game_version == "robbers" and visibilty_level == 0: - warnings.warn( - "maze_craze has different versions of the game via the `game_version` argument, consider overriding." - ) - assert ( - game_version in avaliable_versions - ), f"`game_version` parameter must be one of {avaliable_versions.keys()}" - assert ( - 0 <= visibilty_level < 4 - ), "visibility level must be between 0 and 4, where 0 is 100% visibility and 3 is 0% visibility" - base_mode = (avaliable_versions[game_version] - 1) * 4 - mode = base_mode + visibilty_level - return BaseAtariEnv( - game="maze_craze", - num_players=2, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs, - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .maze_craze.maze_craze import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/othello/othello.py b/pettingzoo/atari/othello/othello.py new file mode 100644 index 000000000..3b0103555 --- /dev/null +++ b/pettingzoo/atari/othello/othello.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="othello", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/othello_v3.py b/pettingzoo/atari/othello_v3.py index db31958a0..45b43afa5 100644 --- a/pettingzoo/atari/othello_v3.py +++ b/pettingzoo/atari/othello_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="othello", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .othello.othello import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/pong/pong.py b/pettingzoo/atari/pong/pong.py new file mode 100644 index 000000000..e3a97b808 --- /dev/null +++ b/pettingzoo/atari/pong/pong.py @@ -0,0 +1,45 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + +avaliable_2p_versions = { + "classic": 4, + "two_paddles": 10, + "soccer": 14, + "foozpong": 19, + "hockey": 27, + "handball": 35, + "volleyball": 39, + "basketball": 45, +} +avaliable_4p_versions = { + "classic": 6, + "two_paddles": 11, + "soccer": 16, + "foozpong": 21, + "hockey": 29, + "quadrapong": 33, + "handball": 37, + "volleyball": 41, + "basketball": 49, +} + + +def raw_env(num_players=2, game_version="classic", **kwargs): + assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" + versions = avaliable_2p_versions if num_players == 2 else avaliable_4p_versions + assert ( + game_version in versions + ), f"pong version {game_version} not supported for number of players {num_players}. Available options are {list(versions)}" + mode = versions[game_version] + return BaseAtariEnv( + game="pong", + num_players=num_players, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs, + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/pong_v3.py b/pettingzoo/atari/pong_v3.py index e4ce78c74..0d46176b8 100644 --- a/pettingzoo/atari/pong_v3.py +++ b/pettingzoo/atari/pong_v3.py @@ -1,45 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - -avaliable_2p_versions = { - "classic": 4, - "two_paddles": 10, - "soccer": 14, - "foozpong": 19, - "hockey": 27, - "handball": 35, - "volleyball": 39, - "basketball": 45, -} -avaliable_4p_versions = { - "classic": 6, - "two_paddles": 11, - "soccer": 16, - "foozpong": 21, - "hockey": 29, - "quadrapong": 33, - "handball": 37, - "volleyball": 41, - "basketball": 49, -} - - -def raw_env(num_players=2, game_version="classic", **kwargs): - assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" - versions = avaliable_2p_versions if num_players == 2 else avaliable_4p_versions - assert ( - game_version in versions - ), f"pong version {game_version} not supported for number of players {num_players}. Available options are {list(versions)}" - mode = versions[game_version] - return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs, - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .pong.pong import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/quadrapong/quadrapong.py b/pettingzoo/atari/quadrapong/quadrapong.py new file mode 100644 index 000000000..f3583e48a --- /dev/null +++ b/pettingzoo/atari/quadrapong/quadrapong.py @@ -0,0 +1,19 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + mode = 33 + num_players = 4 + return BaseAtariEnv( + game="pong", + num_players=num_players, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/quadrapong_v4.py b/pettingzoo/atari/quadrapong_v4.py index f8d2ed9e5..59e8e96d0 100644 --- a/pettingzoo/atari/quadrapong_v4.py +++ b/pettingzoo/atari/quadrapong_v4.py @@ -1,19 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - mode = 33 - num_players = 4 - return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .quadrapong.quadrapong import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/space_invaders/space_invaders.py b/pettingzoo/atari/space_invaders/space_invaders.py new file mode 100644 index 000000000..5839dfe62 --- /dev/null +++ b/pettingzoo/atari/space_invaders/space_invaders.py @@ -0,0 +1,31 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env( + alternating_control=False, + moving_shields=True, + zigzaging_bombs=False, + fast_bomb=False, + invisible_invaders=False, + **kwargs +): + mode = 33 + ( + moving_shields * 1 + + zigzaging_bombs * 2 + + fast_bomb * 4 + + invisible_invaders * 8 + + alternating_control * 16 + ) + return BaseAtariEnv( + game="space_invaders", + num_players=2, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/space_invaders_v2.py b/pettingzoo/atari/space_invaders_v2.py index 3ea314ecf..6b8f93b84 100644 --- a/pettingzoo/atari/space_invaders_v2.py +++ b/pettingzoo/atari/space_invaders_v2.py @@ -1,31 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env( - alternating_control=False, - moving_shields=True, - zigzaging_bombs=False, - fast_bomb=False, - invisible_invaders=False, - **kwargs -): - mode = 33 + ( - moving_shields * 1 - + zigzaging_bombs * 2 - + fast_bomb * 4 - + invisible_invaders * 8 - + alternating_control * 16 - ) - return BaseAtariEnv( - game="space_invaders", - num_players=2, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .space_invaders.space_invaders import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/space_war/space_war.py b/pettingzoo/atari/space_war/space_war.py new file mode 100644 index 000000000..3173f0838 --- /dev/null +++ b/pettingzoo/atari/space_war/space_war.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="space_war", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/space_war_v2.py b/pettingzoo/atari/space_war_v2.py index fc09e4430..504588c8c 100644 --- a/pettingzoo/atari/space_war_v2.py +++ b/pettingzoo/atari/space_war_v2.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="space_war", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .space_war.space_war import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/surround/surround.py b/pettingzoo/atari/surround/surround.py new file mode 100644 index 000000000..59d6ead55 --- /dev/null +++ b/pettingzoo/atari/surround/surround.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="surround", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/surround_v2.py b/pettingzoo/atari/surround_v2.py index d756f71c6..2e8e332f7 100644 --- a/pettingzoo/atari/surround_v2.py +++ b/pettingzoo/atari/surround_v2.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="surround", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .surround.surround import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/tennis/tennis.py b/pettingzoo/atari/tennis/tennis.py new file mode 100644 index 000000000..864a43d4a --- /dev/null +++ b/pettingzoo/atari/tennis/tennis.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="tennis", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/tennis_v3.py b/pettingzoo/atari/tennis_v3.py index 7f255fcee..6e8e5c608 100644 --- a/pettingzoo/atari/tennis_v3.py +++ b/pettingzoo/atari/tennis_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="tennis", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .tennis.tennis import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/video_checkers/video_checkers.py b/pettingzoo/atari/video_checkers/video_checkers.py new file mode 100644 index 000000000..871c6a6b6 --- /dev/null +++ b/pettingzoo/atari/video_checkers/video_checkers.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="video_checkers", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/video_checkers_v4.py b/pettingzoo/atari/video_checkers_v4.py index a8d518ccf..da7e82ff7 100644 --- a/pettingzoo/atari/video_checkers_v4.py +++ b/pettingzoo/atari/video_checkers_v4.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="video_checkers", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .video_checkers.video_checkers import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/volleyball_pong/volleyball_pong.py b/pettingzoo/atari/volleyball_pong/volleyball_pong.py new file mode 100644 index 000000000..12ceef78f --- /dev/null +++ b/pettingzoo/atari/volleyball_pong/volleyball_pong.py @@ -0,0 +1,20 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(num_players=4, **kwargs): + assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" + mode_mapping = {2: 39, 4: 41} + mode = mode_mapping[num_players] + return BaseAtariEnv( + game="pong", + num_players=num_players, + mode_num=mode, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/volleyball_pong_v3.py b/pettingzoo/atari/volleyball_pong_v3.py index 6d3814896..84b9bd1c8 100644 --- a/pettingzoo/atari/volleyball_pong_v3.py +++ b/pettingzoo/atari/volleyball_pong_v3.py @@ -1,20 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(num_players=4, **kwargs): - assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" - mode_mapping = {2: 39, 4: 41} - mode = mode_mapping[num_players] - return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .volleyball_pong.volleyball_pong import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/warlords/warlords.py b/pettingzoo/atari/warlords/warlords.py new file mode 100644 index 000000000..89f57b29a --- /dev/null +++ b/pettingzoo/atari/warlords/warlords.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="warlords", + num_players=4, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/warlords_v3.py b/pettingzoo/atari/warlords_v3.py index ea3718515..e25b7bdeb 100644 --- a/pettingzoo/atari/warlords_v3.py +++ b/pettingzoo/atari/warlords_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="warlords", - num_players=4, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .warlords.warlords import env, parallel_env, raw_env # noqa: F401 diff --git a/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py b/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py new file mode 100644 index 000000000..a04878095 --- /dev/null +++ b/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py @@ -0,0 +1,17 @@ +import os + +from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn + + +def raw_env(**kwargs): + return BaseAtariEnv( + game="wizard_of_wor", + num_players=2, + mode_num=None, + env_name=os.path.basename(__file__)[:-3], + **kwargs + ) + + +env = base_env_wrapper_fn(raw_env) +parallel_env = parallel_wrapper_fn(env) diff --git a/pettingzoo/atari/wizard_of_wor_v3.py b/pettingzoo/atari/wizard_of_wor_v3.py index 5433f936d..944435c6e 100644 --- a/pettingzoo/atari/wizard_of_wor_v3.py +++ b/pettingzoo/atari/wizard_of_wor_v3.py @@ -1,17 +1 @@ -import os - -from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - - -def raw_env(**kwargs): - return BaseAtariEnv( - game="wizard_of_wor", - num_players=2, - mode_num=None, - env_name=os.path.basename(__file__)[:-3], - **kwargs - ) - - -env = base_env_wrapper_fn(raw_env) -parallel_env = parallel_wrapper_fn(env) +from .wizard_of_wor.wizard_of_wor import env, parallel_env, raw_env # noqa: F401 From c70ffe41cd1269f5c0dfc6bbed2d6089bff0cf6d Mon Sep 17 00:00:00 2001 From: RushivArora Date: Thu, 9 Jun 2022 18:24:23 -0400 Subject: [PATCH 3/5] Minor Change --- pettingzoo/atari/entombed_cooperative_v3.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pettingzoo/atari/entombed_cooperative_v3.py b/pettingzoo/atari/entombed_cooperative_v3.py index f024a12ef..c8aa70173 100644 --- a/pettingzoo/atari/entombed_cooperative_v3.py +++ b/pettingzoo/atari/entombed_cooperative_v3.py @@ -1 +1,5 @@ -from .entombed_cooperative.entombed_cooperative import env, parallel_env, raw_env # noqa: F401 +from .entombed_cooperative.entombed_cooperative import ( # noqa: F401 + env, + parallel_env, + raw_env, +) From caed1fe78438ec0b71ad9dd0e6560e8103251500 Mon Sep 17 00:00:00 2001 From: RushivArora Date: Tue, 21 Jun 2022 01:08:45 -0400 Subject: [PATCH 4/5] Fixed Atari Pull --- pettingzoo/atari/basketball_pong/basketball_pong.py | 7 ++++++- pettingzoo/atari/boxing/boxing.py | 8 ++++++-- pettingzoo/atari/combat_plane/combat_plane.py | 8 ++++++-- pettingzoo/atari/combat_tank/combat_tank.py | 8 ++++++-- pettingzoo/atari/double_dunk/double_dunk.py | 8 ++++++-- .../atari/entombed_competitive/entombed_competitive.py | 8 ++++++-- .../atari/entombed_cooperative/entombed_cooperative.py | 8 ++++++-- pettingzoo/atari/flag_capture/flag_capture.py | 8 ++++++-- pettingzoo/atari/foozpong/foozpong.py | 8 ++++++-- pettingzoo/atari/ice_hockey/ice_hockey.py | 8 ++++++-- pettingzoo/atari/joust/joust.py | 8 ++++++-- pettingzoo/atari/mario_bros/mario_bros.py | 8 ++++++-- pettingzoo/atari/maze_craze/maze_craze.py | 7 ++++++- pettingzoo/atari/othello/othello.py | 8 ++++++-- pettingzoo/atari/pong/pong.py | 7 ++++++- pettingzoo/atari/quadrapong/quadrapong.py | 8 ++++++-- pettingzoo/atari/space_invaders/space_invaders.py | 8 ++++++-- pettingzoo/atari/space_war/space_war.py | 8 ++++++-- pettingzoo/atari/surround/surround.py | 8 ++++++-- pettingzoo/atari/tennis/tennis.py | 8 ++++++-- pettingzoo/atari/video_checkers/video_checkers.py | 8 ++++++-- pettingzoo/atari/volleyball_pong/volleyball_pong.py | 8 ++++++-- pettingzoo/atari/warlords/warlords.py | 8 ++++++-- pettingzoo/atari/wizard_of_wor/wizard_of_wor.py | 8 ++++++-- 24 files changed, 144 insertions(+), 45 deletions(-) diff --git a/pettingzoo/atari/basketball_pong/basketball_pong.py b/pettingzoo/atari/basketball_pong/basketball_pong.py index 5e12f9992..8efd354af 100644 --- a/pettingzoo/atari/basketball_pong/basketball_pong.py +++ b/pettingzoo/atari/basketball_pong/basketball_pong.py @@ -1,17 +1,22 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn +from glob import glob def raw_env(num_players=2, **kwargs): assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" mode_mapping = {2: 45, 4: 49} mode = mode_mapping[num_players] + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="pong", num_players=num_players, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/boxing/boxing.py b/pettingzoo/atari/boxing/boxing.py index c80e724f1..6fbcdf2d6 100644 --- a/pettingzoo/atari/boxing/boxing.py +++ b/pettingzoo/atari/boxing/boxing.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="boxing", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/combat_plane/combat_plane.py b/pettingzoo/atari/combat_plane/combat_plane.py index 4d603b8fb..9e8a4792f 100644 --- a/pettingzoo/atari/combat_plane/combat_plane.py +++ b/pettingzoo/atari/combat_plane/combat_plane.py @@ -1,6 +1,7 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn +from glob import glob avaliable_versions = { "bi-plane": 15, @@ -13,12 +14,15 @@ def raw_env(game_version="bi-plane", guided_missile=True, **kwargs): game_version in avaliable_versions ), "game_version must be either 'jet' or 'bi-plane'" mode = avaliable_versions[game_version] + (0 if guided_missile else 1) - + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="combat", num_players=2, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/combat_tank/combat_tank.py b/pettingzoo/atari/combat_tank/combat_tank.py index 3dc29694d..6e2a3933a 100644 --- a/pettingzoo/atari/combat_tank/combat_tank.py +++ b/pettingzoo/atari/combat_tank/combat_tank.py @@ -2,6 +2,7 @@ import warnings from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn +from glob import glob def raw_env(has_maze=True, is_invisible=False, billiard_hit=True, **kwargs): @@ -16,12 +17,15 @@ def raw_env(has_maze=True, is_invisible=False, billiard_hit=True, **kwargs): (True, True): 13, } mode = start_mapping[(is_invisible, billiard_hit)] + has_maze - + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="combat", num_players=2, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/double_dunk/double_dunk.py b/pettingzoo/atari/double_dunk/double_dunk.py index 4c4e60d6c..8298a2e9e 100644 --- a/pettingzoo/atari/double_dunk/double_dunk.py +++ b/pettingzoo/atari/double_dunk/double_dunk.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="double_dunk", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/entombed_competitive/entombed_competitive.py b/pettingzoo/atari/entombed_competitive/entombed_competitive.py index f2d7add8b..aa47ccdfb 100644 --- a/pettingzoo/atari/entombed_competitive/entombed_competitive.py +++ b/pettingzoo/atari/entombed_competitive/entombed_competitive.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="entombed", num_players=2, mode_num=2, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py b/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py index 6d4ad62cf..b9d732ed7 100644 --- a/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py +++ b/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="entombed", num_players=2, mode_num=3, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/flag_capture/flag_capture.py b/pettingzoo/atari/flag_capture/flag_capture.py index b27a4aa41..cbaf78e8b 100644 --- a/pettingzoo/atari/flag_capture/flag_capture.py +++ b/pettingzoo/atari/flag_capture/flag_capture.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="flag_capture", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/foozpong/foozpong.py b/pettingzoo/atari/foozpong/foozpong.py index 8a9ffa0f0..395613111 100644 --- a/pettingzoo/atari/foozpong/foozpong.py +++ b/pettingzoo/atari/foozpong/foozpong.py @@ -1,17 +1,21 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(num_players=4, **kwargs): assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" mode_mapping = {2: 19, 4: 21} mode = mode_mapping[num_players] + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="pong", num_players=num_players, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/ice_hockey/ice_hockey.py b/pettingzoo/atari/ice_hockey/ice_hockey.py index ac5d0bb54..0b552383a 100644 --- a/pettingzoo/atari/ice_hockey/ice_hockey.py +++ b/pettingzoo/atari/ice_hockey/ice_hockey.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="ice_hockey", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/joust/joust.py b/pettingzoo/atari/joust/joust.py index 7df613348..6f551d32c 100644 --- a/pettingzoo/atari/joust/joust.py +++ b/pettingzoo/atari/joust/joust.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="joust", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/mario_bros/mario_bros.py b/pettingzoo/atari/mario_bros/mario_bros.py index 336229074..455c149f5 100644 --- a/pettingzoo/atari/mario_bros/mario_bros.py +++ b/pettingzoo/atari/mario_bros/mario_bros.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="mario_bros", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/maze_craze/maze_craze.py b/pettingzoo/atari/maze_craze/maze_craze.py index 881c70851..1fa396882 100644 --- a/pettingzoo/atari/maze_craze/maze_craze.py +++ b/pettingzoo/atari/maze_craze/maze_craze.py @@ -2,6 +2,7 @@ import warnings from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn +from glob import glob avaliable_versions = { "robbers": 2, @@ -23,11 +24,15 @@ def raw_env(game_version="robbers", visibilty_level=0, **kwargs): ), "visibility level must be between 0 and 4, where 0 is 100% visibility and 3 is 0% visibility" base_mode = (avaliable_versions[game_version] - 1) * 4 mode = base_mode + visibilty_level + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="maze_craze", num_players=2, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs, ) diff --git a/pettingzoo/atari/othello/othello.py b/pettingzoo/atari/othello/othello.py index 3b0103555..1c619be6f 100644 --- a/pettingzoo/atari/othello/othello.py +++ b/pettingzoo/atari/othello/othello.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="othello", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/pong/pong.py b/pettingzoo/atari/pong/pong.py index e3a97b808..57fdf3462 100644 --- a/pettingzoo/atari/pong/pong.py +++ b/pettingzoo/atari/pong/pong.py @@ -1,6 +1,7 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn +from glob import glob avaliable_2p_versions = { "classic": 4, @@ -32,11 +33,15 @@ def raw_env(num_players=2, game_version="classic", **kwargs): game_version in versions ), f"pong version {game_version} not supported for number of players {num_players}. Available options are {list(versions)}" mode = versions[game_version] + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="pong", num_players=num_players, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs, ) diff --git a/pettingzoo/atari/quadrapong/quadrapong.py b/pettingzoo/atari/quadrapong/quadrapong.py index f3583e48a..3ac3184c8 100644 --- a/pettingzoo/atari/quadrapong/quadrapong.py +++ b/pettingzoo/atari/quadrapong/quadrapong.py @@ -1,16 +1,20 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): mode = 33 num_players = 4 + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="pong", num_players=num_players, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/space_invaders/space_invaders.py b/pettingzoo/atari/space_invaders/space_invaders.py index 5839dfe62..b4521fcd0 100644 --- a/pettingzoo/atari/space_invaders/space_invaders.py +++ b/pettingzoo/atari/space_invaders/space_invaders.py @@ -1,7 +1,7 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env( alternating_control=False, @@ -18,11 +18,15 @@ def raw_env( + invisible_invaders * 8 + alternating_control * 16 ) + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="space_invaders", num_players=2, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/space_war/space_war.py b/pettingzoo/atari/space_war/space_war.py index 3173f0838..ffab0767c 100644 --- a/pettingzoo/atari/space_war/space_war.py +++ b/pettingzoo/atari/space_war/space_war.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="space_war", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/surround/surround.py b/pettingzoo/atari/surround/surround.py index 59d6ead55..9cf1a3bbe 100644 --- a/pettingzoo/atari/surround/surround.py +++ b/pettingzoo/atari/surround/surround.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="surround", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/tennis/tennis.py b/pettingzoo/atari/tennis/tennis.py index 864a43d4a..52f1e6353 100644 --- a/pettingzoo/atari/tennis/tennis.py +++ b/pettingzoo/atari/tennis/tennis.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="tennis", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/video_checkers/video_checkers.py b/pettingzoo/atari/video_checkers/video_checkers.py index 871c6a6b6..d3f5b1af2 100644 --- a/pettingzoo/atari/video_checkers/video_checkers.py +++ b/pettingzoo/atari/video_checkers/video_checkers.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="video_checkers", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/volleyball_pong/volleyball_pong.py b/pettingzoo/atari/volleyball_pong/volleyball_pong.py index 12ceef78f..06449fdb3 100644 --- a/pettingzoo/atari/volleyball_pong/volleyball_pong.py +++ b/pettingzoo/atari/volleyball_pong/volleyball_pong.py @@ -1,17 +1,21 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(num_players=4, **kwargs): assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" mode_mapping = {2: 39, 4: 41} mode = mode_mapping[num_players] + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="pong", num_players=num_players, mode_num=mode, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/warlords/warlords.py b/pettingzoo/atari/warlords/warlords.py index 89f57b29a..3ee5f7ae3 100644 --- a/pettingzoo/atari/warlords/warlords.py +++ b/pettingzoo/atari/warlords/warlords.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="warlords", num_players=4, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) diff --git a/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py b/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py index a04878095..8742d81a1 100644 --- a/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py +++ b/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py @@ -1,14 +1,18 @@ import os from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn - +from glob import glob def raw_env(**kwargs): + name = os.path.basename(__file__).split(".")[0] + parent_file = glob('./pettingzoo/atari/' + name + '*.py') + version_num = parent_file[0].split('_')[-1].split('.')[0] + name = name + "_" + version_num return BaseAtariEnv( game="wizard_of_wor", num_players=2, mode_num=None, - env_name=os.path.basename(__file__)[:-3], + env_name=name, **kwargs ) From a37b6710c2393429c53f36772645f9e18560c98d Mon Sep 17 00:00:00 2001 From: RushivArora Date: Tue, 21 Jun 2022 01:11:43 -0400 Subject: [PATCH 5/5] Fix Precommit --- .../atari/basketball_pong/basketball_pong.py | 12 ++++-------- pettingzoo/atari/boxing/boxing.py | 13 +++++-------- pettingzoo/atari/combat_plane/combat_plane.py | 12 ++++-------- pettingzoo/atari/combat_tank/combat_tank.py | 14 +++++--------- pettingzoo/atari/double_dunk/double_dunk.py | 13 +++++-------- .../entombed_competitive/entombed_competitive.py | 13 +++++-------- .../entombed_cooperative/entombed_cooperative.py | 13 +++++-------- pettingzoo/atari/flag_capture/flag_capture.py | 13 +++++-------- pettingzoo/atari/foozpong/foozpong.py | 13 +++++-------- pettingzoo/atari/ice_hockey/ice_hockey.py | 13 +++++-------- pettingzoo/atari/joust/joust.py | 13 +++++-------- pettingzoo/atari/mario_bros/mario_bros.py | 13 +++++-------- pettingzoo/atari/maze_craze/maze_craze.py | 6 +++--- pettingzoo/atari/othello/othello.py | 13 +++++-------- pettingzoo/atari/pong/pong.py | 6 +++--- pettingzoo/atari/quadrapong/quadrapong.py | 13 +++++-------- pettingzoo/atari/space_invaders/space_invaders.py | 13 +++++-------- pettingzoo/atari/space_war/space_war.py | 13 +++++-------- pettingzoo/atari/surround/surround.py | 13 +++++-------- pettingzoo/atari/tennis/tennis.py | 13 +++++-------- pettingzoo/atari/video_checkers/video_checkers.py | 13 +++++-------- .../atari/volleyball_pong/volleyball_pong.py | 13 +++++-------- pettingzoo/atari/warlords/warlords.py | 13 +++++-------- pettingzoo/atari/wizard_of_wor/wizard_of_wor.py | 13 +++++-------- 24 files changed, 114 insertions(+), 183 deletions(-) diff --git a/pettingzoo/atari/basketball_pong/basketball_pong.py b/pettingzoo/atari/basketball_pong/basketball_pong.py index 8efd354af..b019e5dc3 100644 --- a/pettingzoo/atari/basketball_pong/basketball_pong.py +++ b/pettingzoo/atari/basketball_pong/basketball_pong.py @@ -1,7 +1,7 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob def raw_env(num_players=2, **kwargs): @@ -9,15 +9,11 @@ def raw_env(num_players=2, **kwargs): mode_mapping = {2: 45, 4: 49} mode = mode_mapping[num_players] name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=name, - **kwargs + game="pong", num_players=num_players, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/boxing/boxing.py b/pettingzoo/atari/boxing/boxing.py index 6fbcdf2d6..82ac99206 100644 --- a/pettingzoo/atari/boxing/boxing.py +++ b/pettingzoo/atari/boxing/boxing.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="boxing", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="boxing", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/combat_plane/combat_plane.py b/pettingzoo/atari/combat_plane/combat_plane.py index 9e8a4792f..63820630e 100644 --- a/pettingzoo/atari/combat_plane/combat_plane.py +++ b/pettingzoo/atari/combat_plane/combat_plane.py @@ -1,7 +1,7 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob avaliable_versions = { "bi-plane": 15, @@ -15,15 +15,11 @@ def raw_env(game_version="bi-plane", guided_missile=True, **kwargs): ), "game_version must be either 'jet' or 'bi-plane'" mode = avaliable_versions[game_version] + (0 if guided_missile else 1) name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="combat", - num_players=2, - mode_num=mode, - env_name=name, - **kwargs + game="combat", num_players=2, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/combat_tank/combat_tank.py b/pettingzoo/atari/combat_tank/combat_tank.py index 6e2a3933a..634d7c100 100644 --- a/pettingzoo/atari/combat_tank/combat_tank.py +++ b/pettingzoo/atari/combat_tank/combat_tank.py @@ -1,8 +1,8 @@ import os import warnings +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob def raw_env(has_maze=True, is_invisible=False, billiard_hit=True, **kwargs): @@ -18,15 +18,11 @@ def raw_env(has_maze=True, is_invisible=False, billiard_hit=True, **kwargs): } mode = start_mapping[(is_invisible, billiard_hit)] + has_maze name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] - name = name + "_" + version_num + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] + name = name + "_" + version_num return BaseAtariEnv( - game="combat", - num_players=2, - mode_num=mode, - env_name=name, - **kwargs + game="combat", num_players=2, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/double_dunk/double_dunk.py b/pettingzoo/atari/double_dunk/double_dunk.py index 8298a2e9e..ad23b0378 100644 --- a/pettingzoo/atari/double_dunk/double_dunk.py +++ b/pettingzoo/atari/double_dunk/double_dunk.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="double_dunk", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="double_dunk", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/entombed_competitive/entombed_competitive.py b/pettingzoo/atari/entombed_competitive/entombed_competitive.py index aa47ccdfb..8becbda5d 100644 --- a/pettingzoo/atari/entombed_competitive/entombed_competitive.py +++ b/pettingzoo/atari/entombed_competitive/entombed_competitive.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="entombed", - num_players=2, - mode_num=2, - env_name=name, - **kwargs + game="entombed", num_players=2, mode_num=2, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py b/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py index b9d732ed7..b38b3c1de 100644 --- a/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py +++ b/pettingzoo/atari/entombed_cooperative/entombed_cooperative.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="entombed", - num_players=2, - mode_num=3, - env_name=name, - **kwargs + game="entombed", num_players=2, mode_num=3, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/flag_capture/flag_capture.py b/pettingzoo/atari/flag_capture/flag_capture.py index cbaf78e8b..f367523f7 100644 --- a/pettingzoo/atari/flag_capture/flag_capture.py +++ b/pettingzoo/atari/flag_capture/flag_capture.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="flag_capture", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="flag_capture", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/foozpong/foozpong.py b/pettingzoo/atari/foozpong/foozpong.py index 395613111..36d8e50c9 100644 --- a/pettingzoo/atari/foozpong/foozpong.py +++ b/pettingzoo/atari/foozpong/foozpong.py @@ -1,22 +1,19 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(num_players=4, **kwargs): assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" mode_mapping = {2: 19, 4: 21} mode = mode_mapping[num_players] name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=name, - **kwargs + game="pong", num_players=num_players, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/ice_hockey/ice_hockey.py b/pettingzoo/atari/ice_hockey/ice_hockey.py index 0b552383a..f51486c5d 100644 --- a/pettingzoo/atari/ice_hockey/ice_hockey.py +++ b/pettingzoo/atari/ice_hockey/ice_hockey.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="ice_hockey", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="ice_hockey", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/joust/joust.py b/pettingzoo/atari/joust/joust.py index 6f551d32c..de09e9f32 100644 --- a/pettingzoo/atari/joust/joust.py +++ b/pettingzoo/atari/joust/joust.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="joust", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="joust", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/mario_bros/mario_bros.py b/pettingzoo/atari/mario_bros/mario_bros.py index 455c149f5..949c869d8 100644 --- a/pettingzoo/atari/mario_bros/mario_bros.py +++ b/pettingzoo/atari/mario_bros/mario_bros.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="mario_bros", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="mario_bros", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/maze_craze/maze_craze.py b/pettingzoo/atari/maze_craze/maze_craze.py index 1fa396882..c202f028c 100644 --- a/pettingzoo/atari/maze_craze/maze_craze.py +++ b/pettingzoo/atari/maze_craze/maze_craze.py @@ -1,8 +1,8 @@ import os import warnings +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob avaliable_versions = { "robbers": 2, @@ -25,8 +25,8 @@ def raw_env(game_version="robbers", visibilty_level=0, **kwargs): base_mode = (avaliable_versions[game_version] - 1) * 4 mode = base_mode + visibilty_level name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( game="maze_craze", diff --git a/pettingzoo/atari/othello/othello.py b/pettingzoo/atari/othello/othello.py index 1c619be6f..687b4e52a 100644 --- a/pettingzoo/atari/othello/othello.py +++ b/pettingzoo/atari/othello/othello.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="othello", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="othello", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/pong/pong.py b/pettingzoo/atari/pong/pong.py index 57fdf3462..94656b776 100644 --- a/pettingzoo/atari/pong/pong.py +++ b/pettingzoo/atari/pong/pong.py @@ -1,7 +1,7 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob avaliable_2p_versions = { "classic": 4, @@ -34,8 +34,8 @@ def raw_env(num_players=2, game_version="classic", **kwargs): ), f"pong version {game_version} not supported for number of players {num_players}. Available options are {list(versions)}" mode = versions[game_version] name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( game="pong", diff --git a/pettingzoo/atari/quadrapong/quadrapong.py b/pettingzoo/atari/quadrapong/quadrapong.py index 3ac3184c8..6d8859160 100644 --- a/pettingzoo/atari/quadrapong/quadrapong.py +++ b/pettingzoo/atari/quadrapong/quadrapong.py @@ -1,21 +1,18 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): mode = 33 num_players = 4 name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=name, - **kwargs + game="pong", num_players=num_players, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/space_invaders/space_invaders.py b/pettingzoo/atari/space_invaders/space_invaders.py index b4521fcd0..4dfaf79f2 100644 --- a/pettingzoo/atari/space_invaders/space_invaders.py +++ b/pettingzoo/atari/space_invaders/space_invaders.py @@ -1,7 +1,8 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env( alternating_control=False, @@ -19,15 +20,11 @@ def raw_env( + alternating_control * 16 ) name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="space_invaders", - num_players=2, - mode_num=mode, - env_name=name, - **kwargs + game="space_invaders", num_players=2, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/space_war/space_war.py b/pettingzoo/atari/space_war/space_war.py index ffab0767c..2700ec6eb 100644 --- a/pettingzoo/atari/space_war/space_war.py +++ b/pettingzoo/atari/space_war/space_war.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="space_war", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="space_war", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/surround/surround.py b/pettingzoo/atari/surround/surround.py index 9cf1a3bbe..2b85f01c3 100644 --- a/pettingzoo/atari/surround/surround.py +++ b/pettingzoo/atari/surround/surround.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="surround", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="surround", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/tennis/tennis.py b/pettingzoo/atari/tennis/tennis.py index 52f1e6353..4adcbd6e5 100644 --- a/pettingzoo/atari/tennis/tennis.py +++ b/pettingzoo/atari/tennis/tennis.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="tennis", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="tennis", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/video_checkers/video_checkers.py b/pettingzoo/atari/video_checkers/video_checkers.py index d3f5b1af2..0d33b5c3d 100644 --- a/pettingzoo/atari/video_checkers/video_checkers.py +++ b/pettingzoo/atari/video_checkers/video_checkers.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="video_checkers", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="video_checkers", num_players=2, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/volleyball_pong/volleyball_pong.py b/pettingzoo/atari/volleyball_pong/volleyball_pong.py index 06449fdb3..f15f169be 100644 --- a/pettingzoo/atari/volleyball_pong/volleyball_pong.py +++ b/pettingzoo/atari/volleyball_pong/volleyball_pong.py @@ -1,22 +1,19 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(num_players=4, **kwargs): assert num_players == 2 or num_players == 4, "pong only supports 2 or 4 players" mode_mapping = {2: 39, 4: 41} mode = mode_mapping[num_players] name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="pong", - num_players=num_players, - mode_num=mode, - env_name=name, - **kwargs + game="pong", num_players=num_players, mode_num=mode, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/warlords/warlords.py b/pettingzoo/atari/warlords/warlords.py index 3ee5f7ae3..67567d36e 100644 --- a/pettingzoo/atari/warlords/warlords.py +++ b/pettingzoo/atari/warlords/warlords.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="warlords", - num_players=4, - mode_num=None, - env_name=name, - **kwargs + game="warlords", num_players=4, mode_num=None, env_name=name, **kwargs ) diff --git a/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py b/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py index 8742d81a1..2f93c0ccc 100644 --- a/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py +++ b/pettingzoo/atari/wizard_of_wor/wizard_of_wor.py @@ -1,19 +1,16 @@ import os +from glob import glob from ..base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn -from glob import glob + def raw_env(**kwargs): name = os.path.basename(__file__).split(".")[0] - parent_file = glob('./pettingzoo/atari/' + name + '*.py') - version_num = parent_file[0].split('_')[-1].split('.')[0] + parent_file = glob("./pettingzoo/atari/" + name + "*.py") + version_num = parent_file[0].split("_")[-1].split(".")[0] name = name + "_" + version_num return BaseAtariEnv( - game="wizard_of_wor", - num_players=2, - mode_num=None, - env_name=name, - **kwargs + game="wizard_of_wor", num_players=2, mode_num=None, env_name=name, **kwargs )