OakEmuEnv
python
OakEmuEnv(game_configuration: GameConfiguration, model_configuration: ModelConfiguration, training_configuration: TrainingConfiguration | None, observation_shape_order: Literal['hwf', 'fhw'], training_mode: TrainingMode = TrainingMode.TRAINING, render_mode: Literal['rgb_array'] | None = None, dump_directory: str | PathLike | None = None) -> NoneInitialize the OakEmuEnv.
Parameters:
game_configuration(GameConfiguration) – The game configuration.model_configuration(ModelConfiguration) – The model configuration.observation_shape_order(Literal['hwf', 'fhw']) – The order of dimensions in the observation shape.training_mode(TrainingMode) – The training mode.render_mode(Literal['rgb_array'] | None) – Optional rendering mode.dump_directory(str | PathLike | None) – Optional directory for environment dumps.
Properties
action_shape
python
action_shape: intGet the size of the action space.
Returns:
int– The number of discrete actions.
observation_shape
python
observation_shape: tuple[int, int, int]Get the observation shape.
Returns:
tuple[int, int, int]– The shape of the observations.
spectrum
python
spectrum: ZXSpectrumGet the underlying ZXSpectrum instance.
Returns:
ZXSpectrum– The ZXSpectrum instance.
training_mode
python
training_mode: TrainingModeGet the training mode.
Returns:
TrainingMode– The training mode.
Methods
get_integer_data
python
get_integer_data(name: str) -> intRetrieve custom integer data from the environment.
Parameters:
name(str) – The name of the data field.
Returns:
int– The integer value.
render
python
render() -> gym.core.RenderFrame | list[gym.core.RenderFrame] | NoneRender the current state of the environment.
Returns:
RenderFrame | list[RenderFrame] | None– The rendered frame, or None ifrender_modeis not set.
reset
python
reset(*, seed: int | None = None, options: dict[str, Any] | None = None, initial_state: bytes | None = None) -> tuple[np.ndarray, dict[str, Any]]Reset the environment.
Parameters:
seed(int | None) – Optional random seed.options(dict[str, Any] | None) – Optional reset options.initial_state(bytes | None) – Optional serialised emulator state to reset from.
Returns:
tuple[ndarray, dict[str, Any]]– A tuple containing the initial observation and an empty info dictionary.
serialize_state
python
serialize_state() -> bytesSerialise the emulator's current machine state.
The bytes are the same form a snapshot restart restores from (reset(initial_state=...)), so a state captured mid-replay can seed a midpoint restart later.
Returns:
bytes– The serialised machine state.
step
python
step(action: int | np.integer) -> tuple[np.ndarray, float, bool, bool, dict[str, Any]]Perform an action in the environment.
Parameters:
action(int | integer) – The action to perform.
Returns:
tuple[ndarray, float, bool, bool, dict[str, Any]]– A tuple of (observation, reward, terminated, truncated, info).
Values
action_space
python
action_space: gym.spaces.Discrete = gym.spaces.Discrete(self._environment.ActionSpace)metadata
python
metadata = {'observation_shape_orders': ['hwf', 'fhw'], 'render_modes': ['rgb_array'], 'render_fps': float(DotNetDecimal.ToDouble(DotNetZXSpectrum.FrameRate))}observation_space
python
observation_space: gym.spaces.Box = gym.spaces.Box(low=self._environment.ObservationSpace.Low, high=self._environment.ObservationSpace.High, dtype=dot_net_type_to_dtype(self._environment.ObservationSpace.Type).type, shape=self._observation_shape)Gymnasium environment for OakEmu.
render_mode
python
render_mode = render_mode