For a fictitious dice game, there is the following rules:
Rules
if ('player A dice roll' = 3 OR 'player A dice roll' < 10 + 'player B bonus' - 'player A bonus') {
Outcome 1: player_A fails and player_B automatically wins.
} else {
if ('player B dice roll' = 18 OR ('player B dice roll' > 3 AND 'player B dice roll' >= 10 + 'player A bonus' - 'player B bonus' AND 'player B dice roll' => 'player A dice roll')) {
Outcome 2: player_B beats player_A: player_B wins, player_A loses.
} else {
Outcome 3: player_B does not beats player_A: player_A wins, player_B loses.
}
}
Where:
- 'player N dice roll' is the sum of 3 (six sided) dice.
- A roll of 3 is always a failure, a roll of 18 is always a success.
- 'player N bonus' is (whole) number between -10 and 10.
I want to find out the probability for the occurrence of each outcome, but I failed. I can write a script that simply throws the dice and keeps track of the results. Let the script loop for say 10,000,000 times and the outcome is pretty close to the actual probabilities, but (funnily enough) 10,000,000 tries still leaves a fair margin of error in the outcome.
I don't like margin of errors, so I would like to calculate the probabilities instead. BUT I don't know how to calculate it. I tried, but the solution just eludes me :-(
How can I calculate probability for the occurrence of each outcome as described above?
(Bonus points for an explanation which is understandable for someone with rusty math skills)
Update
Since I don't know how to describe the above rules in a mathematical notation, I decided to describe the rules in a less abstract way.
Player A: the $Human$.
Player B: the $Orc$.
The $Human$ attacks the $Orc$. The outcome of the attack is determined by rolling 3 (six sided) dice. A combined roll of 3 is always a failure, a combined roll of 18 is always a success.
The $Human$ needs a combined dice roll to be greater than $10 + Bonus_{(Orc)} - Bonus_{(Human)}$ to hit the $Orc$; a combined roll of 3 is always a failure.
If the $Human$ makes a successful attack against the $Orc$, the $Orc$ gets to defend itself.
The $Orc$'s combined dice roll needs to be greater than or equal to $10 + Bonus_{(Human)} - Bonus_{(Orc)}$ AND needs to be equal to or better than the $Human$'s dice roll ( $DiceRoll_{(Orc)} >= DiceRoll_{(Human)}$ ). Of course, a combined roll of 3 is an automatic failure for the $Orc$ to defend itself and on a combined dice roll of 18 the $Orc$ automatically defends itself successfully.
I'm not sure this is any more clear than the rules as described above, but I don't know how to make it more clear otherwise.
Answer
The problem of determining the probability of occurrence of a score $n$ rolling three dice (with $n$ integer ranging between $3$ and $18$) reduces to the problem of determining the number of "restricted" partitions of $n$ (i.e., way of writing $n$ as a sum of positive integers, with the restriction that the sum has to contain exactly three integers). Each valid partition must then be multiplied by the number of possible permutations. For example, $n=4$ has only one valid restricted partition ($2,1,1$), which must be multiplied by three to account for the possible three combinations $2,1,1-1,2,1-1,1,2$. More generally, if three different numbers form the partition (e.g., $8$ as $8 = 1 + 3 + 4$), there are $3!$ different ways of permuting these numbers, so that the partition corresponds to six outcomes in the sample space. On the other hand, if two different numbers form the partition (e.g., $4$ as $2+1+1$), then there are three different ways of permuting these numbers, so that the partition corresponds to three outcomes in the sample space. When the partition has all equal numbers (e.g., $6$ as $6=2+2+2$), clearly the partition corresponds to a single outcome.
Taking into account these considerations, and knowing that rolling three dice there are $6^3=216$ total outcomes, we can calculate the probability for each $n$:
$$n=3: 1/216 = 0.5\%$$ $$n=4: 3/216 = 1.4\%$$ $$n=5: 6/216 = 2.8\%$$ $$n=6: 10/216 = 4.6\%$$ $$n=7: 15/216 = 7.0\%$$ $$n=8: 21/216 = 9.7\%$$ $$n=9: 25/216 = 11.6\%$$ $$n=10: 27/216 = 12.5\%$$
It is not necessary to calculate the probabilities for $n=11,12,13...18$, since they are symmetric with those shown above.
Applying this to the OP, if we define $k$ the difference between player B bonus and player A bonus, we have that player A needs a total combined dice roll greater than $10+k$ to hit player B (and in order not to lose). The probability of this event can be obtained by summing the corresponding probabilities above. For instance, if $k=3$, then player A needs a total combined dice roll greater than $10+3=13$. We then have to sum the probabilities of occurrence of $n=14,15...18$. Since these symmetrically correspond to the probabilities of occurrence of $n=3,4...7$, we get $$\frac{1+3+6+10+15}{216}=\frac{35}{216}=16.2\%$$
The same calculations can be used to determine the probability that player B defends successfully. In the example above, he must obtain a combined dice roll greater than or equal to $10-3=7$ and greater than or equal to the result of player A. If, for example, player A had obtained a total of $12$, we then have to sum the probabilities of occurrence of $n=12,13...18$. Again, since these symmetrically correspond to the probabilities of occurrence of $n=3,4...9$, we get $$\frac{1+3+6+10+15+21+25}{216}=\frac{81}{216}=37.5\%$$
These calculations also allow to take into account the condition that a roll of $3$ is always a failure and a roll of $18$ is always a success. We only have to check whether the occurrences of combined roll equal to $3$ and equal to $18$ are already correctly included in the calculations. In the example above where $k=3$ and where player A needs a total combined dice roll greater than $10+3=13$ to hit, we have summed the probabilities of occurrence of $n=14,15...18$. So, the occurrence of $18$ is already correctly counted as a success, whereas that of $3$ has already been considered as a failure (in fact, it has not been counted).
As another example, if $k=9$, then player A would need a total combined dice roll greater than $10+9=19$ to hit. Clearly he cannot obtain such result, since the maximal value obtainable with three dice is $18$. However, under the condition that $18$ always implies a success, now we have to consider it within his possible successful outcomes. In this case, the successful occurrence of $18$ has still NOT already considered in the calculations, so that we have to add it. The resulting probability of success for player A is then equal to that of obtaining $18$, i.e. $\frac{1}{216}$. Also note that, in this example, the occurrence of $3$ is already considered as a failure (in fact, it has not been counted).
Lastly, similar considerations can be applied to take into account the condition that a roll of $3$ is always a failure and a roll of $18$ is always a success for player B as well.
No comments:
Post a Comment