We wanted to make something that made use of reinforcement learning, and would be able to show its progress in fun and clear way

The bot plays snake - it must collect each apple on the screen wherever it spawns, and if it hits a wall or its own body it dies

The game itself was made with pygame, and the model was made with a deep q learning neural network with pytorch

Had to figure out how to have the bot play the game, which is a bit more complicated in comparison to just having the snake be controlled by user input

The agent is able to play snake, within the first games it will have no idea what to do but over time you can watch it improve and develop a strategy for improving its score, and it begins to avoid walls at all time

How to use pygame and pytorch, as well as how deep q learning neural networks work, as well as the various variables involved with predicting an action based off certain reward values and previous data

Was hoping to graph some of the neural network values but was unable to, so in the future this could be fixed - the bot itself cant seem to learn how to avoid hitting its own body quite often even after a fair amount of training, so it would be good to come up with a way to train it so it avoids this

Built With

Share this project:

Updates