Modelling Risk

Modelling Risk

As it happens with newspapers and scientific journals, the title of the article is essential to capture the reader’s attention. In fact, when I get into the TED talks website -if you don’t know what this is, I highly recommend you to google it- the title of the talk decides entirely what I watch.

There are many ways to interpret the title of this talk. From the context of this blog in overall, you would probably think that it should be about modelling uncertainty and risk of failure in wastewater treatment plants. I am very sorry to disappoint you, but this is also a blog where PhD students (which are amongst the craziest creatures in this world) come to relief stress by writing whatever happens in their lives. And in this case this is a story on how I ended up modelling risk… the board game.

Before I start the story, one fun fact people usually don’t know. Dice is a plural form. The singular form is die. E.g. I roll one die, you roll two dice. Alright, here we go.

It all happened a couple of weeks ago. I was playing the game of thrones themed risk (board game) with my girlfriend’s friends during her birthday. For those not familiar with the game, all you need to know is the battle system general rules: the attacker rolls 3 dice, the defender 2 dice. The dice values are sorted from high to low and then the first 2 values are compared against each other. In case of a tie, defender wins. As you can see, the attacking player has the advantage of rolling one extra die, but the defender wins in case of ties. Lastly, with each loss you remove one soldier of your soldier pool.

But beware! For these scoundrels play with one extra rule. The defender can choose to roll only one die instead of two if he decides so. This might come on handy if the attacker (which in this particular rule system also rolls the dice first) has a great roll, such as 6, 5, 5, etc. Instead of risking a bad roll and lose 2 soldiers, you may roll one die and lose only one soldier.

But is this really a good strategy? Let’s review the odds in the case of the attacker rolling a 6 and a 5.

1 die
In this case it is pretty clear, you have 1/6 (16.6%) chance of winning by rolling a 6, and 5/6 (83.3%) chance of losing.


2 dice
Now things get a little bit more complicated. The infographic below hopefully clarifies things, these are all the possible outcomes:


1, 1   2, 1   3, 1   4, 1   5, 1   6, 1
1, 2   2, 2   3, 2   4, 2   5, 2   6, 2
1, 3   2, 3   3, 3   4, 3   5, 3   6, 3
1, 4   2, 4   3, 4   4, 4   5, 4   6, 4
1, 5   2, 5   3, 5   4, 5   5, 5   6, 5
1, 6   2, 6   3, 6   4, 6   5, 6   6, 6

Win (attacker loses 2) Tie (one soldier each) Lose (Two soldiers lost)

In this case, the probability of winning is 3/36 (8.3%), lower than before, but you would kill 2 attacking soldiers. There is the probability of a tie in 9/36 (25%) of the cases, and losing is only in 24/36 (66.6%) of the cases, although we would lose 2 soldiers. To summarize:

___Strategy___|_______Win_______|______Tie_______|______Lose______|
1 die          16.6 % (attacker -1)          -           83.3% (defender -1)
2 dice         8.3% (attacker -2)    25% (-1 each)      66.6% (defender -2)

 

What can I say? The common opinion was that 1 die strategy was superior, but I was sceptical. However, after running the odds I still wasn’t sure which strategy was better, since they weren’t directly comparable. Also, my hypothesis was that you should roll one die when defending against two sixes, but not one 6 and one 5. And I also wanted to explore the threshold of usefulness of the strategy, what about 6 and 4? Or 6, 3?

Maybe someone more versed in statistics and analytical math could have solved this issue in no time, but I am not quite there yet.

Luckily, “I am a modeller” – wind blowing for dramatic effect.

Modelling is solving analytical math problems the hard way. I took python, my favourite programming language for environmental modelling, and step by step I created a risk simulator. I earn a living by modelling water resource recovery facilities, a board game should be feasible.

The first step was to create a dice simulator. Tons of examples available there. The second step was to write some code to store the rolls and the logic to compare them as I wanted. A few if/else statements did the trick, and the battle system was ready. I created a pool of 200 soldiers for each player and then run 100 rounds of attacks. All that was left was to run it with a Monte Carlo system to obtain a fair amount of simulations (10.000) of each 100 round battle. Once the battles were done, I subtracted the defending soldiers from the attacking. The more positive the number, the worst the strategy was performing. I also carried a few descriptive stats over the dataset.

I highly recommend plotting the data to verify your results. In this cases, I sorted and plotted each of the 10000 cases in ascending order. As you can see in the figure, the strategy of using only 1 die to defend against rolls of [6, 4]; [6, 5] and [6, 6] was better than using 1 die only against [6, 6]. But let us see some data to support the fact:

|___Strategy___|___Min-Max___|___Mean___|___Variance ___|___% pool size___|
1 die           -54, 56         2.55         208.9           1.2%
2 dice          -50, 69         10.99        256.6          5.5%

 

In order to make sure that my simulation was representative, I increased the size of the Monte Carlo simulation and the attacks rounds until I saw that the mean across trials didn’t vary more than 0.1. As you can see, in really long combats starting with 200 soldiers each, on average the attacker will win with 2.55 soldiers left if the defender uses the 1 die strategy, and 11 soldiers left with the 2 dice strategy. However, as the variance and the min and max values point out, there is quite a dispersion in the sample, and the outcome could be very different. But how often should we expect to end up in those extremes? Well, the shape of the figure should give you a hint about this, looks like not too often.

Take home message
I got carried away writing this blog entry. Truth is, as you have probably figured out by now, I am passionate about board games, statistics, modelling, python, and geeking around in general. But there is a lot of insight to be drawn from this modelling exercise.

Firstly, models can solve what analytical maths often cannot. We had a complex statistical problem that we didn’t know how to solve. We created a model of the real system, and then run simulations to try different strategies. In other words, a Decision Support Tool (DST) for Risk Board Game.

Second, in azar games, and whenever there is uncertainty, running Monte Carlo simulations is very useful to obtain representative results - which is basically taking the model and running it several times using a random generator. But the output is large, and needs to be analysed carefully. Statistics and data analysis skills are very important to interpret the results.

Plotting results is a very good way of analysing data, always think that humans have visual minds. But descriptive statistics will tell you things that plots won’t immediately. To be honest, I left the statistics part quite undone. It would have been interesting to plot the cumulative density function of the probability of each outcome. I might do this in another blog post, but if you liked the example, I recommend you to do some research on this.

Lastly, we didn’t really answer the question of: how good is one strategy over the other? In a pool of 200 soldiers, the 1 die strategy was 8.5 soldiers better. But 200 soldiers are unheard of. In most cases 10 is the maximum in a few territories that you see during the game. I run a few scenarios of 10 sized soldier pools, and the 1 die strategy was ahead by only half a soldier. Now that we have a DST, it would be interesting to check different situations, and maybe the psychological factor of making your opponent lose two soldiers in one shot.

Anyway, I hope you enjoyed this read as much as I did writing it.

Cheers!