src.plangym.videogames.montezuma
================================

.. py:module:: src.plangym.videogames.montezuma

.. autoapi-nested-parse::

   Implementation of the montezuma environment adapted for planning problems.



Attributes
----------

.. autoapisummary::

   src.plangym.videogames.montezuma.PYRAMID
   src.plangym.videogames.montezuma.OBJECT_PIXELS
   src.plangym.videogames.montezuma.KNOWN_XY
   src.plangym.videogames.montezuma.KEY_BITS


Classes
-------

.. autoapisummary::

   src.plangym.videogames.montezuma.MontezumaPosLevel
   src.plangym.videogames.montezuma.CustomMontezuma
   src.plangym.videogames.montezuma.MontezumaEnv


Module Contents
---------------

.. py:class:: MontezumaPosLevel(level, score, room, x, y)

   Contains the information of Panama Joe.


   .. py:attribute:: __slots__
      :value: ['level', 'room', 'score', 'tuple', 'x', 'y']



   .. py:attribute:: level


   .. py:attribute:: score


   .. py:attribute:: room


   .. py:attribute:: x


   .. py:attribute:: y


   .. py:attribute:: tuple
      :value: None



   .. py:method:: set_tuple()

      Set the tuple values from the other attributes.



   .. py:method:: __hash__()

      Hash the current instance.



   .. py:method:: __eq__(other)

      Compare equality between instances.



   .. py:method:: __getstate__()

      Return the tuple containing the attributes.



   .. py:method:: __setstate__(d)

      Set the class attributes using the provided tuple.



   .. py:method:: __repr__()

      Print the attributes of the current instance.



.. py:data:: PYRAMID

.. py:data:: OBJECT_PIXELS
   :value: [50, 40, 40, 40, 37, 37, 42]


.. py:data:: KNOWN_XY
   :type:  list[None | tuple[int, int]]

.. py:data:: KEY_BITS

.. py:class:: 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, render_mode = 'rgb_array', x_repeat = 1)

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


   .. py:attribute:: render_mode


   .. py:attribute:: score_objects


   .. py:attribute:: check_death


   .. py:attribute:: objects_from_pixels


   .. py:attribute:: objects_remember_rooms


   .. py:attribute:: only_keys


   .. py:attribute:: coords_obs


   .. py:attribute:: _x_repeat


   .. py:attribute:: _death_room_8


   .. py:attribute:: env


   .. py:attribute:: ram
      :value: None



   .. py:attribute:: cur_steps
      :value: 0



   .. py:attribute:: cur_score
      :value: 0



   .. py:attribute:: rooms


   .. py:attribute:: cur_lives
      :value: 5



   .. py:attribute:: pos


   .. py:method:: get_room_xy(room)
      :staticmethod:


      Get the tuple that encodes the provided room.



   .. py:method:: __getattr__(e)

      Forward to gym environment.



   .. py:method:: get_ram()

      Return the current RAM.



   .. py:method:: reset(seed=None, return_info = False)

      Reset the environment.



   .. py:method:: step(action)

      Step the environment.



   .. py:method:: pos_from_obs(face_pixels, obs)

      Extract the information of the position of Panama Joe.



   .. py:method:: get_objects_from_pixels(obs, room, old_objects)

      Extract the position of the objects in the provided observation.



   .. py:method:: get_coords()

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



   .. py:method:: state_to_numpy()

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



   .. py:method:: get_restore()

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



   .. py:method:: restore(data)

      Restore the state of the env from the provided tuple.



   .. py:method:: is_transition_screen(obs)

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



   .. py:method:: get_face_pixels(obs)

      Return the pixels containing the face of Paname Joe.



   .. py:method:: is_pixel_death(obs, face_pixels)

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



   .. py:method:: is_ram_death()

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



   .. py:method:: render(mode='human', **kwargs)

      Render the environment.



.. py:class:: 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)

   Bases: :py:obj:`plangym.videogames.atari.AtariEnv`


   Plangym implementation of the MontezumaEnv environment optimized for planning.


   .. py:attribute:: AVAILABLE_OBS_TYPES


   .. py:method:: _get_default_obs_type(name, obs_type)

      Return the observation type of the internal Atari gym environment.



   .. py:method:: init_gym_env()

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



   .. py:method:: get_state()

      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.



   .. py:method:: set_state(state)

      Set the internal state of the simulation.

      :param state: Target state to be set in the environment.

      :returns: None



