def __init__(self): game_mode, render, total_step_limit, total_run_limit, clip = self.get_args( ) env_name = "BreakoutDeterministic-v4" # Handles frame skipping (4) at every iteration in deterministic env env = MainGymWrapper.wrap(gym.make(env_name)) self.main_loop(self.game_model(game_mode, env.action_space.n), env, render, total_step_limit, total_run_limit, clip)
def __init__(self): game_name, game_mode, render, total_step_limit, total_run_limit, clip = self.gameargs( ) env_name = game_name + "Deterministic-v4" env = MainGymWrapper.wrap(gym.make(env_name)) self.main_loop( self.game_models(game_mode, game_name, env.action_space.n), env, render, total_step_limit, total_run_limit, clip)
def __init__(self): game_name, game_mode, render, total_step_limit, total_run_limit, clip, shields = self._args() print(shields) env_name = game_name + "Deterministic-v4" # Handles frame skipping (4) at every iteration env = MainGymWrapper.wrap(gym.make(env_name)) #env.set_shields(shields) self._main_loop(self._game_model(game_mode, game_name, env.action_space.n), env, render, total_step_limit, total_run_limit, clip)
def run_game(n_rep=2000): env_name = 'BreakoutDeterministic-v4' print(env_name) env = MainGymWrapper.wrap(gym.make(env_name)) # env = gym.make(env_name) env.reset() print("Metadata", env.metadata) print("Actions:", env.action_space) print("Observation:", env.observation_space) actions = env.action_space env.render() for i in range(n_rep): next_state, reward, terminal, info = env.step(np.random.randint(low=0, high=4)) env.render() time.sleep(0.4) print("Four consecutive frames") print(info) print(np.asarray(next_state).shape) print(reward) print(terminal) plt.imshow(np.asarray(next_state)[0, ...]) plt.plot()
def __init__(self, game_name: str = 'Alien', game_mode: str = 'ddqn_training', render: bool = False, total_step_limit: int = 500000, total_run_limit: int = None, clip: bool = False): """Initialise Atari class """ self.game_name = game_name self.game_mode = game_mode self.render = render self.total_step_limit = total_step_limit self.total_run_limit = total_run_limit self.clip = clip self._args() env_name = game_name + "Deterministic-v4" # Handles frame skipping (4) at every iteration env = MainGymWrapper.wrap(gym.make(env_name)) self._main_loop( self._game_model(env.action_space.n), env) #, render, total_step_limit, total_run_limit, clip)
def _initialize_environmnt(self): self.env = MainGymWrapper.wrap(gym.make(self.env_name))
def main(): game_name = "Breakout-v0" env = MainGymWrapper.wrap(gym.make(game_name)) _main_loop(DDQNTrainer(game_name, INPUT_SHAPE, env.action_space.n), env)