Skip to content

🐍 Clone of the classic Snake game as an OpenAI Gym environment

Notifications You must be signed in to change notification settings

seanbae/gym-snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gym-snake

  1. Clone the repo:
$ git clone git@github.com:SeanBae/gym-snake.git
  1. cd into gym-snake and run:
$ pip install -e .
  1. This should run total 100 instances of the snake-v0 environment for 1000 timesteps, rendering the environment at each step. By default, you should see a window pop up rendering the classic Snake problem:
import gym
import gym_snake

env = gym.make('snake-v0')

for i in range(100):
    env.reset()
    for t in range(1000):
        env.render()
        observation, reward, done, info = env.step(env.action_space.sample())
        if done:
            print('episode {} finished after {} timesteps'.format(i, t))
            break

About

🐍 Clone of the classic Snake game as an OpenAI Gym environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages