/snake-gym

A gym environment for the game snake, with a tiled version. Contains implementations for NEAT and RL.

Primary LanguagePythonMIT LicenseMIT

Snake-Gym

Downloads PyPi Version Python Compatibility License

Contains a gym environment for the classic game snake.

Implementing

  • 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

Installation

For the latest installation, run

git clone https://github.com/vivek3141/snake-gym
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")

Environments

  • 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