This answers the fivethirtyeight.com Riddler challenge this week. The question asks which one will result in the highest value:
First lets see what the answer is computationally:
n_simulations <- 100000
# create a rolling function
roll <- function(n_rolls = n_simulations, sides = 20){ ceiling(sides * runif(n_rolls)) }
# find the result of many simulations
one_die <- roll()
aod <- pmax( pmin(roll(), roll()), pmin(roll(), roll()) )
doa <- pmin( pmax(roll(), roll()), pmax(roll(), roll()) )
The expected value of
| rule | average result |
|---|---|
| one die | 10.48895 |
| “advantage of disadvantage” | 9.84978 |
| “disadvantage of advantage” | 11.17548 |
So clearly disadvantage of advantage is the winner.
But let’s think about the logic of why this is so.
Imagine four rolls of the die, ordered such that: \[a \ge b \ge c \ge d \]
then these can be grouped into pairs in only 3 ways, with the following results:
| pairing | AOD rule | DOA rule | which is higher (or equal to)? |
|---|---|---|---|
| ab, cd | \(b \ge d\) | \(c \le a\) | AOD |
| ac, bd | \(c \ge d\) | \(b \le a\) | DOA |
| ad, bc | \(c \ge d\) | \(b \le a\) | DOA |
From above, two out of three times, the DOA result will be either greater than or equal to the AOD result.
Rolling one die, should be in the middle of the two on average. There are many ways to think about why, but here’s one: each number has an equal chance of being selected, so should be on average lower than a rule that has a 2/3 chance of picking the second-highest of four numbers; and would be higher on average than a rule has a 2/3 chance of picking the second-lowest of four numbers.
First let’s look at the emperical distribution of results under the three rules:
# plot the result
library(ggplot2)
ggplot(data.frame(aod)) + geom_freqpoly(aes(x=aod, colour="Advantage of Disadvantage"), bins=20) +
geom_freqpoly(aes(x=doa, colour="Disadvantage of Advantage"), bins=20) + geom_freqpoly(aes(x = one_die, colour = "One Die"), bins=20) +
scale_colour_manual(name="rule", values = c("Advantage of Disadvantage" = "blue", "Disadvantage of Advantage" = "red", "One Die" = "black")) +
xlab("result of roll")
and the emperical cumulative distribution:
Unsurprisingly, “disadvantage of advantage” is still always a better bet than “advantage of disadvantage” no matter what your target is, but depending on your target, rolling one die might sometimes be better.
Let’s use binomial expansion.
The chance of rolling greater than or equal to N is \[\frac{(21-N)}{20}\]
and the chance of rolling greater than or equal to N, on x or more out of 4 dice, is \[\displaystyle \sum_{n=x}^{4} \binom{4}{n} \frac{(21-N)^n}{20^n} \frac{(N-1)^{4-n}}{20^{4-n}}\]
From the logic section above, if we want N or higher using “disadvantage of advantage” rule, then 2/3 of the time we only need the top 2 dice to be N or larger (although rolling 3 or all four dice equal to or greater than N will also count), and 1/3 of the time we need to get at least 3 of the 4 dice to show N or higher.
Therefore the chance of getting a score of N or more in “disadvantage of advantage” is \[\displaystyle (1/3) \sum_{n=3}^{4} \binom{4}{n} \frac{(21-N)^n}{20^n} \frac{(N-1)^{4-n}}{20^{4-n}} + (2/3) \sum_{n=2}^{4} \binom{4}{n} \frac{(21-N)^n}{20^n} \frac{(N-1)^{4-n}}{20^{4-n}}\] We can find what values of N make this is greater than 10.5 using an inequality, but why go through the trouble when we use a calculator?
p_aod <- function(N){
(1/3) * ( 4 * (21-N)^3 * (N-1) + 1 * (21-N)^4 ) / (20^4) +
(2/3) * ( 6 * (21-N)^2 * (N-1)^2 + 4* (21-N)^3 * (N-1) + 1 * (21-N)^4 ) / (20^4)
}
p_1die <- function(N){ (21 - N)/20 }
print(data.frame(
target = 1:20,
better_rule = ifelse(p_aod(1:20) == p_1die(1:20), "EQUAL",
ifelse(p_aod(1:20) > p_1die(1:20), "ADV. OF DISADV", "ONE DIE"))
))
## target better_rule
## 1 1 EQUAL
## 2 2 ADV. OF DISADV
## 3 3 ADV. OF DISADV
## 4 4 ADV. OF DISADV
## 5 5 ADV. OF DISADV
## 6 6 ADV. OF DISADV
## 7 7 ADV. OF DISADV
## 8 8 ADV. OF DISADV
## 9 9 ADV. OF DISADV
## 10 10 ADV. OF DISADV
## 11 11 ADV. OF DISADV
## 12 12 ADV. OF DISADV
## 13 13 ADV. OF DISADV
## 14 14 ONE DIE
## 15 15 ONE DIE
## 16 16 ONE DIE
## 17 17 ONE DIE
## 18 18 ONE DIE
## 19 19 ONE DIE
## 20 20 ONE DIE