This repo is a adaptation of Deep Policy Networks to play the game of Snake. It has been coded in Python using Tensorflow. To get started, you can have a look at our iPython notebook.
Below is a short demo. Note that the Snake dos not eat the fruit in the first place to avoid being trapped and loose the game. Have fun !
You can find the requirements in the file requirements.txt. All coding files can be found in the snake folder.
We implemented a simple snake envioronment (snake.py). To play it yourself and try to beat the best AI score, simply run
python demo_snake.py
We also implemented the policy network algorithm as described in our report in the file policy_gradient.py. You can try your own network structure (folder models). The pretrained weights are avilable in the weights folder (there is a warm_restart argument to the training function) and the output graphs are available in the graphs folder. To try our implementation, simply run
python demo_policy.py
The detailed theoretical explanations, the setup parameters and experimental results can be found in the report folder.