snake-gym is implementation of the classic game snake that is made as an OpenAI gym environment
- gym
- numpy
- torch
- Clone repository:
$ git clone https://github.com/Platun0v/snake-gym.git
cd
into snake-gym and run:pip install -r requirements.txt
To see pretrained snake run: python test.py
- load_path - path to neural network
- render - render process
- times - how many times to run
- seed - seed
- blocks - number of blocks on square grid
- block_size - the size of block in pixels
To train snake run: python train.py
- save_path - path to save neural network
- render - render process
- episodes - how many times to run
- seed - seed
- blocks - number of blocks on square grid
- block_size - the size of block in pixels
import gym
import gym_snake
env = gym.make('Snake-v0')
for i in range(100):
env.reset()
for t in range(1000):
env.render()
state, reward, done, info = env.step(env.action_space.sample())
if done:
print('episode {} finished after {} timesteps'.format(i, t))
break