
Applied Math Applied Math Forum 
 LinkBack  Thread Tools  Display Modes 
February 13th, 2017, 02:08 PM  #1 
Newbie Joined: Feb 2017 From: USA Posts: 4 Thanks: 0  average value of dice rolls. Game mechanics
For "fun" I'm performing some data analytics on a PC game to try and optimize my characters. I'm enjoying figuring out the math myself so I'll only share part of a problem I just can't get started on. I can use what you all share to apply to other calculations I'll need to write code for later. Here it is: "A bag contains tiles, each with one number from 10 to 22 printed on them. (10, 11, 12, 13 etc.) Larry reach into the bag and randomly pull out one tile. Next, he divides that value in half and then subtracts 5 from the result. If the new value is great than 1/5 of the value of the tile, Larry writes down the new value, otherwise Larry writes down whatever 1/5 of the tile value is. Larry repeat the above process as many times as he likes recording the numbers in sequence. After Larry is done, what will be the average value of the numbers he has written down?" Now If I ignore the if statement, I have no problem recognizing that the floor becomes 0 and the max value is 6 with these calculations. I can average those and get an answer of 3. [ (10+22)/2/25 = 3] However the Conditional statement throws me off. I have no idea where to begin writing an equation where this floor value is not a constant. Or maybe it is and i just can't see it? I cheated and ran a quick 1000 simulations in excel to get a rough final answer of 3.6 but I'd prefer to develop a useful equation as it will simplify the code I'm writing for the rest of my calculations. (not to mention the excel random number generator is not that great. If we're gonna do this lets do it right!) Is it possible to write an equation for this? 
February 13th, 2017, 07:51 PM  #2 
Senior Member Joined: Sep 2015 From: CA Posts: 1,238 Thanks: 637 
the exact answer is $\dfrac{467}{130}$ given the tile set you mention. Simply chase the numbers through your process for each tile. You end up with $\left( \begin{array}{cc} \text{tile #} &\text{final value}\\ 10 & 2 \\ 11 & \frac{11}{5} \\ 12 & \frac{12}{5} \\ 13 & \frac{13}{5} \\ 14 & \frac{14}{5} \\ 15 & 3 \\ 16 & \frac{16}{5} \\ 17 & \frac{7}{2} \\ 18 & 4 \\ 19 & \frac{9}{2} \\ 20 & 5 \\ 21 & \frac{11}{2} \\ 22 & 6 \\ \end{array} \right)$ there are no duplicates so each one of these numbers has a probability of $\dfrac {1}{13}$ of occurring. The expected value is thus their sum divided by $13$ which gets you the value at the top. Multiple passes won't affect this any as the distribution is identical for each pass. 
February 13th, 2017, 08:47 PM  #3 
Newbie Joined: Feb 2017 From: USA Posts: 4 Thanks: 0 
I see your point about how the number of passes doesn't matter. That really limits the amount of manual work you have to do. It is a good solution for this set. In fact, even if the set was much too large to handle by hand, or the number of operations to perform on each number increased significantly, I could very easily write some code to loop through these manual steps very quickly and produce similar results. So i thank you for that. However, what if i had to do this by hand? Is there a single expression i could write where I punch in these numbers and get the correct result? Or does that conditional statement preclude the option of using a single expression? I'm just wondering if there is some cool math trick that allows for this. If not, I'm pretty happy writing the code to do what you suggested. 
February 13th, 2017, 08:51 PM  #4  
Senior Member Joined: Sep 2015 From: CA Posts: 1,238 Thanks: 637  Quote:
I'm not really sure what you're asking.  
February 13th, 2017, 08:57 PM  #5 
Newbie Joined: Feb 2017 From: USA Posts: 4 Thanks: 0 
yeah I'm looking for a formula that can be applied to any size tile set with these rules.

February 13th, 2017, 10:42 PM  #6  
Senior Member Joined: Sep 2015 From: CA Posts: 1,238 Thanks: 637  Quote:
each tile has a probability $\dfrac {1} {NT_0+1}$ of being selected. We choose a tile $T$ $V = \begin{cases} \dfrac T 2 5 & &\dfrac T 2  5 > \dfrac T 5 \\ \\ \dfrac T 5 & &\dfrac T 2  5 \leq \dfrac T 5 \end{cases}$ we need to find out which tiles fall under which rule $\dfrac T 2  5 > \dfrac T 5$ $\dfrac T 2  \dfrac T 5 > 5$ $\dfrac {3T}{10} > 5$ $T > \dfrac{50}{3} = 16 \dfrac 2 3$ so we have $V = \begin{cases} \dfrac T 2  5 & &T \geq 17 \\ \\ \dfrac T 5 & &T \leq 16 \end{cases}$ so our expectation will be $E[V] = \dfrac {1} {NT_0+1} \left(\displaystyle{\sum_{T=T_0}^{16}}~\left( \dfrac T 5\right) + \displaystyle{\sum_{T=17}^{N}}~\dfrac T 2  5\right) =$ $\dfrac {1} {NT_0+1} \left(\dfrac{1}{10} \left(T_0^2+T_0+272\right) + \dfrac{1}{4} \left(N^219 N+48\right) \right)=$ $\dfrac{5 N^295 N2 T_0^2+2 T_0+784}{20 \left(NT_0+1\right)}$ $E[V] = \dfrac{5 N^295 N2 T_0^2+2 T_0+784}{20 \left(NT_0+1\right)}$  
February 15th, 2017, 06:32 AM  #7 
Newbie Joined: Feb 2017 From: USA Posts: 4 Thanks: 0 
It took me a while to see how you got this but I get it now. Thanks for having a look!


Tags 
average, dice, game, mechanics, rolls 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[HELP] Approximating arbitrary dice rolls  Raxmo  Probability and Statistics  6  December 28th, 2016 10:14 PM 
Expected Value of Sum of A Number of Rolls of Dice  adamwlev  Advanced Statistics  1  March 25th, 2016 12:44 PM 
two rolls rolling a dice find odds sum is less than or equal to 5  mihaella27  Probability and Statistics  4  October 25th, 2014 04:02 PM 
How to calculate the possibilities for dice rolls in RISK  lo22  Algebra  4  January 25th, 2012 09:57 PM 
55 dice rolls  jonaseriksson  Algebra  3  May 14th, 2011 07:06 AM 