This is the source code I made for a medium article and a YouTube video.
model.py
A class that implements RL. The idea is that we can plug it in to different situations and can quickly create a model for it.
game.py
A class that contains all functions to play and train on the classic Snake game.
training.py/training.ipynb
This is were the training is done. This combines both game and model.
snake_game.py
A graphic representation of the snake game. You can either play yourself or have a trained model play for you (manual
variable)
To open the ipynb file, you can use jupyter notebook or Visual Studio Code with the Jupyter extension.
Note that the training.py
is almost identical to the training.ipynb
file so you can also use that one instead.