Skip to content

Instantly share code, notes, and snippets.

@fyr91
Last active November 12, 2019 10:14
Show Gist options
  • Save fyr91/0ec6a92aa7513ad83ceb3de59f777bb5 to your computer and use it in GitHub Desktop.
Save fyr91/0ec6a92aa7513ad83ceb3de59f777bb5 to your computer and use it in GitHub Desktop.
import gym
from gym import error, spaces, utils
from gym.utils import seeding
class FooEnv(gym.Env):
metadata = {'render.modes': ['human']}
def __init__(self):
# usually action and observation space will be defined here
# self.action_space = spaces.Discrete() ...
# self.observation_space = spaces.Box() ...
...
def step(self, action):
# step function will take action for each game step
...
def reset(self):
# reset an env state
...
def render(self, mode='human'):
# render env if needed
...
def close(self):
# properly close the env
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment