Page 1 of 2

Zed's Monte Carlo Simulation

Posted: Sun Nov 13, 2016 7:56 pm
by zedturtle
So the questions of success chances comes up quite often. Here's a breakdown of your chances to get a basic success:

Code: Select all

DICE       TN 10    TN 12    TN 14    TN 16    TN 18    TN 20    TN 22    TN 24
0          16.66     8.33     8.33     8.33     8.33     8.33     8.33     8.33% 
1          45.84    29.16    16.66     9.71     8.33     8.33     8.33     8.33%
2          74.06    58.34    41.91    27.30    16.44    10.65     8.57     8.33% 
3          92.01    82.64    69.46    54.15    38.85    25.70    16.32    11.03% 
4          98.36    95.05    88.56    78.38    65.19    50.43    36.22    24.38% 
5          99.77    99.01    96.93    92.54    85.03    74.35    61.19    47.15% 
6          99.97    99.85    99.39    98.08    95.16    89.80    81.54    70.49% 
And here's the same range if you're Weary:

Code: Select all

DICE       TN 10    TN 12    TN 14    TN 16    TN 18    TN 20    TN 22    TN 24
0          16.66     8.33     8.33     8.33     8.33     8.33     8.33     8.33% 
1          37.50    25.01    16.66     9.71     8.33     8.33     8.33     8.33%
2          57.39    43.75    31.26    20.12    14.57    10.65     8.57     8.33% 
3          72.58    60.44    47.72    35.22    26.05    18.06    12.83    10.45% 
4          82.99    73.45    62.62    50.84    40.06    29.71    21.65    16.21% 
5          89.73    82.80    74.51    64.56    54.06    43.21    33.51    25.54% 
6          93.91    89.18    83.25    75.43    66.41    56.38    46.41    37.08% 
How the numbers were generated:

Due to the nature of how the Feat die works, doing the math directly gets to be a little tricky. Instead, I wrote a program that would test a number of rolls for each TN level and each dice level. Each iteration (each percentage in the charts above) is the result of the computer making a million rolls and then averaging the results. It isn't mathematically perfect, but it's really, really close and hopefully will help folks out when they're trying to tweak things.

Re: Zed's Monte Carlo Simulation

Posted: Sun Nov 13, 2016 9:12 pm
by Glorelendil
Thanks, Zed!

Hmmm...opportunity to create something visual here, for a gestalt feel of the whole thing. Mostly because I really like building things with d3.js.

What are all the variables we might want here? You've got the big three: skill, TN, and Weary.
What about...
1) Probability of great/extraordinary success
2) Impact of Advantage/Disadvantage (D&D term for "Roll 2 Feat Dice and take highest/lowest)
3) Success rate if Hope is spent? (Needs an input of what the attribute level is.)

Re: Zed's Monte Carlo Simulation

Posted: Mon Nov 14, 2016 2:36 am
by zedturtle
Man this is blowing my mind... I think my code is good, but when I decided to start calculating Great Successes, I'm getting a weird result.

For example, my program is finding that it has a 7.65% chance to achieve a Great Success against TN 10 with one die. That sounds like it's in the right range... you've got to roll a 10 or a Gandalf and then roll a 6 on the Success die.

But when I process the same set of rolls that generated that number for Weariness, the chance goes up to 11.12%. Again, I'm counting the same number of rolls, and I'm not re-rolling anything. In theory, turning the 1s, 2s, and 3s on the Success die into 0 should not affect anything. So either I'm having a stupid moment when it comes to the math, or I'm having a stupid moment when it comes to the program.

Re: Zed's Monte Carlo Simulation

Posted: Mon Nov 14, 2016 2:38 am
by zedturtle
Nevermind, found it. I was actually using two different random numbers for each Success die, which means that I wasn't accurately testing for Tengwars on one of the rolls. Wouldn't affect the rolls above, since all we cared about there was the total.

Re: Zed's Monte Carlo Simulation

Posted: Thu Nov 17, 2016 3:58 pm
by Glorelendil
Ok, my first pass at visualizing this: Tor Dice Visualization.

I still am planning to add a draggable "threshold bar" so that you can set the TN and see what all the percentages are.

I wasn't sure where to plot the Gandalfs so just chose the maximum possible roll + 1.

Oh, and if you mouse over a point it will tell you what the actual roll was. The diameter of the point correlates to the number of tengwars.

Make sure to hit the "Weary" checkbox. That's the best part. 8-)

EDIT: And now with glyphs!

Re: Zed's Monte Carlo Simulation

Posted: Fri Nov 18, 2016 1:56 pm
by Glorelendil
Ok, now check it out: draggable TN selector computes percentages.

Re: Zed's Monte Carlo Simulation

Posted: Sun Dec 04, 2016 2:47 am
by cuthalion
This is pretty awesome.

Stupid question: why don't the gandalfs (blue right?) all appear as high as they possibly can (TN46)? Not sure why they stagger depending on how many success dice are rolled.

Actually, something odd going on for sure--success rates for TN46 at 4, 5 and 6 dice are 7, 10, and 7, respectively. Think you need to look at the code for the Gandalfs maybe?

Love that you can actually hover over and see individual dice rolls!

Re: Zed's Monte Carlo Simulation

Posted: Sun Dec 04, 2016 4:03 am
by Glorelendil
cuthalion wrote:This is pretty awesome.

Stupid question: why don't the gandalfs (blue right?) all appear as high as they possibly can (TN46)? Not sure why they stagger depending on how many success dice are rolled.
I picked that location purely for aesthetics. There isn't really any logical place for the gandalfs since they produce in a non-numeric result. At first I had them all in the 47 slot, but I thought this looked better.
Actually, something odd going on for sure--success rates for TN46 at 4, 5 and 6 dice are 7, 10, and 7, respectively. Think you need to look at the code for the Gandalfs maybe?
Just stochastics. Let it run long enough and the numbers will stabilize.
Love that you can actually hover over and see individual dice rolls!
:-)

Re: Zed's Monte Carlo Simulation

Posted: Sun Dec 04, 2016 3:02 pm
by zedturtle
Glorelendil wrote:I picked that location purely for aesthetics. There isn't really any logical place for the gandalfs since they produce in a non-numeric result. At first I had them all in the 47 slot, but I thought this looked better.
Aesthetically, outside of the bounded numeric set (i.e. to the far right) is the correct answer. I know that, because it's my opinion. :D :)

Re: Zed's Monte Carlo Simulation

Posted: Sun Dec 04, 2016 10:46 pm
by Glorelendil
Ok I'll try it and see how it looks.