def make_test():
    """
    Create an environment with some standard wrappers.
    """

    # Make the environment
    env = make_retro(game='SonicTheHedgehog-Genesis',
                     state='GreenHillZone.Act2',
                     record="./records")

    # Build the actions array
    env = ActionsDiscretizer(env)

    # Scale the rewards
    env = RewardScaler(env)

    # PreprocessFrame
    env = PreprocessFrame(env)

    # Stack 4 frames
    env = FrameStack(env, 4)

    # Allow back tracking that helps agents are not discouraged too heavily
    # from exploring backwards if there is no way to advance
    # head-on in the level.
    env = AllowBacktracking(env)

    return env
Пример #2
0
def make_env(env_idx):
    """
    Create an environment with some standard wrappers.
    """
    dicts = [
        {
            'game': 'SuperMarioBros-Nes',
            'state': 'Level1-1'
        }, {
            'game': 'SuperMarioBros-Nes',
            'state': 'Level2-1'
        }, {
            'game': 'SuperMarioBros-Nes',
            'state': 'Level3-1'
        }, {
            'game': 'SuperMarioBros-Nes',
            'state': 'Level4-1'
        }
        # {'game': 'SonicTheHedgehog2-Genesis', 'state': 'MetropolisZone.Act2'},
        # {'game': 'SonicTheHedgehog2-Genesis', 'state': 'OilOceanZone.Act1'},
        # {'game': 'SonicTheHedgehog2-Genesis', 'state': 'OilOceanZone.Act2'},
        # {'game': 'SonicAndKnuckles3-Genesis', 'state': 'LavaReefZone.Act2'},
        # {'game': 'SonicAndKnuckles3-Genesis', 'state': 'CarnivalNightZone.Act2'},
        # {'game': 'SonicAndKnuckles3-Genesis', 'state': 'CarnivalNightZone.Act1'},
        # {'game': 'SonicAndKnuckles3-Genesis', 'state': 'MushroomHillZone.Act2'},
        # {'game': 'SonicAndKnuckles3-Genesis', 'state': 'MushroomHillZone.Act1'},
        # {'game': 'SonicAndKnuckles3-Genesis', 'state': 'AngelIslandZone.Act1'}
    ]
    # Make the environment
    print(dicts[env_idx]['game'], dicts[env_idx]['state'], flush=True)
    record_path = "./records/" + dicts[env_idx]['state']
    # env = make(game=dicts[env_idx]['game'], state=dicts[env_idx]['state'])#, bk2dir="./records")#record='/tmp')
    env = make_retro(
        game=dicts[env_idx]['game'],
        state=dicts[env_idx]['state'])  #, bk2dir="./records")#record='/tmp')
    print("!!!!!", int(''.join(map(str, env.get_ram()[0x07de:0x07de + 6]))))

    # Build the actions array,
    env = ActionsDiscretizer(env)

    # Scale the rewards
    env = RewardScaler(env)

    # PreprocessFrame
    env = PreprocessFrame(env)

    # Stack 4 frames
    env = FrameStack(env, 4)

    # Allow back tracking that helps agents are not discouraged too heavily
    # from exploring backwards if there is no way to advance
    # head-on in the level.
    env = AllowBacktracking(env)

    return env
Пример #3
0
def make_test(n_frames=4):
    """
    Create an environment with some standard wrappers.
    """

    environment = make_retro(game='SonicTheHedgehog-Genesis',
                             state='GreenHillZone.Act2',
                             record="./records")

    environment = wrap_environment(environment=environment, n_frames=n_frames)

    return environment
Пример #4
0
def make_test():

    # A custom make function for contest environment
    # Also, time limit / max number of steps are imposed in this environment
    env = make_retro(game='SonicTheHedgehog-Genesis',
                     state='GreenHillZone.Act2',
                     record="./records")

    env = ActionsDiscretizer(env)
    env = RewardScaler(env)
    env = PreprocessFrame(env)
    env = FrameStack(env, 4)

    env = AllowBacktracking(env)

    return env
Пример #5
0
def make_test():
    """
    Create an environment with some standard wrappers.
    
    dicts = [
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'EmeraldHillZone.Act1'},
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'ChemicalPlantZone.Act2'},
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'ChemicalPlantZone.Act1'},
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'MetropolisZone.Act1'},
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'MetropolisZone.Act2'},
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'OilOceanZone.Act1'},
        {'game': 'SonicTheHedgehog2-Genesis', 'state': 'OilOceanZone.Act2'},
        {'game': 'SonicAndKnuckles3-Genesis', 'state': 'LavaReefZone.Act2'},
        {'game': 'SonicAndKnuckles3-Genesis', 'state': 'CarnivalNightZone.Act2'},
        {'game': 'SonicAndKnuckles3-Genesis', 'state': 'CarnivalNightZone.Act1'},
        {'game': 'SonicAndKnuckles3-Genesis', 'state': 'MushroomHillZone.Act2'},
        {'game': 'SonicAndKnuckles3-Genesis', 'state': 'MushroomHillZone.Act1'},
        {'game': 'SonicAndKnuckles3-Genesis', 'state': 'AngelIslandZone.Act1'}
    ]
    """
    # Here we add record because we want to output a video
    # env = make(game="SonicAndKnuckles3-Genesis", state="AngelIslandZone.Act1")
    env = make_retro(game="SuperMarioBros-Nes", state="Level1-1")
    # Build the actions array,
    env = ActionsDiscretizer(env)

    # Scale the rewards
    env = RewardScaler(env)

    # PreprocessFrame
    env = PreprocessFrame(env)

    # Stack 4 frames
    env = FrameStack(env, 4)

    # Allow back tracking that helps agents are not discouraged too heavily
    # from exploring backwards if there is no way to advance
    # head-on in the level.
    env = AllowBacktracking(env)

    return env
Пример #6
0
def make_env(env_idx): 
  """
  Create an environment with some standard wrappers.
  """
  dicts = [{'game': 'SuperMarioBros-Nes', 'state': 'Level1-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level2-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level3-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level4-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level5-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level6-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level7-1'},
          {'game': 'SuperMarioBros-Nes', 'state': 'Level8-1'}]
      
  # Make the environment
  print(dicts[env_idx]['game'], dicts[env_idx]['state'], flush=True)
  #record_path = "./records/" + dicts[env_idx]['state']
  env = make_retro(game=dicts[env_idx]['game'], state=dicts[env_idx]['state'], record='.')

  # Build the actions array, 
  env = ActionsDiscretizer(env)

  # Scale the rewards
  env = RewardScaler(env)

  # PreprocessFrame
  env = PreprocessFrame(env)

  # Stack 4 frames
  env = FrameStack(env, 4)

  # Allow back tracking that helps agents are not discouraged too heavily
  # from exploring backwards if there is no way to advance
  # head-on in the level.
  env = AllowBacktracking(env)

  return env
Пример #7
0
def make_test():
     env = make_retro(game='SonicTheHedgehog-Genesis',
                    state='GreenHillZone.Act2', record="./records")