EuroPython 2017

Developing a self-learning snake game using Reinforcement Learning

Speaker(s) Satwik Kansal
Sub Community: PyData

Almost everyone would have played that classic Snake game by Nokia in the early 2000s.

After this beginner-friendly training session, the audience will be able to develop their own Snake game with self-learning capabilities.

First 60 min: This section will focus on developing a classic snake game using pygame framework. The section also covers basic concepts and terminologies used in the game development.

Next 75 min: In this section, the audience is introduced to Reinforcement Learning (RL) and some of the standard terms and concepts like Agents, state, policy, etc. We will implement Q-Learning (an RL technique) to develop an Agent that Learns to play the snake game and gets smarter with every move by learning ‘policies’ and ‘strategies.’

Last 45 min: In this section, we discuss in brief other interesting RL techniques like SARSA, Deep Q-Networks, and their implementation insights. We’ll talk through the design self-driving car simulation implemented using pygame and Q-Learning. The session will conclude with the discussion about Applications of RL, and usage of platforms like OpenAI Gym and Universe for measuring and training an AI’s general intelligence across myriad of games, websites and other applications.

Code sample: snake-game


  1. Gravatar
    Totally must see!
    — Alejandro Solano,

New comment