# Path: meltingpot/python/substrate.py
# AVAILABLE_SUBSTRATES = substrate_configs.SUBSTRATES
# class SubstrateObservables:
# class Substrate(base.Wrapper):
#   def __init__(self, env: ...) -> None:
#   def reset(self) -> dm_env.TimeStep:
#   def step(self, action: Sequence[int]) -> dm_env.TimeStep:
#   def reward_spec(self) -> Sequence[dm_env.specs.Array]:
#   def observation_spec(self) -> Sequence[Mapping[str, dm_env.specs.Array]]:
#   def action_spec(self) -> Sequence[dm_env.specs.DiscreteArray]:
#   def close(self) -> None:
#   def observables(self) -> SubstrateObservables:
# def get_config(substrate_name: str) -> config_dict.ConfigDict:
# def build(config: config_dict.ConfigDict) -> Substrate:


import copy
import os
import ray
import multiagent_wrapper  # pylint: disable=g-bad-import-order
from meltingpot.python import substrate
from ml_collections import config_dict
from ray.rllib.agents.registry import get_trainer_class
from ray.tune.registry import register_env
#
# 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.
"""Runs an example of a self-play training experiment."""





def main():
  # We need the following 3 pieces to run the training:
  # 1. The agent algorithm to use.
  agent_algorithm = "PPO"
  # 2. The name of the MeltingPot substrate, coming
  # from substrate.AVAILABLE_SUBSTRATES.
  substrate_name = "allelopathic_harvest"
  # 3. The number of CPUs to be used to run the training.
  num_cpus = 1

  # function that outputs the environment you wish to register.
  def env_creator(env_config):

# Path: meltingpot/python/substrate.py
# AVAILABLE_SUBSTRATES = substrate_configs.SUBSTRATES
# class SubstrateObservables:
# class Substrate(base.Wrapper):
#   def __init__(self, env: ...) -> None:
#   def reset(self) -> dm_env.TimeStep:
#   def step(self, action: Sequence[int]) -> dm_env.TimeStep:
#   def reward_spec(self) -> Sequence[dm_env.specs.Array]:
#   def observation_spec(self) -> Sequence[Mapping[str, dm_env.specs.Array]]:
#   def action_spec(self) -> Sequence[dm_env.specs.DiscreteArray]:
#   def close(self) -> None:
#   def observables(self) -> SubstrateObservables:
# def get_config(substrate_name: str) -> config_dict.ConfigDict:
# def build(config: config_dict.ConfigDict) -> Substrate:


# Path: examples/rllib/self_play_train.py
import copy
import os
import ray
import multiagent_wrapper  # pylint: disable=g-bad-import-order
from meltingpot.python import substrate
from ml_collections import config_dict
from ray.rllib.agents.registry import get_trainer_class
from ray.tune.registry import register_env

#
# 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.
"""Runs an example of a self-play training experiment."""





def main():
  # We need the following 3 pieces to run the training:
  # 1. The agent algorithm to use.
  agent_algorithm = "PPO"
  # 2. The name of the MeltingPot substrate, coming
  # from substrate.AVAILABLE_SUBSTRATES.
  substrate_name = "allelopathic_harvest"
  # 3. The number of CPUs to be used to run the training.
  num_cpus = 1

  # function that outputs the environment you wish to register.
  def env_creator(env_config):

    env = substrate.build(config_dict.ConfigDict(env_config))