Saturday, September 16, 2017

probability - Highest average value when rolling dices



This question is in reference to a game called "Tiny Dice Dungeon." In this game, damage is calculated based on rolling dice. I want to know how I can achieve the highest average damage.



This is the setting:




There are following dice types:




  1. "Attack dice": have the values 1-6; rolling a one on the dice causes the whole attack to fail.

  2. "Greater 1 attack dice": have the values 2-6.

  3. "Damage multiplier dice": Multiply the sum of all attack dice the value of the multiplier. Rolling a one with this die results in multiplying the sum by one but does not end the round.



The types have different sub-types:





  1. Attack dice are split into normal, double, triple and quadruple attack dice, which multiply their base value accordingly (1x,2x,3x,4x).

  2. Multiplier dice exist with ranges of 1-2, 1-3, and 1-4.



Additionally if I take two attack dice of the same kind (e.g. two double attack dice) and they roll the same value, they will not be summed; instead the multiplier becomes 10.



Following rules also apply:





  1. Every die set can have a maximum of 4 dice.

  2. There can only be two attack dice of the same kind, e.g. only two triple attack dice.

  3. There has to be at least one attack die, otherwise you obviously would never fail a turn.

  4. Before you can roll a die again, you have to have rolled all the other dice.



The damage is calculated the following way:



The values shown on the attack dice are first multiplied by their own multiplier, then they are summed together, and then the multiplier value of the multiplier dice is applied.




Example:




  • 1x attack dice rolling 5

  • 1x attack dice rolling 5

  • 2x multiplier rolling 2

  • 4x multiplier rolling 4




The calculation becomes




  1. 5x1 = 5

  2. 5x1 = 5

    • These are the same die type showing the same value, so the shwon value gets multiplied by 10 instead of summed so we have


  3. 5*10 = 50

  4. 50*2 = 100


  5. 100*4 = 400



If you could follow me so far, now my specific questions:




  1. Which dice should I choose for the highest average damage when I roll every attack dice 4 times?

  2. How high would the probability be to NOT fail to get to the fourth roll in the setup?


Answer




tl;dr: The best expectation of 96.5 is with one attack die, two 1-4 multiplier dice, and one 1-3 multiplier die. This would have a probability of .48 of the attack die not rolling a 1.



When it comes down to it, any attack die has a 5/6 chance of success. Rolling it four times means that you would only have a $(5/6)^4=625/1296\approx .48$ chance of success. Consequently, two attack dice would mean only a .23 chance of success, three dice would mean a .11 chance of success, and four dice would mean a .054 chance of success. Since we don’t have many options, we need to make sure we maximize this chance, and consequently try to minimize the attack dice.



As a first attempt, let’s try one attack die (with value $D_1$), two 1-4 multiplier dice (with values $D_2$ and $D_3$), and one 1-3 multiplier die (with value $D_4$). The value $V$ of a roll is the product of the four dice (or 0, if $D_1=1$). Since the dice are all independent, the expectation (aka average) of the value is the product of the expected values: $\mathbb{E}(V)=\mathbb{E}(D_1D_2D_3D_4)=\mathbb{E}D_1\mathbb{E}D_2\mathbb{E}D_3\mathbb{E}D_4=\frac{10}3\cdot\frac52\cdot\frac52\cdot 2=\frac{125}3$.



The complication, of course, is that we need the attack die to avoid 1 for four rolls (three rolls if you just need “to get to the fourth roll”). We can calculate this with a conditional probability: $\mathbb{E}(\sum_{i=1}^4 V_i)=\mathbb{E}(\sum_{i=1}^4 V_i\big|\prod_{i=1}^4 V_i>0)\mathbb{P}(\prod_{i=1}^4 V_i>0)=4\mathbb{E}(V\big|V>0)\mathbb{P}(V>0)^4=4\mathbb{E}(V)\mathbb{P}(V>0)^3=4\cdot\frac{125}3\cdot(\frac56)^3=\frac{15625}{162}\approx 96.5.$



A second attempt would be to use two attack dice (with values $D_1$ and $D_2$) and two 1-4 multiplier dice (with values $D_3$ and $D_4$). Now, $\mathbb{E}(V)=\mathbb{E}(v(D_1,D_2)D_3D_4)=\mathbb{E}(v(D_1,D_2))\mathbb{E}D_3\mathbb{E}D_4$. The expectation of the attack dice is easiest to find with a table:




0  0  0  0  0  0
0 20 5 6 7 8
0 5 30 7 8 9
0 6 7 40 9 10
0 7 8 9 50 11
0 8 9 10 11 60


This sums to 360, so the $\mathbb{E}(v(D_1,D_2))=10$, $\mathbb{E}(V)=10\cdot \frac52\cdot\frac52=\frac{125}2$, and $\mathbb{E}(\sum_{i=1}^4 V_i)=4\mathbb{E}(V)\mathbb{P}(V>0)^3=4\cdot\frac{125}2\cdot(\frac56)^6=\frac{1953125}{23328}\approx 83.7$. By sacrificing a multiplier die, we increased the expectation of a single roll of four dice. But the chance of failure increase faster, and we had a net loss.




It’s not clear if you’re allowed to use a quadruple attack die as the required attack die (http://www.tinydicedungeon.com/Guide/GuideIndex.html#typesofdice indicates that a 1 on a quadruple attack die still results in no attack). If so, then obviously you want to do that.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...