McLAREN Substitute Teacher
Welcome to the McLaren Maze Race!
This is a fun introduction to Artificial Intelligence (AI) and Machine Learning, suitable for all ages and abilities. Whether you are an AI newbie or a total pro, you will find something here that suits.
The Maze Race was created to go alongside season 2 of McLaren Substitute Teacher, a collaboration with Dell Technologies. You can watch the videos on our YouTube channel.
As you move through the four levels of the McLaren Maze Race, you will build an AI capable of learning to drive a car, navigate a maze, deal with F1 features such as the safety car, DRS and pit-stops, and master racing in the rain. You can choose just to read through the explanations, to run the interactive code snippets and watch the AI learn, or to get involved and try to improve the AI to achieve even better results.
Want to dive in with no explanation? Click this link to get started.
Here's an example of what your AI can do, if you reach the final level.
The Maze Race introduces several key aspects of AI/Machine Learning, whilst also presenting a fun challenge. If you work through all the levels you will implement algorithms from across the field of AI: supervised learning, unsupervised learning, and reinforcement learning.
Once you complete level 3, 'Rookie Driver', you will be able to submit your own code to the online challenge below. This will pit your AI driver against other drivers from across the world to fight it out for the Maze Race Championship title! The best submitted code will also win an official McLaren team polo shirt signed by both our drivers.Â
The mazes
The mazes your AI will have to navigate are set in a grid world. They only have a single correct path from the start, somewhere in the first row, to the finish in the bottom right corner. However, there are several branches along the way — where the wrong choice in direction will lead to a dead end. The maze will initially be hidden from the AI driver, who will only be able to see as far as the nearest wall in front, to the sides, and behind. As you reach higher levels the mazes get more complex and introduce new challenges, such as DRS and rain.
The car
Before dealing with the challenge of the mazes, your AI will first have to learn to control the car. Even at the simplest level the car is tricky to handle - accelerating too hard will spin the wheels, braking too hard will cause a lock-up, and turning without enough grip will spin you into the maze wall! There are seven major actions that your AI can take to control the car, and it will have to learn the correct action to take at each point. This is based on current speed, track position, and other variables, such as whether the DRS is open.
• Light Throttle - gently accelerate the car towards max speed
• Full Throttle - maximum acceleration
• Light Braking - gently slow the car down
• Heavy Braking - greatly reduce the car's speed
• Turn Left - 90 degree turn to the car's left
• Turn Right - 90 degree turn to the car's right
• Continue - continue forward at the same speed
The levels
Level 1 - Learner Driver: An introduction to the Maze Race. Create a driver based on the model-free reinforcement learning algorithm Q Learning, capable of learning to accelerate & brake the car to safely navigate a basic maze
Level 2 - Young Driver: In this level we introduce the more complex mazes that we will be tackling from this point onwards. We look at some more parameters of the learning algorithm and introduce the Safety Car to the races.
Level 3 - Rookie Driver: Here we switch to model-based RL, learning models of the car's dynamics to better control it with minimal data. We also introduce DRS activation points at various points around the maze. After completing this level you can take part in the online challenge if you wish.
Level 4 - Pro Driver: One of the most important parameters in F1 is grip, and in this level we introduce various parameters that affect this, including choice of tyres and rain. If your AI can master this, it will earn the Pro Driver title!
Getting started
The code base for the McLaren Maze Race is hosted on GitHub.
The main interaction points are a series of Jupyter notebooks, and there's one for each level. There are various ways you can get stuck in:
• View and run the notebooks on MyBinder. You will be able to run through all the levels, reading the explanations and running the code examples to see the AI learn. Click here to launch the workspace and then click on the four levels starting with 'level1_learnerdriver.ipynb'. You won't be able to save any edits you make though, so if you want to get stuck into designing your own AI then you will need the next option.
• Download the repository from GitHub. This gives you full access to all the code and you can run and edit it on your own computer. You will need Python installed on your computer, but look out for the 'getting_started.txt' text file, which will walk you through all the steps you need to take.
The code is written in Python 3.8. If you just want to run through the levels without touching the code then no knowledge of coding is required. If you want to start playing with the AI to add your own improvements you will find it helpful to run through a Python introduction if you are unfamiliar with the language.
The challenge
For level 3 and above, you can submit your own driver AI to compete against others from across the world. To do this please follow the instructions here.The challenge will end when the chequered flag falls in Abu Dhabi on 12 December, so make sure you get your drivers in before then!
The Online Championship consists of a season of 24 unseen tracks, with cars that will have slightly different dynamics to those you find in the repository. All relationships that you have discovered within the data will remain, although their exact parameters will change. This means your AI needs to be able to learn, and you must be careful of overfitting.
After you submit your driver code, it will be checked and then run against on the unseen Championship tracks. At some point afterwards your driver will appear on the leaderboard below.
We really hope you enjoy the McLaren Maze Race and learn something along the way. We would love to hear your thoughts and how you got on, so even if you don't want to submit any code please do pass on some feedback using this form.