Teach AI To Play Snake - Practical Reinforcement Learning With PyTorch And Pygame

Patrick Loeber

In this Python Reinforcement Learning Tutorial series we teach an AI to play Snake! We build everything from scratch using Pygame and PyTorch. The tutorial consists of 4 parts:

The code is available on GitHub.

I hope you enjoy this tutorial!

What is Reinforcment Learning?

Reinforcement learning (RL) is an area of machine learning concerned with how software agents ought to take actions in an environment in order to maximize the notion of cumulative reward.

A simpler definition: RL is teaching a software agent how to behave in an environment by telling it how good it’s doing.

What is Deep Q Learning?

Deep Q Learning extends Reinforcement Learning by using a deep neural network to predict the actions.

FREE VS Code / PyCharm Extensions I Use

✅ Write cleaner code with Sourcery, instant refactoring suggestions: Link *

* This is an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you! 🙏

Check out my Courses