Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Gym environment for Snake

Project description


Downloads PyPi Version Python Compatibility License

Contains a gym environment for the classic game snake.


  • env.render() is not implemented, running it will raise NotImplementedError.
  • env.reset() opens the GUI for the game.
  • env.fps contains the fps to run the game at. You can set it using:
    env.fps = 60


For the latest installation, run

git clone
pip install -e .

You can install the latest release by

pip install snake-gym

Creating The Environment

The environment can be created by doing the following:

import gym
import snake_gym
env = gym.make("snake-v0")


  • snake-v0 Returns a 150x150 RGB image in the form of a numpy array for the observations
  • snake-tiled-v0 Returns a 10x10 matrix for the observations.
    • 0 is empty space
    • 1 is the snake
    • 2 is the food

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for snake-gym, version 1.8
Filename, size File type Python version Upload date Hashes
Filename, size snake_gym-1.8-py3-none-any.whl (2.8 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page