An introduction to reinforcement learning: Snake your way out of a paper bag

Frances Buontempo

⏱ 90 minute session
beginner
intermediate
14:00-15:30, Thursday, 3rd April 2025
When people talk about AI they tend to mean LLMs, so this talk will to remind us of other approaches to AI. Reinforcement learning (RL) is a type of machine learning, so part of AI. An "agent" takes actions in a dynamic environment. Better outcomes are rewarded and worse outcomes are penalised. RL can be used for targeted marketing, infrastructure optimisation or making financial decisions. RL has also been used to learn to play Go and PacMan. We won't have time for these, so we will implement Snake instead and see if the machine can learn to play the game. We'll see some code, and come away with an understanding of machine learning in general and RL in particular. This is a fun opportunity to learn and revise some C++, tracking better outcomes and probabilistically choosing moves (think using random numbers). We will start with a std::vector and progress from there. Come along and practice some C++ and learn some AI on the way. I'll look at vanilla Q-learning, which just uses a table of data. You can extend this to deep Q-learning, using a neural network, which I probably won't have time to cover. Implementing something yourself is a great way to learn, both your chosen language and the thing you are implementing.
🏷 artificial intelligence
🏷 reinforcement learning
🏷 algorithms
🏷 C++ practice

Frances Buontempo

Frances Buontempo is currently editor of the ACCU’s Overload magazine, has written a book on Genetic Algorithms and Machine Learning, and a C++ book to help you catch up since C++11. She has worked as a programmer at various companies, mostly in London with a focus on finance. She enjoys testing and deleting code and tries to keep on learning.