plangym.videogames.montezuma

Implementation of the montezuma environment adapted for planning problems.

Module Contents

Classes

MontezumaPosLevel

Contains the information of Panama Joe.

CustomMontezuma

MontezumaEnv environment that tracks the room and position of Panama Joe.

MontezumaEnv

Plangym implementation of the MontezumaEnv environment optimized for planning.

Attributes

PYRAMID

OBJECT_PIXELS

KNOWN_XY

KEY_BITS

class plangym.videogames.montezuma.MontezumaPosLevel(level, score, room, x, y)[source]

Contains the information of Panama Joe.

__slots__ = ['level', 'score', 'room', 'x', 'y', 'tuple']
set_tuple(self)[source]

Set the tuple values from the other attributes.

__hash__(self)[source]

Hash the current instance.

__eq__(self, other)[source]

Compare equality between instances.

__getstate__(self)[source]

Return the tuple containing the attributes.

__setstate__(self, d)[source]

Set the class attributes using the provided tuple.

__repr__(self)[source]

Print the attributes of the current instance.

plangym.videogames.montezuma.PYRAMID = [None, None, None, [15, 16, 17, 18, 19, 20, 21, 22, 23]]
plangym.videogames.montezuma.OBJECT_PIXELS = [50, 40, 40, 40, 37, 37, 42]
plangym.videogames.montezuma.KNOWN_XY
plangym.videogames.montezuma.KEY_BITS
class plangym.videogames.montezuma.CustomMontezuma(check_death=True, obs_type='rgb', score_objects=False, objects_from_pixels=False, objects_remember_rooms=False, only_keys=False, death_room_8=True)[source]

MontezumaEnv environment that tracks the room and position of Panama Joe.

Parameters
  • check_death (bool) –

  • obs_type (str) –

  • score_objects (bool) –

  • objects_from_pixels (bool) –

  • objects_remember_rooms (bool) –

  • only_keys (bool) –

  • death_room_8 (bool) –

__getattr__(self, e)[source]

Forward to gym environment.

reset(self, seed=None, return_info=False)[source]

Reset the environment.

Parameters

return_info (bool) –

Return type

numpy.ndarray

step(self, action)[source]

Step the environment.

Return type

Tuple[numpy.ndarray, float, bool, dict]

pos_from_obs(self, face_pixels, obs)[source]

Extract the information of the position of Panama Joe.

Return type

MontezumaPosLevel

get_objects_from_pixels(self, obs, room, old_objects)[source]

Extract the position of the objects in the provided observation.

get_coords(self)[source]

Return an observation containing the position and the flattened screen of the game.

Return type

numpy.ndarray

state_to_numpy(self)[source]

Return a numpy array containing the current state of the game.

Return type

numpy.ndarray

_restore_state(self, state)[source]

Restore the state of the game from the provided numpy array.

Return type

None

get_restore(self)[source]

Return a tuple containing all the information needed to clone the state of the env.

Return type

tuple

restore(self, data)[source]

Restore the state of the env from the provided tuple.

Return type

None

is_transition_screen(self, obs)[source]

Return True if the current observation corresponds to a transition between rooms.

Return type

bool

get_face_pixels(self, obs)[source]

Return the pixels containing the face of Paname Joe.

Return type

set

is_pixel_death(self, obs, face_pixels)[source]

Return a death signal extracted from the observation of the environment.

is_ram_death(self)[source]

Return a death signal extracted from the ram of the environment.

Return type

bool

get_pos(self)[source]

Return the current pos.

Return type

MontezumaPosLevel

static get_room_xy(room)[source]

Get the tuple that encodes the provided room.

Return type

Tuple[Union[None, Tuple[int, int]]]

static get_room_out_of_bounds(room_x, room_y)[source]

Return a boolean indicating if the provided tuple represents and invalid room.

Return type

bool

static get_room_from_xy(room_x, room_y)[source]

Return the number of the room from a tuple.

Return type

int

static make_pos(score, pos)[source]

Create a MontezumaPosLevel object using the provided data.

Return type

MontezumaPosLevel

render(self, mode='human', **kwargs)[source]

Render the environment.

Return type

Union[None, numpy.ndarray]

class plangym.videogames.montezuma.MontezumaEnv(name='PlanMontezuma-v0', frameskip=1, episodic_life=False, autoreset=True, delay_setup=False, remove_time_limit=True, obs_type='rgb', mode=0, difficulty=0, repeat_action_probability=0.0, full_action_space=False, render_mode=None, possible_to_win=True, wrappers=None, array_state=True, clone_seeds=True, **kwargs)[source]

Bases: plangym.videogames.atari.AtariEnv

Plangym implementation of the MontezumaEnv environment optimized for planning.

Parameters
  • frameskip (int) –

  • episodic_life (bool) –

  • autoreset (bool) –

  • delay_setup (bool) –

  • remove_time_limit (bool) –

  • obs_type (str) –

  • mode (int) –

  • difficulty (int) –

  • repeat_action_probability (float) –

  • full_action_space (bool) –

  • render_mode (Optional[str]) –

  • possible_to_win (bool) –

  • wrappers (Iterable[plangym.core.wrap_callable]) –

  • array_state (bool) –

  • clone_seeds (bool) –

AVAILABLE_OBS_TYPES
_get_default_obs_type(self, name, obs_type)[source]

Return the observation type of the internal Atari gym environment.

Return type

str

init_gym_env(self)[source]

Initialize the gum.Env` instance that the current clas is wrapping.

Return type

CustomMontezuma

get_state(self)[source]

Recover the internal state of the simulation.

If clone seed is False the environment will be stochastic. Cloning the full state ensures the environment is deterministic.

Return type

numpy.ndarray

set_state(self, state)[source]

Set the internal state of the simulation.

Parameters

state (numpy.ndarray) – Target state to be set in the environment.

Returns

None