mlpy.agents.modules.UserModule¶
-
class
mlpy.agents.modules.
UserModule
(events_map, niter=None)[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] } } }
niter : int
The number of episodes to capture..
Notes
This agent module is requires the PyGame library.
Attributes
mid
The module’s unique identifier. Methods
enter
(t)Enter the module and perform initialization tasks. execute
(state)Execute the agent module. exit
()Exit the agent module. get_next_action
()Return the next action. is_complete
()Check if the agent module has completed. load
(filename)Load the state of the module from file. reset
(t, **kwargs)Reset the module for the next iteration. save
(filename)Save the current state of the module to file. terminate
(value)Set the termination flag. update
(dt)Update the module at every delta time step dt.