I’ve used much of lockdown as an opportunity to teach myself Python, the computer coding language. I started lockdown as an absolute beginner and am now a fan. I’ve found that giving myself projects and problems to solve has been the most effective way of learning, so I was pleased to be challenged with a new project by some colleagues recently.

A conversation with Rob Eastaway* (maths author and speaker) inspired me to use my newly acquired Python skills to investigate which area of the dartboard it was best for players of different skill levels to aim at. Rob’s own analysis of this question can be read in his book ‘The Hidden Mathematics of Sport’. He and co-author John Haigh mathematically analysed the numbers on the board to reach their conclusions.

My dart board project reassuringly reaches roughly the same conclusions, but achieves this by means of computer simulation and repeated trials, rather than with a purely mathematical approach. In this post I write briefly about how my program works and share my code.

**The maths behind the code**

My program simulates a player throwing a dart at the dart board. The player has a variable skill level and they are aiming for a target on the board that can be varied.

When a player takes a shot, the computer chooses an x coordinate and a y coordinate for the shot to land at. A normal distribution centred around the x coordinate of the target is used to generate the x coordinate of the shot, and a second normal distribution is used to generate the y coordinate of the shot. We set the skill level of the player and the target they are aiming at when we decide the standard deviation and the mean of the normal distribution, respectively. A high standard deviation means a poor player – a player whose shots will deviate greatly from the target they are aiming at.

Once the computer has generated an x and y coordinate for the shot, we then need the program to calculate the score that we would get for landing a dart in that position. To do this we first need to convert the cartesian coordinate into polar form because the score is dictated by the distance of the shot radially from the centre, and by its angle from the horizontal. Once we have the shot coordinate in polar form, we can use a look up system to find the score that shot is worth.

Now that we can simulate a single dart being thrown and return the score that that shot would equate to, we can do this for 10,000 shots and find the average score that those shots achieved. Repeating this experiment for lots of different targets on the board (the program allows the user to choose these targets in polar form), and for many different skill levels, means we can find for each skill level, which target gave the player the highest average score.

The next step was to illustrate this information visually. I first drew a dart board in Python to ensure it had the right proportions (most of the images I found on the internet were not proportional to a professional dart board). Then for each skill level, I plotted a circle on any of the targets that gave an average score in the top 5% of scores for that player. The size of the circles indicates the average score for that target, relative to the others shown.

**The results**

As an example, the image below shows where a medium level player should target. The top place to aim at for a player with this specific skill level came out to be triple 7 (it has the biggest circle), but the other targets shown also gave very good scores that were not much different.

The animation below takes the image created for each skill level and plays them together (with the help of a GIF creating website). The animation starts by showing us where a professional player should aim and ends by showing us where an awful player should aim.

We learn from the animation that only the very best players should aim for triple 20, followed by ‘good’ players aiming for triple 19. Medium players should aim for generally around the 8/11/16 sectors, and as players get worse they should aim closer and closer to the centre. The worst players should aim dead centre as this gives them the highest chance of getting the dart on the board.

The code also visualises what 10,000 shots at a particular target by a player of a particular skill level, looks like.

The image below shows what it looks like when a professional player takes 10,000 shots aiming at triple 20.

And the image below shows what it looks like when a good, but not excellent, player aims at triple 20. The high likelihood that their shot will land in the low scoring 5 or 1 sectors explains why only the very best players should aim for triple 20!

For anyone interested to see all the code, I’ve shared it here:

https://github.com/zoelgriffiths/Darts

Enjoy your next game of darts with this analysis in mind!

*In fact, it was Ben Sparks who suggested I use Python to investigate the question that Rob raised in the conversation. Thanks Ben!