Skip to content

Nilusche/SnakeGym

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnakeGym

snake

I spend a while learning about Reinforcement Learning and Deep Q-Learning.
I implemented a SnakeGym openai environment and trained a DQN agent to play the game.
The agent was able to play the game with after 1.3 Million training episodes (took 12 hours to train and still is not optimal). For the future I will look into implementing asynchrounous training algorithms.

Quick link to Software Requirement Specification

SRS

Setup

Run pip install -e snake to register the environment.
Use agent.py as reference to register a different type of environment.
Run python DQN.py to restart training the DQN Agent.
Run python agent.py to showcase the training

Action space

0 = UP
1 = DOWN
2 = LEFT
3 = RIGHT

DQN

DQN.py contains a Deep Q-Learning Solution to an agent that learns through a Convolutional Neural Network.
Keras-rl2 is required to start training. Check this Repository for more info.
DQN.py saves the trained model at certain checkpoints (every 100000 Steps).

If you want to test the already trained model then just run agent.py.

Releases

No releases published

Packages

No packages published

Languages