NUM_PLAYERS = 16
NUM_BERRY_TYPES = 3
DEFAULT_ASCII_MAP = """
333PPPP12PPP322P32PPP1P13P3P3
1PPPP2PP122PPP3P232121P2PP2P1
P1P3P11PPP13PPP31PPPP23PPPPPP
PPPPP2P2P1P2P3P33P23PP2P2PPPP
P1PPPPPPP2PPP12311PP3321PPPPP
133P2PP2PPP3PPP1PPP2213P112P1
3PPPPPPPPPPPPP31PPPPPP1P3112P
PP2P21P21P33PPPPPPP3PP2PPPP1P
PPPPP1P1P32P3PPP22PP1P2PPPP2P
PPP3PP3122211PPP2113P3PPP1332
PP12132PP1PP1P321PP1PPPPPP1P3
PPP222P12PPPP1PPPP1PPP321P11P
PPP2PPPP3P2P1PPP1P23322PP1P13
23PPP2PPPP2P3PPPP3PP3PPP3PPP2
2PPPP3P3P3PP3PP3P1P3PP11P21P1
21PPP2PP331PP3PPP2PPPPP2PP3PP
P32P2PP2P1PPPPPPP12P2PPP1PPPP
P3PP3P2P21P3PP2PP11PP1323P312
2P1PPPPP1PPP1P2PPP3P32P2P331P
PPPPP1312P3P2PPPP3P32PPPP2P11
P3PPPP221PPP2PPPPPPPP1PPP311P
32P3PPPPPPPPPP31PPPP3PPP13PPP
PPP3PPPPP3PPPPPP232P13PPPPP1P
P1PP1PPP2PP3PPPPP33321PP2P3PP
P13PPPP1P333PPPP2PP213PP2P3PP
1PPPPP3PP2P1PP21P3PPPP231P2PP
1331P2P12P2PPPP2PPP3P23P21PPP
P3P131P3PPP13P1PPP222PPPP11PP
2P3PPPPPPPP2P323PPP2PPP1PPP2P
21PPPPPPP12P23P1PPPPPP13P3P11
"""
MARKING_LEVEL_1 = """
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
"""
MARKING_LEVEL_2 = """
xxxxxx****xxxxxx
xxxxxx****xxxxxx
xxxxxx****xxxxxx
xxxxxx****xxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
"""
MARKING_LEVEL_3 = """
xxxx********xxxx
xxxx********xxxx
xxxx********xxxx
xxxx********xxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxx**xxxx**xxxx
xxxx**xxxx**xxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxx**xxxx**xxxx
xxxx**xxxx**xxxx
"""
CHAR_PREFAB_MAP = {
    "P": "spawn_point",
    "W": "wall",
    "1": "berry_1",
    "2": "berry_2",
    "3": "berry_3",
}
COLORS = [
    (200, 0, 0, 255),  # 'Red'
    (0, 200, 0, 255),  # 'Green'
    (0, 0, 200, 255),  # 'Blue'
]
_NUM_DIRECTIONS = 4  # NESW
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
        },
        {
            "component": "Appearance",
            "kwargs": {
                "spriteNames": ["Wall"],
                # This color is a dark shade of purple.
                "spriteRGBColors": [(66, 28, 82)]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "zapHit"
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "fire_1"
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "fire_2"
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "fire_3"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "logic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
        },
    ]
}
PREFABS = {
    "wall": WALL,
    "spawn_point": SPAWN_POINT,
    "berry_1": create_berry_prefab(1),
    "berry_2": create_berry_prefab(2),
    "berry_3": create_berry_prefab(3),
}
NUM_PLAYERS_UPPER_BOUND = 60
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
FORWARD    = {"move": 1, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
BACKWARD   = {"move": 3, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 0}
FIRE_ZAP   = {"move": 0, "turn":  0, "fireZap": 1, "fire_1": 0, "fire_2": 0, "fire_3": 0}
FIRE_ONE   = {"move": 0, "turn":  0, "fireZap": 0, "fire_1": 1, "fire_2": 0, "fire_3": 0}
FIRE_TWO   = {"move": 0, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 1, "fire_3": 0}
FIRE_THREE = {"move": 0, "turn":  0, "fireZap": 0, "fire_1": 0, "fire_2": 0, "fire_3": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    FIRE_ZAP,
    FIRE_ONE,
    FIRE_TWO,
    FIRE_THREE,
)
def create_berry_prefab(lua_index: int):
def create_avatar_object(player_idx: int) -> Dict[str, Any]:
def create_scene():
def create_marking_overlay(player_idx: int) -> Dict[str, Any]:
def create_colored_avatar_overlay(player_idx: int) -> Dict[str, Any]:
def create_avatar_and_associated_objects(num_players):
def create_lab2d_settings(
    ascii_map_string: str,
    num_players: int,
) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): NUM_RESOURCES = 3
RESOURCE1_COLOR = (255, 227, 11, 255)
RESOURCE1_HIGHLIGHT_COLOR = (255, 214, 91, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (109, 42, 255, 255)
RESOURCE2_HIGHLIGHT_COLOR = (132, 91, 255, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
RESOURCE3_COLOR = (42, 188, 255, 255)
RESOURCE3_HIGHLIGHT_COLOR = (91, 214, 255, 255)
RESOURCE3_COLOR_DATA = (RESOURCE3_COLOR, RESOURCE3_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPP      W W      PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
W             aa        W
W        11   aa        W
W        11             W
W        11             W
W    WW     W  222      W
WW    33    W  222      W
WWW   33  WWWWWWWWW     W
W     33    111       WWW
W           111         W
W       22 W            W
W       22 W   WW       W
W       22     W333     W
W               333     W
W          aa           W
WPPPP      aa       PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP         W     PPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "1": _resource_names[0],
    "2": _resource_names[1],
    "3": _resource_names[2],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         target_sprite_self: Dict[str, Any]) -> Dict[str, Any]:
def create_avatar_objects(num_players: int) -> Sequence[PrefabConfig]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): NUM_RESOURCES = 2
RESOURCE1_COLOR = (123, 231, 255, 255)
RESOURCE1_HIGHLIGHT_COLOR = (157, 217, 230, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (255, 163, 123, 255)
RESOURCE2_HIGHLIGHT_COLOR = (230, 170, 157, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPP      W W      PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
W                       W
W        11             W
W        11             W
W        aa             W
W    WW     W  222      W
WW    1a    W  222      W
WWW   1a  WWWWWWWWW     W
W     1a    111       WWW
W           111         W
W       aa W            W
W       22 W   WW       W
W       22     Waaa     W
W               222     W
W                       W
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP         W     PPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "1": _resource_names[0],
    "2": _resource_names[1],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         color: Tuple[int, int, int],
                         row_player: bool) -> Dict[str, Any]:
def create_avatar_objects(num_players: int) -> Sequence[PrefabConfig]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): _COMPASS = ["N", "E", "S", "W"]
DEFAULT_ASCII_MAP = """
IIIIIIIIIIIIIIIIIIIIIII
IWWWWWWWWWWWWWWWWWWWWWI
IWPPP,PPPP,F,PPPP,PPPWI
IWPPP,,PP,,,,,PP,,PPPWI
IWPPP,,,,,,,,,,,,,PPPWI
IWP,,WW,,,,,,,,,WW,,PWI
IWHHWWW,WWWWWWW,WWWHHWI
IWHHW,D,,,,,,,,,D,WHHWI
IWHH,,W,,,WWW,,,W,,HHWI
IW,,,,W,,,,,,,,,W,,,,WI
IW,,,,WWW,,,,,WWW,,,,WI
IW,,,,,,,,,I,,,,,,,,,WI
IW,,,,WWW,,,,,WWW,,,,WI
IW,,,,W,,,,,,,,,W,,,,WI
IWHH,,W,,,WWW,,,W,,HHWI
IWHHW,D,,,,,,,,,D,WHHWI
IWHHWWW,WWWWWWW,WWWHHWI
IWQ,,WW,,,,,,,,,WW,,QWI
IWQQQ,,,,,,,,,,,,,QQQWI
IWQQQ,,QQ,,,,,QQ,,QQQWI
IWQQQ,QQQQ,G,QQQQ,QQQWI
IWWWWWWWWWWWWWWWWWWWWWI
IIIIIIIIIIIIIIIIIIIIIII
"""
CHAR_PREFAB_MAP = {
    "P": {"type": "all", "list": ["spawn_point_red", "ground"]},
    "Q": {"type": "all", "list": ["spawn_point_blue", "ground"]},
    "W": "wall",
    "D": {"type": "choice",
          "list": ["destroyable_wall"] * 9 + ["destroyed_wall"]},
    "H": {"type": "choice",
          "list": ["destroyable_wall"] * 3 + ["destroyed_wall"]},
    ",": "ground",
    "I": {"type": "all", "list": ["indicator", "indicator_frame"]},
    "F": {"type": "all", "list": ["ground", "home_tile_red", "flag_red"]},
    "G": {"type": "all", "list": ["ground", "home_tile_blue", "flag_blue"]},
}
RED_COLOR = (225, 55, 85, 255)
DARKER_RED_COLOR = (200, 35, 55, 255)
DARKEST_RED_COLOR = (160, 5, 25, 255)
BLUE_COLOR = (85, 55, 225, 255)
DARKER_BLUE_COLOR = (55, 35, 200, 255)
DARKEST_BLUE_COLOR = (25, 5, 160, 255)
PURPLE_COLOR = (107, 63, 160, 255)
TEAMS_DATA = {
    "red": {"color": RED_COLOR,
            "spawn_group": "{}SpawnPoints".format("red")},
    "blue": {"color": BLUE_COLOR,
             "spawn_group": "{}SpawnPoints".format("blue")},
}
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {"component": "Transform",},
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall",],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [True]
            }
        },
        {
            "component": "AllBeamBlocker",
            "kwargs": {}
        },
    ]
}
INDICATOR_FRAME = {
    "name": "indicator_frame",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "inert",
                "stateConfigs": [
                    {"state": "inert",
                     "layer": "superOverlay",
                     "sprite": "InertFrame"}
                ]
            }
        },
        {"component": "Transform",},
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["InertFrame"],
                "spriteShapes": [shapes.BUTTON],
                "palettes": [{"*": (0, 0, 0, 0),
                              "x": (55, 55, 55, 255),
                              "#": (0, 0, 0, 0)}],
                "noRotates": [True]
            }
        },
    ]
}
INDICATOR = {
    "name": "control_indicator",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "both",
                "stateConfigs": [
                    {
                        "state": "neither",
                        "layer": "background",
                        "sprite": "NeitherIndicator",
                    },
                    {
                        "state": "red",
                        "layer": "background",
                        "sprite": "RedIndicator",
                    },
                    {
                        "state": "blue",
                        "layer": "background",
                        "sprite": "BlueIndicator",
                    },
                    {
                        "state": "both",
                        "layer": "background",
                        "sprite": "BothIndicator",
                    },
                ]
            }
        },
        {"component": "Transform",},
        {
            "component": "Appearance",
            "kwargs": {
                "spriteNames": ["NeitherIndicator",
                                "RedIndicator",
                                "BlueIndicator",
                                "BothIndicator"],
                "spriteRGBColors": [(0, 0, 0, 0),
                                    DARKER_RED_COLOR,
                                    DARKER_BLUE_COLOR,
                                    PURPLE_COLOR]
            }
        },
        {"component": "ControlIndicator",},
    ]
}
PREFABS = {
    "wall": WALL,
    "spawn_point_red": create_spawn_point_prefab("red"),
    "spawn_point_blue": create_spawn_point_prefab("blue"),
    "destroyable_wall": create_destroyable_wall_prefab("destroyable"),
    "destroyed_wall": create_destroyable_wall_prefab("destroyed"),
    "ground": create_ground_prefab(),
    "indicator": INDICATOR,
    "indicator_frame": INDICATOR_FRAME,
    "flag_red": create_flag_prefab("red"),
    "flag_blue": create_flag_prefab("blue"),
    "home_tile_red": create_home_tile_prefab("red"),
    "home_tile_blue": create_home_tile_prefab("blue"),
}
NOOP       = {"move": 0, "turn":  0, "fireZap": 0}
FORWARD    = {"move": 1, "turn":  0, "fireZap": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "fireZap": 0}
BACKWARD   = {"move": 3, "turn":  0, "fireZap": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "fireZap": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "fireZap": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "fireZap": 0}
FIRE_ZAP   = {"move": 0, "turn":  0, "fireZap": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    FIRE_ZAP,
)
def multiply_tuple(color_tuple, factor):
def create_home_tile_prefab(team: str):
def create_ground_prefab():
def create_destroyable_wall_prefab(initial_state):
def create_spawn_point_prefab(team):
def create_flag_prefab(team: str):
def create_scene():
def create_avatar_object(
    player_idx: int,
    team: str,
    override_taste_kwargs: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
def _even_vs_odd_team_assignment(num_players,
                                 taste_kwargs: Optional[Any] = None):
def _low_vs_high_team_assignment(num_players,
                                 taste_kwargs: Optional[Any] = None):
def create_avatar_objects(num_players,
                          taste_kwargs: Optional[Any] = None,
                          fixed_teams: Optional[bool] = False):
def create_lab2d_settings(
    num_players: int,
    avatar_taste_kwargs: Optional[Any] = None,
    fixed_teams: Optional[bool] = False) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): DEFAULT_REWARDING_REACTIONS = {"MetabolizeFood1": 1,
                               "MetabolizeFood2": 1,
                               "MetabolizeXY": 10}
