Python Engineer

Python and Machine Learning Tutorials

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

22 Dec 2020

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.