Source code for yawning_titan.agents.random

[docs]class RandomAgent(object): """ A simple implementation of a Random Agent capable of randomly acting within anOpenAI Gym environment. *Note: Both act and predict methods are provided to fit with different tutorials online that use different terminology for the same thing.* """
[docs] def __init__(self, action_space): self.action_space = action_space
[docs] def act(self, observation, reward, done): """Randomly sample an action from the action space.""" return self.action_space.sample()
[docs] def predict(self, observation, reward, done): """Randomly sample an action from the action space.""" return self.action_space.sample()