DEFAULT_REACTION_CONFIG = {"radius": 1, "query_type": "disc"}
REACTIVITY_LEVELS = {
    "ground": {"background": 0.00001,
               "low": 0.005,
               "medium": 0.001,
               "high": 0.9},
    "stomach": {"background": 0.0,
                "low": 0.0025,
                "medium": 0.25,
                "high": 0.9},
}
ASCII_MAP = """
~~~~~~~~~~~a~~~~~~~~~~~~~
~~~~~~~~c~~~~~~~~~~~~~~~~
~~~~~~~~~~~b~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~1~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
1~~3~~~~hhhhhhh~~~~~3~~2~
~~~~~~~~~~~~~~~~~~~~~~~~~
~2~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~c~~~~~~~~~~~~~~
~~~~~~~~~~~~a~~~~~~~~~~~~
~~~~~~~~~~b~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
"""
CHAR_PREFAB_MAP = {
    "~": "empty",
    "a": "ax",
    "b": "bx",
    "c": "cx",
    "1": "ay",
    "2": "by",
    "3": "cy",
    "h": "energy",
}
NUM_PLAYERS_UPPER_BOUND = 60
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "ioAction": 0}
FORWARD    = {"move": 1, "turn":  0, "ioAction": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "ioAction": 0}
BACKWARD   = {"move": 3, "turn":  0, "ioAction": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "ioAction": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "ioAction": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "ioAction": 0}
IO_ACTION  = {"move": 0, "turn":  0, "ioAction": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    IO_ACTION,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.AVATAR_DEFAULT,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": False,
}
def dissipate_when_paired(g, reaction_name, compound):
def cycle(g, reaction_prefix, intermediates, product, secondary_product=None,
          food="food"):
