In this Python Reinforcement Learning Project I build an AI and then teach it to play Snake! I build everything using Pygame and PyTorch.
Key steps:
- Implement the Snake game.
- Implement the Agent that controls the game.
- Implement the neural network to predict the moves and train it.
Model haven't beat its own record but it gets better averaged results every game
TODO:
- Avoid the AI to trap itself
- Don't let her get in a loop for too long
- Increase game speed to increase training speed
I have used Anaconda to create the python env
conda create -n pygame_env python=3.7
I used pyGame to create the game environment
pip install pygame
I used pyTorch to create the model
pip install torch torchvision
Extra deps:
pip install matplotlib ipython