plangym.videogames.nes
Environment for playing Mario bros using gym-super-mario-bros.
Module Contents
Classes
Environment for working with the NES-py emulator. |
|
Interface for using gym-super-mario-bros in plangym. |
Attributes
- plangym.videogames.nes.RIGHT_ONLY = [['NOOP'], ['right'], ['right', 'A'], ['right', 'B'], ['right', 'A', 'B']]
- plangym.videogames.nes.SIMPLE_MOVEMENT = [['NOOP'], ['right'], ['right', 'A'], ['right', 'B'], ['right', 'A', 'B'], ['A'], ['left']]
- plangym.videogames.nes.COMPLEX_MOVEMENT = [['NOOP'], ['right'], ['right', 'A'], ['right', 'B'], ['right', 'A', 'B'], ['A'], ['left'],...
- class plangym.videogames.nes.NesEnv(name, frameskip=5, episodic_life=False, autoreset=True, delay_setup=False, remove_time_limit=True, obs_type='rgb', render_mode=None, wrappers=None, **kwargs)[source]
Bases:
plangym.videogames.env.VideogameEnv
Environment for working with the NES-py emulator.
- Parameters
name (str) –
frameskip (int) –
episodic_life (bool) –
autoreset (bool) –
delay_setup (bool) –
remove_time_limit (bool) –
obs_type (str) –
render_mode (Optional[str]) –
wrappers (Iterable[plangym.core.wrap_callable]) –
- property nes_env(self)
Access the underlying NESEnv.
- Return type
NESEnv
- get_image(self)[source]
Return a numpy array containing the rendered view of the environment.
Square matrices are interpreted as a greyscale image. Three-dimensional arrays are interpreted as RGB images with channels (Height, Width, RGB)
- Return type
numpy.ndarray
- get_state(self, state=None)[source]
Recover the internal state of the simulation.
A state must completely describe the Environment at a given moment.
- Parameters
state (Optional[numpy.ndarray]) –
- Return type
numpy.ndarray
- class plangym.videogames.nes.MarioEnv(name, movement_type='simple', original_reward=False, **kwargs)[source]
Bases:
NesEnv
Interface for using gym-super-mario-bros in plangym.
- Parameters
name (str) –
movement_type (str) –
original_reward (bool) –
- AVAILABLE_OBS_TYPES
- MOVEMENTS
- get_state(self, state=None)[source]
Recover the internal state of the simulation.
A state must completely describe the Environment at a given moment.
- Parameters
state (Optional[numpy.ndarray]) –
- Return type
numpy.ndarray
- init_gym_env(self)[source]
Initialize the
NESEnv`
instance that the current class is wrapping.- Return type
gym.Env
- get_coords_obs(self, obs, info=None, **kwargs)[source]
Return the information contained in info as an observation if obs_type == “info”.
- Parameters
obs (numpy.ndarray) –
info (Dict[str, Any]) –
- Return type
numpy.ndarray
- process_reward(self, reward, info, **kwargs)[source]
Return a custom reward based on the x, y coordinates and level mario is in.
- Return type
float