def make_graph():
def create_avatar_objects(prefabs, num_players):
def get_lab2d_settings(num_players):
def get_config(): NUM_RESOURCES = 2
RESOURCE1_COLOR = (30, 225, 185, 255)
RESOURCE1_HIGHLIGHT_COLOR = (98, 234, 206, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (225, 30, 70, 255)
RESOURCE2_HIGHLIGHT_COLOR = (234, 98, 126, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPP      W W      PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
W                       W
W        11             W
W        11             W
W        aa             W
W    WW     W  222      W
WW    1a    W  222      W
WWW   1a  WWWWWWWWW     W
W     1a    111       WWW
W           111         W
W       aa W            W
W       22 W   WW       W
W       22     Waaa     W
W               222     W
W                       W
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP         W     PPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "1": _resource_names[0],
    "2": _resource_names[1],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         target_sprite_self: Dict[str, Any]) -> Dict[str, Any]:
def create_avatar_objects(num_players: int) -> Sequence[PrefabConfig]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WHFFFHFFHFHFHFHFHFHFHHFHFFFHFW
WHFHFHFFHFHFHFHFHFHFHHFHFFFHFW
WHFFHFFHHFHFHFHFHFHFHHFHFFFHFW
WHFHFHFFHFHFHFHFHFHFHHFHFFFHFW
WHFFFFFFHFHFHFHFHFHFHHFHFFFHFW
W               HFHHHHHH     W
W   P    P          SSS      W
W     P     P   P   SS   P   W
W             P   PPSS       W
W   P    P          SS    P  W
W               P   SS P     W
W     P           P SS       W
W           P       SS  P    W
W  P             P PSS       W
W B B B B B B B B B SSB B B BW
WBBBBBBBBBBBBBBBBBBBBBBBBBBBBW
WBBBBBBBBBBBBBBBBBBBBBBBBBBBBW
WBBBBBBBBBBBBBBBBBBBBBBBBBBBBW
WBBBBBBBBBBBBBBBBBBBBBBBBBBBBW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "W": "wall",
    "P": "spawn_point",
    "B": "potential_apple",
    "S": "river",
    "H": {"type": "all", "list": ["river", "potential_dirt"]},
    "F": {"type": "all", "list": ["river", "actual_dirt"]},
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "Transform",
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "zapHit"
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "cleanHit"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "logic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
POTENTIAL_APPLE = {
    "name": "potentialApple",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "appleWait",
                "stateConfigs": [
                    {
                        "state": "apple",
                        "sprite": "Apple",
                        "layer": "lowerPhysical",
                    },
                    {
                        "state": "appleWait"
                    }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Apple"],
                "spriteShapes": [shapes.APPLE],
                "palettes": [{"*": (102, 255, 0, 255),
                              "@": (230, 255, 0, 255),
                              "&": (117, 255, 26, 255),
                              "#": (255, 153, 0, 255),
                              "x": (0, 0, 0, 0)}],
                "noRotates": [False]
            }
        },
        {
            "component": "Edible",
            "kwargs": {
                "liveState": "apple",
                "waitState": "appleWait",
                "rewardForEating": 1.0,
            }
        },
        {
            "component": "AppleGrow",
            "kwargs": {
                "maxAppleGrowthRate": 0.05,
                "thresholdDepletion": 0.4,
                "thresholdRestoration": 0.0,
            }
        }
    ]
}
NOOP        = {"move": 0, "turn":  0, "fireZap": 0, "fireClean": 0}
FORWARD     = {"move": 1, "turn":  0, "fireZap": 0, "fireClean": 0}
STEP_RIGHT  = {"move": 2, "turn":  0, "fireZap": 0, "fireClean": 0}
BACKWARD    = {"move": 3, "turn":  0, "fireZap": 0, "fireClean": 0}
STEP_LEFT   = {"move": 4, "turn":  0, "fireZap": 0, "fireClean": 0}
TURN_LEFT   = {"move": 0, "turn": -1, "fireZap": 0, "fireClean": 0}
TURN_RIGHT  = {"move": 0, "turn":  1, "fireZap": 0, "fireClean": 0}
FIRE_ZAP    = {"move": 0, "turn":  0, "fireZap": 1, "fireClean": 0}
FIRE_CLEAN  = {"move": 0, "turn":  0, "fireZap": 0, "fireClean": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    FIRE_ZAP,
    FIRE_CLEAN
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_dirt_prefab(initial_state):
def get_water():
def create_prefabs() -> PrefabConfig:
def create_scene():
def create_avatar_object(player_idx: int,
                         target_sprite_self: Dict[str, Any]) -> Dict[str, Any]:
def create_avatar_objects(num_players):
def create_lab2d_settings(num_players: int) -> Dict[str, Any]:
def get_config(): def get_config(): APPLE_RESPAWN_RADIUS = 2.0
REGROWTH_PROBABILITIES = [0.0, 0.001, 0.005, 0.025]
ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WW                            WW                              W
W                                                            WW
W    PPPPPPPPPPPPPPPPPPPPPPPP    PPPPPPPPPPPPPPPPPPPPPPPP     W
W    PPPPPPPPPPPPWWPPPPPPPPPP    PPPPPPPPPWPPWPPPPPPPPPPP    WW
W    WWWWWWWWWWWWWWWWWWWWWWWW    WWWWWWWWWWWWWWWWWWWWWWWW     W
W    W       A  WW  A       W               WW                W
W    W      AAA WW AAA      W    WWWWWWWWWW WW WWWWWWWWWW     W
W    W     AAAAAWWAAAAA     W    W  A       WW       A  W     W
W    W      AAA WW AAA      W    W AAA  WWWWWWWWWW  AAA W     W
W    W       A  WW  A       W    WAAAAA     WW     AAAAAW     W
W    W  A       WW       A  W    W AAA      WW      AAA W     W
W    W AAA      WW      AAA W    W  A       WW       A  W     W
W    WAAAAA     WW     AAAAAW    W       A  WW  A       W     W
W    W AAA  WWWWWWWWWW  AAA W    W      AAA WW AAA      W     W
W    W  A       WW       A  W    W     AAAAAWWAAAAA     W     W
W    WWWWWWWWWW WW WWWWWWWWWW    W      AAA WW AAA      W     W
W               WW               W       A  WW  A       W     W
W    WWWWWWWWWWWWWWWWWWWWWWWW    WWWWWWWWWWWWWWWWWWWWWWWW     W
W                                                  W    W     W
WW   PPPPPPPPPPPPPPPPPPPPPPPP    PPPPPPPPPPPPPPPPPPPPPPPP     W
WW   PPPPPPPPPPPPPPPPPPPPPPPP    PPPPPPPPPPPPPPPPPPPPPPPP     W
WW        W                                                  WW
W    WWWWWWWWWWWWWWWWWWWWWWWW    WWWWWWWWWWWWWWWWWWWWWWWW     W
W               WW               W       A  WW  A       W     W
W    WWWWWWWWWW WW WWWWWWWWWW    W      AAA WW AAA      WW    W
W    W  A       WW       A  W    W     AAAAAWWAAAAA     W     W
W    W AAA  WWWWWWWWWW  AAA W    W      AAA WW AAA      W     W
W    WAAAAA     WW     AAAAAW    W       A  WW  A       W     W
W    W AAA      WW      AAA W    W  A       WW       A  W     W
W    W  A       WW       A  W    W AAA      WW      AAA W     W
W    W       A  WW  A       W    WAAAAA     WW     AAAAAW     W
W    W      AAA WW AAA      W    W AAA  WWWWWWWWWW  AAA W     W
W    W     AAAAAWWAAAAA     W    W  A       WW       A  W     W
W    W      AAA WW AAA      W    WWWWWWWWWW WW WWWWWWWWWW     W
W    W       A  WW  A       W               WW                W
W    WWWWWWWWWWWWWWWWWWWWWWWW    WWWWWWWWWWWWWWWWWWWWWWWW     W
W    PPPPPPWPPPPPPPPPPPPPPPPP    PPPPPPPPPPPPPPPPPPPPPPPP     W
W    PPPPPPWPPPPPPPPPPPPPPPPP    PPPPPPPPPPPPPPPPPPPPPPPP     W
W                                                             W
W                              WWW    W W                     W
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "P": "spawn_point",
    "W": "wall",
    "A": "apple",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "zapHit"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NOOP       = {"move": 0, "turn":  0, "fireZap": 0}
FORWARD    = {"move": 1, "turn":  0, "fireZap": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "fireZap": 0}
BACKWARD   = {"move": 3, "turn":  0, "fireZap": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "fireZap": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "fireZap": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "fireZap": 0}
FIRE_ZAP   = {"move": 0, "turn":  0, "fireZap": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    FIRE_ZAP,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_scene():
def create_apple_prefab(regrowth_radius=-1.0,  # pylint: disable=dangerous-default-value
                        regrowth_probabilities=[0, 0.0, 0.0, 0.0]):
def create_prefabs(regrowth_radius=-1.0,
                   # pylint: disable=dangerous-default-value
                   regrowth_probabilities=[0, 0.0, 0.0, 0.0]):
def create_avatar_object(player_idx: int,
                         target_sprite_self: Dict[str, Any]) -> Dict[str, Any]:
def create_avatar_objects(num_players):
def create_lab2d_settings(num_players: int) -> Dict[str, Any]:
def get_config(): _COMPASS = ["N", "E", "S", "W"]
DEFAULT_ASCII_MAP = """
IIIIIIIIIIIIIIIIIIIIIII
IWWWWWWWWWWWWWWWWWWWWWI
IWPPP,PPPP,P,PPPP,PPPWI
IWPPP,,PP,,,,,PP,,PPPWI
IWPPP,,,,,,,,,,,,,PPPWI
IW,,,WW,,,,,,,,,WW,,,WI
IW,,,WWDWWWDWWW,WW,,,WI
IW,,,,,,,,,,,,,,D,,,,WI
IW,,,,W,GGGGGGG,W,,,,WI
IWHWWHW,GGGGGGG,WHWWHWI
IWHWWHW,GGGGGGG,WHWWHWI
IW,,,,D,GGGIGGG,D,,,,WI
IWHWWHW,GGGGGGG,WHWWHWI
IWHWWHW,GGGGGGG,WHWWHWI
IW,,,,W,GGGGGGG,W,,,,WI
IW,,,,D,,,,,,,,,,,,,,WI
IW,,,WW,WWWDWWWDWW,,,WI
IWQ,,WW,,,,,,,,,WW,,QWI
IWQQQ,,,,,,,,,,,,,QQQWI
IWQQQ,,QQ,,,,,QQ,,QQQWI
IWQQQ,QQQQ,Q,QQQQ,QQQWI
IWWWWWWWWWWWWWWWWWWWWWI
IIIIIIIIIIIIIIIIIIIIIII
"""
CHAR_PREFAB_MAP = {
    "P": {"type": "all", "list": ["spawn_point_red", "ground"]},
    "Q": {"type": "all", "list": ["spawn_point_blue", "ground"]},
    "W": "wall",
    "D": {"type": "choice",
          "list": ["destroyable_wall"] * 9 + ["destroyed_wall"]},
    "H": {"type": "choice",
          "list": ["destroyable_wall"] * 3 + ["destroyed_wall"]},
    "G": "hill",
    ",": "ground",
    "I": {"type": "all", "list": ["indicator", "indicator_frame"]},
}
RED_COLOR = (225, 55, 85, 255)
DARKER_RED_COLOR = (200, 35, 55, 255)
DARKEST_RED_COLOR = (160, 5, 25, 255)
BLUE_COLOR = (85, 55, 225, 255)
DARKER_BLUE_COLOR = (55, 35, 200, 255)
DARKEST_BLUE_COLOR = (25, 5, 160, 255)
PURPLE_COLOR = (107, 63, 160, 255)
TEAMS_DATA = {
    "red": {"color": RED_COLOR,
            "spawn_group": "{}SpawnPoints".format("red")},
    "blue": {"color": BLUE_COLOR,
             "spawn_group": "{}SpawnPoints".format("blue")},
}
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {"component": "Transform",},
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall",],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [True]
            }
        },
        {
            "component": "AllBeamBlocker",
            "kwargs": {}
        },
    ]
}
INDICATOR_FRAME = {
    "name": "indicator_frame",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "inert",
                "stateConfigs": [
                    {"state": "inert",
                     "layer": "superOverlay",
                     "sprite": "InertFrame"}
                ]
            }
        },
        {"component": "Transform",},
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["InertFrame"],
                "spriteShapes": [shapes.BUTTON],
                "palettes": [{"*": (0, 0, 0, 0),
                              "x": (55, 55, 55, 255),
                              "#": (0, 0, 0, 0)}],
                "noRotates": [True]
            }
        },
    ]
}
INDICATOR = {
    "name": "control_indicator",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "uncontrolled",
                "stateConfigs": [
                    {
                        "state": "uncontrolled",
                        "layer": "background",
                        "sprite": "UncontrolledIndicator",
                    },
                    {
                        "state": "red",
                        "layer": "background",
                        "sprite": "RedIndicator",
                    },
                    {
                        "state": "blue",
                        "layer": "background",
                        "sprite": "BlueIndicator",
                    }
                ]
            }
        },
        {"component": "Transform",},
        {
            "component": "Appearance",
            "kwargs": {
                "spriteNames": ["UncontrolledIndicator",
                                "RedIndicator",
                                "BlueIndicator"],
                "spriteRGBColors": [PURPLE_COLOR,
                                    DARKER_RED_COLOR,
                                    DARKER_BLUE_COLOR]
            }
        },
        {"component": "ControlIndicator",},
    ]
}
PREFABS = {
    "wall": WALL,
    "spawn_point_red": create_spawn_point_prefab("red"),
    "spawn_point_blue": create_spawn_point_prefab("blue"),
    "destroyable_wall": create_destroyable_wall_prefab("destroyable"),
    "destroyed_wall": create_destroyable_wall_prefab("destroyed"),
    "hill": create_ground_prefab(is_hill=True),
    "ground": create_ground_prefab(is_hill=False),
    "indicator": INDICATOR,
    "indicator_frame": INDICATOR_FRAME,
}
NOOP       = {"move": 0, "turn":  0, "fireZap": 0}
FORWARD    = {"move": 1, "turn":  0, "fireZap": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "fireZap": 0}
BACKWARD   = {"move": 3, "turn":  0, "fireZap": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "fireZap": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "fireZap": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "fireZap": 0}
FIRE_ZAP   = {"move": 0, "turn":  0, "fireZap": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    FIRE_ZAP,
)
def multiply_tuple(color_tuple, factor):
def create_ground_prefab(is_hill=False):
def create_destroyable_wall_prefab(initial_state):
def create_spawn_point_prefab(team):
def create_scene():
def create_avatar_object(
    player_idx: int,
    team: str,
    override_taste_kwargs: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
def _even_vs_odd_team_assignment(num_players,
                                 taste_kwargs: Optional[Any] = None):
def _low_vs_high_team_assignment(num_players,
                                 taste_kwargs: Optional[Any] = None):
def create_avatar_objects(num_players,
                          taste_kwargs: Optional[Any] = None,
                          fixed_teams: Optional[bool] = False):
def create_lab2d_settings(
    num_players: int,
    avatar_taste_kwargs: Optional[Any] = None,
    fixed_teams: Optional[bool] = False) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): NUM_RESOURCES = 2
