mlpy.agents.modules.UserModule¶
-
class
mlpy.agents.modules.
UserModule
(events_map)[source]¶ Bases:
mlpy.agents.modules.IAgentModule
The user agent module.
With the user agent module the agent is controlled by the user via the keyboard or a PS2 controller. The mapping of keyboard/joystick keys to events is given through a configuration file.
Parameters: events_map : ConfigMgr
The configuration mapping keyboard/joystick keys to events that are translated into actions.
Example: { "keyboard": { "down": { "pygame.K_ESCAPE": "QUIT", "pygame.K_SPACE": [-1.0], "pygame.K_LEFT" : [-0.004], "pygame.K_RIGHT": [0.004] } } }
Notes
This agent module is requires the PyGame library.
Attributes
mid
The module’s unique identifier. Methods
choose_action
(_)Choose the next action. cleanup
()Exit the agent module. end
(experience)End the learning agent module. init
()Initialize the user agent module. is_complete
()Check if the agent module has completed. load
(filename)Load the state of the module from file. save
(filename)Save the current state of the module to file. start
()“Start an episode. step
(state)Execute the agent module. terminate
(value)Set the termination flag.