gameboy_worlds.interface.runes_of_virtue.environments

 1from gameboy_worlds.emulation.runes_of_virtue.emulators import RunesOfVirtueEmulator
 2from gameboy_worlds.emulation.runes_of_virtue.trackers import (
 3    CoreRunesOfVirtueTracker,
 4    RunesOfVirtueOCRTracker,
 5)
 6from gameboy_worlds.interface.environment import (
 7    DummyEnvironment,
 8    Environment,
 9    TestEnvironmentMixin,
10    TrainEnvironmentMixin,
11)
12
13
14class RunesOfVirtueEnvironment(DummyEnvironment):
15    """
16    A basic Runes of Virtue Environment.
17    """
18
19    REQUIRED_EMULATOR = RunesOfVirtueEmulator
20    REQUIRED_STATE_TRACKER = CoreRunesOfVirtueTracker
21
22
23class RunesOfVirtueOCREnvironment(RunesOfVirtueEnvironment):
24    """
25    A Runes of Virtue Environment that includes OCR region captures and agent state.
26    """
27
28    REQUIRED_STATE_TRACKER = RunesOfVirtueOCRTracker
29    REQUIRED_EMULATOR = RunesOfVirtueEmulator
30
31    @staticmethod
32    def override_emulator_kwargs(emulator_kwargs: dict) -> dict:
33        Environment.override_state_tracker_class(
34            emulator_kwargs, RunesOfVirtueOCREnvironment.REQUIRED_STATE_TRACKER
35        )
36        return emulator_kwargs
37
38
39class RunesOfVirtueTestEnvironment(TestEnvironmentMixin, RunesOfVirtueOCREnvironment):
40    pass
41
42
43class RunesOfVirtueTrainEnvironment(TrainEnvironmentMixin, RunesOfVirtueOCREnvironment):
44    pass
class RunesOfVirtueEnvironment(typing.Generic[~ObsType, ~ActType]):
15class RunesOfVirtueEnvironment(DummyEnvironment):
16    """
17    A basic Runes of Virtue Environment.
18    """
19
20    REQUIRED_EMULATOR = RunesOfVirtueEmulator
21    REQUIRED_STATE_TRACKER = CoreRunesOfVirtueTracker

A basic Runes of Virtue Environment.

The highest level emulator that the environment can interface with.

The state tracker that tracks the minimal state information required for the environment to function.

class RunesOfVirtueOCREnvironment(typing.Generic[~ObsType, ~ActType]):
24class RunesOfVirtueOCREnvironment(RunesOfVirtueEnvironment):
25    """
26    A Runes of Virtue Environment that includes OCR region captures and agent state.
27    """
28
29    REQUIRED_STATE_TRACKER = RunesOfVirtueOCRTracker
30    REQUIRED_EMULATOR = RunesOfVirtueEmulator
31
32    @staticmethod
33    def override_emulator_kwargs(emulator_kwargs: dict) -> dict:
34        Environment.override_state_tracker_class(
35            emulator_kwargs, RunesOfVirtueOCREnvironment.REQUIRED_STATE_TRACKER
36        )
37        return emulator_kwargs

A Runes of Virtue Environment that includes OCR region captures and agent state.

The state tracker that tracks the minimal state information required for the environment to function.

The highest level emulator that the environment can interface with.

@staticmethod
def override_emulator_kwargs(emulator_kwargs: dict) -> dict:
32    @staticmethod
33    def override_emulator_kwargs(emulator_kwargs: dict) -> dict:
34        Environment.override_state_tracker_class(
35            emulator_kwargs, RunesOfVirtueOCREnvironment.REQUIRED_STATE_TRACKER
36        )
37        return emulator_kwargs

Override default emulator keyword arguments for this environment.

Override this method in subclasses to modify the default emulator keyword arguments.

You may want to use override_state_tracker_class or that style to ensure compatibility of state tracker classes.

Arguments:
  • emulator_kwargs (dict): Incoming emulator keyword arguments.
Returns:

dict: The overridden emulator keyword arguments.

class RunesOfVirtueTestEnvironment(typing.Generic[~ObsType, ~ActType]):
40class RunesOfVirtueTestEnvironment(TestEnvironmentMixin, RunesOfVirtueOCREnvironment):
41    pass

Mixin class for testing environments. Ensures the State Tracker used is a TestTrackerMixin and checks these for termination / truncation.

class RunesOfVirtueTrainEnvironment(typing.Generic[~ObsType, ~ActType]):
44class RunesOfVirtueTrainEnvironment(TrainEnvironmentMixin, RunesOfVirtueOCREnvironment):
45    pass

Mixin class for training environments. Records the allowed initial states for training and random shuffles between them when resetting.