RESOURCE1_COLOR = (30, 225, 185, 255)
RESOURCE1_HIGHLIGHT_COLOR = (98, 234, 206, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (225, 30, 70, 255)
RESOURCE2_HIGHLIGHT_COLOR = (234, 98, 126, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPP      W W      PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
W                       W
W        11             W
W        11             W
W        aa             W
W    WW     W  222      W
WW    1a    W  222      W
WWW   1a  WWWWWWWWW     W
W     1a    111       WWW
W           111         W
W       aa W            W
W       22 W   WW       W
W       22     Waaa     W
W               222     W
W                       W
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP         W     PPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "1": _resource_names[0],
    "2": _resource_names[1],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         target_sprite_self: Dict[str, Any]) -> Dict[str, Any]:
def create_avatar_objects(num_players: int) -> Sequence[PrefabConfig]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): NUM_RESOURCES = 3
RESOURCE1_COLOR = (150, 0, 0, 255)
RESOURCE1_HIGHLIGHT_COLOR = (200, 0, 0, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (0, 150, 0, 255)
RESOURCE2_HIGHLIGHT_COLOR = (0, 200, 0, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
RESOURCE3_COLOR = (0, 0, 150, 255)
RESOURCE3_HIGHLIGHT_COLOR = (0, 0, 200, 255)
RESOURCE3_COLOR_DATA = (RESOURCE3_COLOR, RESOURCE3_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPP      W W      PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
W             aa        W
W        11   aa        W
W        11             W
W        11             W
W    WW     W  222      W
WW    33    W  222      W
WWW   33  WWWWWWWWW     W
W     33    111       WWW
W           111         W
W       22 W            W
W       22 W   WW       W
W       22     W333     W
W               333     W
W          aa           W
WPPPP      aa       PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP         W     PPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "1": _resource_names[0],
    "2": _resource_names[1],
    "3": _resource_names[2],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
TARGET_SPRITE_OTHER = {
    "name": "Other",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((200, 100, 50)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         all_source_sprite_names: List[str],
                         target_sprite_self: Dict[str, Any],
                         target_sprite_other: Dict[str, Any]) -> Dict[str, Any]:
def get_all_source_sprite_names(num_players):
def create_avatar_objects(num_players):
def create_world_sprite_map(
    num_players: int, target_sprite_other: Dict[str, Any]) -> Dict[str, str]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): NUM_RESOURCES = 3
RESOURCE1_COLOR = (255, 227, 11, 255)
RESOURCE1_HIGHLIGHT_COLOR = (255, 214, 91, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (109, 42, 255, 255)
RESOURCE2_HIGHLIGHT_COLOR = (132, 91, 255, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
RESOURCE3_COLOR = (42, 188, 255, 255)
RESOURCE3_HIGHLIGHT_COLOR = (91, 214, 255, 255)
RESOURCE3_COLOR_DATA = (RESOURCE3_COLOR, RESOURCE3_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPP      W W      PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
W             aa        W
W        11   aa        W
W        11             W
W        11             W
W    WW     W  222      W
WW    33    W  222      W
WWW   33  WWWWWWWWW     W
W     33    111       WWW
W           111         W
W       22 W            W
W       22 W   WW       W
W       22     W333     W
W               333     W
W          aa           W
WPPPP      aa       PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP         W     PPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "1": _resource_names[0],
    "2": _resource_names[1],
    "3": _resource_names[2],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
TARGET_SPRITE_OTHER = {
    "name": "Other",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((200, 100, 50)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         all_source_sprite_names: List[str],
                         target_sprite_self: Dict[str, Any],
                         target_sprite_other: Dict[str, Any]) -> Dict[str, Any]:
def get_all_source_sprite_names(num_players):
def create_avatar_objects(num_players):
def create_world_sprite_map(
    num_players: int, target_sprite_other: Dict[str, Any]) -> Dict[str, str]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): NUM_RESOURCES = 3
RESOURCE1_COLOR = (255, 227, 11, 255)
RESOURCE1_HIGHLIGHT_COLOR = (255, 214, 91, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (109, 42, 255, 255)
RESOURCE2_HIGHLIGHT_COLOR = (132, 91, 255, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
RESOURCE3_COLOR = (42, 188, 255, 255)
RESOURCE3_HIGHLIGHT_COLOR = (91, 214, 255, 255)
RESOURCE3_COLOR_DATA = (RESOURCE3_COLOR, RESOURCE3_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWW
WP r  r  a   a  p  p PW
W                     W
WP r  r  a   a  p  p PW
W                     W
WP r  r  a   a  p  p PW
W                     W
W     P    P    P     W
W                     W
WP s  s  a   a  a  a PW
W                     W
WP s  s  a   a  a  a PW
W                     W
WP s  s  a   a  a  a PW
WWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "a": {"type": "choice", "list": _resource_names},
    "r": _resource_names[0],
    "p": _resource_names[1],
    "s": _resource_names[2],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 8
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
TARGET_SPRITE_OTHER = {
    "name": "Other",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((200, 100, 50)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(
    resource_id: int,
    resource_shape: str,
    resource_palette: Dict[str, Tuple[int, int, int, int]]):
def create_avatar_object(player_idx: int,
                         all_source_sprite_names: List[str],
                         target_sprite_self: Dict[str, Any],
                         target_sprite_other: Dict[str, Any]) -> Dict[str, Any]:
def create_prefabs():
def get_all_source_sprite_names(num_players):
def create_avatar_objects(num_players):
def create_world_sprite_map(
    num_players: int, target_sprite_other: Dict[str, Any]) -> Dict[str, str]:
def create_lab2d_settings(num_players: int) -> Dict[str, Any]:
def get_config(): NUM_RESOURCES = 2
RESOURCE1_COLOR = (30, 225, 185, 255)
RESOURCE1_HIGHLIGHT_COLOR = (98, 234, 206, 255)
RESOURCE1_COLOR_DATA = (RESOURCE1_COLOR, RESOURCE1_HIGHLIGHT_COLOR)
RESOURCE2_COLOR = (225, 30, 70, 255)
RESOURCE2_HIGHLIGHT_COLOR = (234, 98, 126, 255)
RESOURCE2_COLOR_DATA = (RESOURCE2_COLOR, RESOURCE2_HIGHLIGHT_COLOR)
DEFAULT_ASCII_MAP = """
WWWWWWWWWWWWWWWWWWWWWWWWW
WPPPPPPP   W W   PPPPPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP       2222    PPPPW
WP                     PW
WP     222222   222    PW
WP 2     11    11      PW
W  2     11        222  W
W    WW     W  222      W
WW    21    W  222      W
WWW   21  WWWWWWWWW     W
W     21    111  1    WWW
W           111  1      W
W       22 W        22  W
W  22   22 W   WW       W
WP      22     W222    PW
WP              222    PW
WP         222         PW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPP               PPPPW
WPPPPPPP      W  PPPPPPPW
WWWWWWWWWWWWWWWWWWWWWWWWW
"""
CHAR_PREFAB_MAP = {
    "1": _resource_names[0],
    "2": _resource_names[1],
    "P": "spawn_point",
    "W": "wall",
}
_COMPASS = ["N", "E", "S", "W"]
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall"],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [False]
            }
        },
        {
            "component": "BeamBlocker",
            "kwargs": {
                "beamType": "gameInteraction"
            }
        },
    ]
}
SPAWN_POINT = {
    "name": "spawnPoint",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "spawnPoint",
                "stateConfigs": [{
                    "state": "spawnPoint",
                    "layer": "alternateLogic",
                    "groups": ["spawnPoints"]
                }],
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
NUM_PLAYERS_UPPER_BOUND = 32
PLAYER_COLOR_PALETTES = []
NOOP       = {"move": 0, "turn":  0, "interact": 0}
FORWARD    = {"move": 1, "turn":  0, "interact": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "interact": 0}
BACKWARD   = {"move": 3, "turn":  0, "interact": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "interact": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "interact": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "interact": 0}
INTERACT   = {"move": 0, "turn":  0, "interact": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    INTERACT,
)
TARGET_SPRITE_SELF = {
    "name": "Self",
    "shape": shapes.CUTE_AVATAR,
    "palette": shapes.get_palette((50, 100, 200)),
    "noRotate": True,
}
def create_scene():
def create_resource_prefab(resource_id, color_data):
def create_prefabs() -> PrefabConfig:
def create_avatar_object(player_idx: int,
                         target_sprite_self: Dict[str, Any]) -> Dict[str, Any]:
def create_avatar_objects(num_players: int) -> Sequence[PrefabConfig]:
def create_lab2d_settings(
    num_players: int,
    ascii_map_string: str,
    settings_overrides: Iterable[Tuple[str, Any]] = ()) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): _COMPASS = ["N", "E", "S", "W"]
MAX_ALLOWED_NUM_PLAYERS = 10
DEFAULT_ASCII_MAP = """
WRRRRRWWRRRRRWWRRRRRW
R     RR     RR     R
R     RR     RR     R
R  P  RR  P  RR  P  R
R     RR     RR     R
R     RR     RR     R
WRRRRRWWRRRRRWWRRRRRW
WRRRRRWWRRRRRWWRRRRRW
R     RR     RR     R
R     RR     RR     R
R  P  RR  P  RR  P  R
R     RR     RR     R
R     RR     RR     R
WRRRRRWWRRRRRWWRRRRRW
WRRRRRWWRRRRRWWRRRRRW
R     RR     RR     R
R     RR     RR     R
R  P  RR  P  RR  P  R
R     RR     RR     R
R     RR     RR     R
WRRRRRWWRRRRRWWRRRRRW
"""
CHAR_PREFAB_MAP = {
    "P": "spawn_point",
    "W": "wall",
    "R": {"type": "all", "list": ["resource", "reward_indicator"]},
}
WALL = {
    "name": "wall",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "wall",
                "stateConfigs": [{
                    "state": "wall",
                    "layer": "upperPhysical",
                    "sprite": "Wall",
                }],
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "ascii_shape",
                "spriteNames": ["Wall",],
                "spriteShapes": [shapes.WALL],
                "palettes": [{"*": (95, 95, 95, 255),
                              "&": (100, 100, 100, 255),
                              "@": (109, 109, 109, 255),
                              "#": (152, 152, 152, 255)}],
                "noRotates": [True]
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "AllBeamBlocker",
            "kwargs": {}
        },
    ]
}
SPAWN_POINT = {
    "name": "spawn_point",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "playerSpawnPoint",
                "stateConfigs": [{
                    "state": "playerSpawnPoint",
                    "layer": "logic",
                    "groups": ["spawnPoints"],
                }],
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "renderMode": "invisible",
                "spriteNames": [],
                "spriteRGBColors": []
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
    ]
}
RESOURCE = {
    "name": "resource",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "unclaimed",
                "stateConfigs": [
                    {"state": "unclaimed",
                     "layer": "upperPhysical",
                     "sprite": "UnclaimedResourceSprite",
                     "groups": ["unclaimedResources"]},
                    {"state": "destroyed"},
                ],
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "spriteNames": ["UnclaimedResourceSprite"],
                # This color is grey.
                "spriteRGBColors": [(64, 64, 64, 255)]
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "Resource",
            "kwargs": {
                "initialHealth": 2,
                "destroyedState": "destroyed",
                "reward": 1.0,
                "rewardRate": 0.01,
                "rewardDelay": 100
            }
        },
    ]
}
REWARD_INDICATOR = {
    "name": "reward_indicator",
    "components": [
        {
            "component": "StateManager",
            "kwargs": {
                "initialState": "inactive",
                "stateConfigs": [
                    {"state": "active",
                     "layer": "overlay",
                     "sprite": "ActivelyRewardingResource"},
                    {"state": "inactive"},
                ],
            }
        },
        {
            "component": "Appearance",
            "kwargs": {
                "spriteNames": ["ActivelyRewardingResource",],
                "renderMode": "ascii_shape",
                "spriteShapes": [shapes.PLUS_IN_BOX],
                "palettes": [{"*": (86, 86, 86, 65),
                              "#": (202, 202, 202, 105),
                              "@": (128, 128, 128, 135),
                              "x": (0, 0, 0, 0)}],
                "noRotates": [True]
            }
        },
        {
            "component": "Transform",
            "kwargs": {
                "position": (0, 0),
                "orientation": "N"
            }
        },
        {
            "component": "RewardIndicator",
            "kwargs": {
            }
        },
    ]
}
PLAYER_COLOR_PALETTES = []
PREFABS = {
    "wall": WALL,
    "spawn_point": SPAWN_POINT,
    "resource": RESOURCE,
    "reward_indicator": REWARD_INDICATOR,
}
NOOP       = {"move": 0, "turn":  0, "fireZap": 0, "fireClaim": 0}
FORWARD    = {"move": 1, "turn":  0, "fireZap": 0, "fireClaim": 0}
STEP_RIGHT = {"move": 2, "turn":  0, "fireZap": 0, "fireClaim": 0}
BACKWARD   = {"move": 3, "turn":  0, "fireZap": 0, "fireClaim": 0}
STEP_LEFT  = {"move": 4, "turn":  0, "fireZap": 0, "fireClaim": 0}
TURN_LEFT  = {"move": 0, "turn": -1, "fireZap": 0, "fireClaim": 0}
TURN_RIGHT = {"move": 0, "turn":  1, "fireZap": 0, "fireClaim": 0}
FIRE_ZAP   = {"move": 0, "turn":  0, "fireZap": 1, "fireClaim": 0}
FIRE_CLAIM = {"move": 0, "turn":  0, "fireZap": 0, "fireClaim": 1}
ACTION_SET = (
    NOOP,
    FORWARD,
    BACKWARD,
    STEP_LEFT,
    STEP_RIGHT,
    TURN_LEFT,
    TURN_RIGHT,
    FIRE_ZAP,
    FIRE_CLAIM
)
def create_scene():
def create_avatar_object(player_idx: int) -> Dict[str, Any]:
def create_avatar_objects(num_players):
def create_lab2d_settings(num_players: int) -> Dict[str, Any]:
def get_config(factory=create_lab2d_settings): WHITE = (255, 255, 255)
MOVEMENT_MAP = {
    'NONE': 0,
    'FORWARD': 1,
    'RIGHT': 2,
    'BACKWARD': 3,
    'LEFT': 4,
}
  NONE = 0
  PYGAME = 1
class RenderType(enum.Enum):
class ActionReader(object):
def get_random_direction() -> int:
def get_random_turn() -> int:
def get_random_fire() -> int:
def get_direction_pressed() -> int:
def get_turn_pressed() -> int:
def get_space_key_pressed() -> int:
def get_key_number_pressed() -> int:
def get_key_number_one_pressed() -> int:
def get_key_number_two_pressed() -> int:
def get_key_number_three_pressed() -> int:
def get_key_number_four_pressed() -> int:
def get_key_number_five_pressed() -> int:
def get_left_control_pressed() -> int:
def get_left_shift_pressed() -> int:
def get_right_shift_pressed() -> int:
def get_key_z_pressed() -> int:
def get_key_x_pressed() -> int:
def _split_key(key: str) -> Tuple[int, str]:
def _get_rewards(timestep: dm_env.TimeStep) -> Sequence[float]:
  def __init__(self, env: dmlab2d.Environment, action_map: ActionMap):
  def step(self, player_index: int) -> Sequence[Sequence[Mapping[str, int]]]:
def run_episode(
    render_observation: str,
    config_overrides: Dict[str, Any],
    action_map: ActionMap,
    full_config: config_dict.ConfigDict,
    interactive: RenderType = RenderType.PYGAME,
    screen_width: int = 800,
    screen_height: int = 600,
    fps: int = 8,
    verbose_fn: Optional[Callable[[dm_env.TimeStep, int], None]] = None,
    text_display_fn: Optional[Callable[[dm_env.TimeStep, int], str]] = None,
    text_font_size: int = 36,
    text_x_pos: int = 20,
    text_y_pos: int = 20,
    text_color: Tuple[int, ...] = WHITE,
    env_builder: EnvBuilder = builder.builder,
    print_events: Optional[bool] = False,
    ) -> None: _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'fireZap': level_playing_utils.get_space_key_pressed,
    'fire_1': level_playing_utils.get_key_number_one_pressed,
    'fire_2': level_playing_utils.get_key_number_two_pressed,
    'fire_3': level_playing_utils.get_key_number_three_pressed,
    'fire_4': level_playing_utils.get_key_number_four_pressed,
    'fire_5': level_playing_utils.get_key_number_five_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'fireZap': level_playing_utils.get_space_key_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'interact': level_playing_utils.get_space_key_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'fireZap': level_playing_utils.get_key_number_one_pressed,
    'fireClean': level_playing_utils.get_key_number_two_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'interact': level_playing_utils.get_space_key_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'fireZap': level_playing_utils.get_space_key_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'ioAction': level_playing_utils.get_space_key_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main(): _ACTION_MAP = {
    'move': level_playing_utils.get_direction_pressed,
    'turn': level_playing_utils.get_turn_pressed,
    'fireZap': level_playing_utils.get_space_key_pressed,
    'fireClaim': level_playing_utils.get_left_shift_pressed,
}
def verbose_fn(unused_env, unused_player_index):
def main():
import collections
import numpy as np
import pygame
import dmlab2d
from unittest import mock
from absl.testing import absltest
from absl.testing import parameterized
from dm_env import specs
from meltingpot.python.configs.substrates import allelopathic_harvest as mp_allelopathic_harvest
from meltingpot.python.configs.substrates import arena_running_with_scissors_in_the_matrix as mp_arena_running_with_scissors_itm
from meltingpot.python.configs.substrates import bach_or_stravinsky_in_the_matrix as mp_bach_or_stravinsky_itm
from meltingpot.python.configs.substrates import capture_the_flag as mp_capture_the_flag
from meltingpot.python.configs.substrates import chemistry_metabolic_cycles as mp_chemistry_metabolic_cycles
from meltingpot.python.configs.substrates import chicken_in_the_matrix as mp_chicken_itm
from meltingpot.python.configs.substrates import clean_up as mp_clean_up
from meltingpot.python.configs.substrates import collaborative_cooking_passable as mp_collaborative_cooking_passable
from meltingpot.python.configs.substrates import commons_harvest_closed as mp_commons_harvest_closed
from meltingpot.python.configs.substrates import king_of_the_hill as mp_king_of_the_hill
from meltingpot.python.configs.substrates import prisoners_dilemma_in_the_matrix as mp_prisoners_dilemma_itm
from meltingpot.python.configs.substrates import pure_coordination_in_the_matrix as mp_pure_coordination_itm
from meltingpot.python.configs.substrates import rationalizable_coordination_in_the_matrix as mp_rationalizable_coordination_itm
from meltingpot.python.configs.substrates import running_with_scissors_in_the_matrix as mp_running_with_scissors_itm
from meltingpot.python.configs.substrates import stag_hunt_in_the_matrix as mp_stag_hunt_itm
from meltingpot.python.configs.substrates import territory_rooms as mp_territory_rooms
from meltingpot.python.human_players import level_playing_utils
from meltingpot.python.human_players import play_allelopathic_harvest
from meltingpot.python.human_players import play_any_paintball_game
from meltingpot.python.human_players import play_anything_in_the_matrix
from meltingpot.python.human_players import play_clean_up
from meltingpot.python.human_players import play_collaborative_cooking
from meltingpot.python.human_players import play_commons_harvest
from meltingpot.python.human_players import play_grid_land
from meltingpot.python.human_players import play_territory
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests of the human_players levels."""





class HumanActionReaderTest(parameterized.TestCase):

  @parameterized.parameters(
      (
          {  # Capture the following key events,
              'move': level_playing_utils.get_direction_pressed,
          },  # given this action name, key pressed, for this player index; and
          pygame.K_w, 0,
          # Expecting this action list out.
          {'1.move': 1, '2.move': 0, '3.move': 0},
      ), (
          {  # Capture the following key events,
              'move': level_playing_utils.get_direction_pressed,
          },  # given this action name, key pressed, for this player index; and
          pygame.K_s, 2,
          # Expecting this action list out.
          {'1.move': 0, '2.move': 0, '3.move': 3},
      ), (
          {  # Capture the following key events,
              'move': level_playing_utils.get_direction_pressed,
          },  # given this action name, key pressed, for this player index; and
          pygame.K_s, 0,
          # Expecting this action list out.
          {'1.move': 3, '2.move': 0, '3.move': 0},
      ), (
          {  # Capture the following key events,
              'move': level_playing_utils.get_direction_pressed,
          },  # given action name, irrelevant key pressed, for player 0; and
          pygame.K_x, 0,
          # Expecting this action list out.
          {'1.move': 0, '2.move': 0, '3.move': 0},
      ), (
          {  # Capture the following key events (don't need to make sense),
              'move': level_playing_utils.get_space_key_pressed,
          },  # given action name, irrelevant key pressed, for player 0; and
          pygame.K_SPACE, 0,
          # Expecting this action list out.
          {'1.move': 1, '2.move': 0, '3.move': 0},
      ),
  )
  @mock.patch.object(pygame, 'key')
  def test_human_action(self, action_map, key_pressed, player_index,
                        expected_action, mock_key):
    retval = collections.defaultdict(bool)
    retval[key_pressed] = True
    mock_key.get_pressed.return_value = retval

    move_array = specs.BoundedArray(
        shape=tuple(), dtype=np.intc, minimum=0, maximum=4, name='move')
    action_spec = {
        '1.move': move_array,
        '2.move': move_array,
        '3.move': move_array,
    }
    with mock.patch.object(dmlab2d, 'Lab2d') as env:
      env.action_spec.return_value = action_spec
      har = level_playing_utils.ActionReader(env, action_map)
      np.testing.assert_array_equal(har.step(player_index), expected_action)


class PlayLevelTest(parameterized.TestCase):

  @parameterized.parameters(
      (mp_allelopathic_harvest, play_allelopathic_harvest),
      (mp_arena_running_with_scissors_itm, play_anything_in_the_matrix),
      (mp_bach_or_stravinsky_itm, play_anything_in_the_matrix),
      (mp_capture_the_flag, play_any_paintball_game),
      (mp_chemistry_metabolic_cycles, play_grid_land),
      (mp_chicken_itm, play_anything_in_the_matrix),
      (mp_clean_up, play_clean_up),

      (mp_collaborative_cooking_passable, play_collaborative_cooking),