Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Paulescu
Last active April 26, 2022 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Paulescu/e105db173b581adc0b63a9593ac10e5a to your computer and use it in GitHub Desktop.
Save Paulescu/e105db173b581adc0b63a9593ac10e5a to your computer and use it in GitHub Desktop.
# create environment
import gym
env = gym.make('LunarLander-v2')
# create random agent
class RandomAgent:
def __init__(self, env):
self.env = env
def act(self, state) -> int:
"""
No input arguments to this function.
The agent does not consider the state of the environment when deciding
what to do next.
"""
return self.env.action_space.sample()
agent = RandomAgent(env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment