.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   Maths problem: fatigue vs critical hits (http://forum.shrapnelgames.com/showthread.php?t=38714)

Endoperez May 10th, 2008 06:02 PM

Maths problem: fatigue vs critical hits
 
A DNR (Dominions random number) works like this:

Take a random number between 1 and 6. If the result is 6, take a random number between 0 and 5 and add it to the sum. If the result is a 5, repeat until the result isn't a 5.


What is the probability of getting a number of X or higher with 2 DRNs?

The manual lists comparisons, or chances of 2d6oe producing a value greater than 2d6 oe by a spesific amount. There comparisons are used for almost everything from attack to damage. There's only a single mechanic that I know of that uses 2d6oe value that ISN'T compared into another 2d6oe value, and that's the chance of a critical hit. Page 76 of the manual states the a critical hit happens if 2d6oe minus (fatigue/15) is less than 2.

For a single DRN, chance of results between 1-5 is 5/6. Chance of results larger than 5 is 1/6, result larger than 10 is 1/36, chance of result larger than 15 is 1/216 etc etc.

Any math students/professors/hobbyists want to try their hand at solving this?

cleveland May 10th, 2008 07:12 PM

Re: Maths problem: fatigue vs critical hits
 
Today's my day off, so I'm in no mood to derive or explain this result, but some quick fun with Excel yielded the following:

X.......Chance that 2d6oe > X
2.......0.972
3.......0.917
4.......0.833
5.......0.722
6.......0.583
7.......0.463
8.......0.361
9.......0.278
10......0.213
11......0.167
12......0.127
13......0.095
14......0.069
15......0.051
16......0.039
17......0.030
18......0.022

The values then slowly approach zero.

I invite everyone to cross-check my result, as I've been drinking for the last hour.

<font color="brown">Edit: cleaned up the table, apparently the forums don't like TAB </font>

cleveland May 10th, 2008 07:18 PM

Re: Maths problem: fatigue vs critical hits
 
So to put that into perspective...

Unit Fatigue...... %Critical Hits
0 - 14 ................ 0.0%
15 - 29 .............. 2.8%
30 - 44 .............. 8.3%
45 - 59 .............. 16.7%
60 - 74 .............. 27.8%
75 - 89 .............. 41.7%
90 - 104 ............ 53.7%
105 - 119 .......... 63.9%
120 - 134 .......... 72.2%
135 - 149 .......... 78.7%
150 - 164 .......... 83.3%
165 - 179 .......... 87.3%
180 - 194 .......... 90.5%
195 - 200 .......... 93.1%



<font color="brown">Edit: And an image...
Edit2: Values shifted &amp; new image uploaded based on MaxWilson's feedback (thanks!). Also changed to %</font>
http://img393.imageshack.us/img393/4...problm3.th.jpg

lch May 10th, 2008 07:22 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

Endoperez said:
What is the probability of getting a number of X or higher with 2 DRNs?

I quickly came up with the formula for one DRN, then noticed that you wrote 2 DRNs.

When one applies basic calculus regarding geometric series to the probabilities you already gave, the result is:

Let X = 6a + b, 0 &lt;= b &lt; 6. Then the probability that a DRN gives X or higher on a roll is (7-b)(1/6)^(a+1).

Now with two dice, I'm not sure but I think it goes like this: You want a combination of two rolls that add up to X, so X = Y+(X-Y) and 0 &lt; Y &lt; X. Your probability is given as follows: For every Y from 1 to X-1, multiply P(Y) and P(X-Y) as given above. Add all of them together, divide by X-1. That's your probability for two rolls. You can simplify it into a closed form, which could be kinda tricky because of the modulo representation for Y and X-Y. Maple helps.

Micah May 10th, 2008 07:42 PM

Re: Maths problem: fatigue vs critical hits
 
I would say from my observations of the effects of fatigue that the description of how crits function is not correct.

Kristoffer O May 10th, 2008 07:48 PM

Re: Maths problem: fatigue vs critical hits
 
In what way?

OTOH I don't think I know how it is supposed to work.
2d6oe &lt; fat/10 to get Prot/2 if I take a wild guess.

MaxWilson May 10th, 2008 10:02 PM

Re: Maths problem: fatigue vs critical hits
 
Cleveland. Nice work. Small correction, though: a critical hit happens if a DRN is _less_ than fatigue/15, rounded down. There's a .97 probability that a DRN is &lt; 2, which means there's a .03 probability that it's &gt;= 2, which means there's a 3% chance of critical hit when your fatigue/15 is 3. Thus, the table needs to shift by two rows. Chance of critical hit from fatigue 0-29 is 0%, 30-44 is 3%, etc.

-Max

Edit: poetic justice. There's a .97 probability that it's &gt; 2, and .03 that it's &lt;= 2. This is the opposite of what I typed.

Carkaton May 10th, 2008 11:15 PM

Re: Maths problem: fatigue vs critical hits
 
Very useful, thanks.

cleveland May 11th, 2008 09:25 AM

Re: Maths problem: fatigue vs critical hits
 
Max,

You're absolutely right that the table needs to be shifted, but upon closer inspection of the mechanic, it seems that the shift only needs to be by one row.

This is because a critical hit is scored when the DRN - Fatigue/15 is LESS THAN 2.

For example, let's say Stay Puft, Hero of Alexandria, swings at Gromulos, The Contemptuous Cyclops. Gromulos has 20 fatigue already, so Stay Puft gets a bonus of 20/15 = 1.33 --&gt; 1 to his critical hit roll. Since Stay Puft is particularly good at smiting villains, his DRN = 2 (which had a 1/6*1/6 = 2.8% chance); subtracting the fatigue bonus of 1, his final critical hit roll is 2 - 1 = 1. Since 1 &lt; 2 (the threshold for a critical hit), he scores yet another devastating smash on Gromulos, one of a presumed series of such blows.

So yes, the table needs to be shifted, but only by 1 row, as there is a 2.8% chance of a critical hit when the opponent has 20 fatigue.

Again, I encourage all to double-check my logic. I've only had 1/2 cup of coffee so far.

lch May 11th, 2008 11:19 AM

Re: Maths problem: fatigue vs critical hits
 
Quote:

lch said:
Now with two dice, I'm not sure but I think it goes like this: You want a combination of two rolls that add up to X, so X = Y+(X-Y) and 0 &lt; Y &lt; X. Your probability is given as follows: For every Y from 1 to X-1, multiply P(Y) and P(X-Y) as given above. Add all of them together, divide by X-1. That's your probability for two rolls. You can simplify it into a closed form, which could be kinda tricky because of the modulo representation for Y and X-Y. Maple helps.

Okay, the second part was pretty bogus. It shows that I never really learned probability calculus. Another try:

X = 6a + b, 0 &lt;= b &lt; 6. Then the probability that a DRN gives X or higher on a roll is P("&gt;= X") = (7-b)(1/6)^(a+1).
The probability that it equals X is P("= X") = (1/6)^(a+1).

But measuring a two-die roll isn't as easy. Here's a small python program that I used to check cleveland's calculations:

<font class="small">Code:</font><hr /><pre>#!/usr/bin/env python

def p_1(x):
if x &lt; 1:
return 1
b = x % 6
a = (x-b)/6
return (7-b)*pow((float(1)/6), a+1)

def p_2(x):
if x &lt; 1:
return 0
b = x % 6
a = (x-b)/6
return pow((float(1)/6), a+1)

def doubledrn(x):
M = [(a,b) for a in range(1,x-1) for b in range(1,x-a)]
s = 0.0
for (x_1, x_2) in M:
s += p_2(x_1)*p_2(x_2)
return 1-s

def doubledrn_2(x):
s = p_1(x)
for y in range(1,x-1):
s += p_2(y)*p_1(x-y)
return s

for x in range(2,18):
print "&gt;= %2d : %f" % (x, doubledrn(x))</pre><hr />
And here's the output of it: <font class="small">Code:</font><hr /><pre>&gt;= 2 : 1.000000
&gt;= 3 : 0.972222
&gt;= 4 : 0.916667
&gt;= 5 : 0.833333
&gt;= 6 : 0.722222
&gt;= 7 : 0.583333
&gt;= 8 : 0.462963
&gt;= 9 : 0.361111
&gt;= 10 : 0.277778
&gt;= 11 : 0.212963
&gt;= 12 : 0.166667
&gt;= 13 : 0.119599
&gt;= 14 : 0.079475
&gt;= 15 : 0.046296
&gt;= 16 : 0.020062
&gt;= 17 : 0.000772</pre><hr />
So as far as I can tell, cleveland's table is right. The difference in later numbers probably comes from rounding precision being a ***** again, as my code probably isn't numerically stable. If I'd calculate greater values, the numbers even turn negative! I'd be interested what formulas cleveland used to be able to trick the rounding precision.

cleveland May 11th, 2008 06:16 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

lch said:
If I'd calculate greater values, the numbers even turn negative!

Negative probabilities? Sounds like my odds the last time I was in Vegas.

Here's roughly what I did:
1) Constructed a vector A(i) of the explicit probabilities for each single drn outcome i. This is pretty straightforward:
A(1)=A(2)=...=A(5)=1/6
A(6)=A(7)=...=A(10)=(1/6)^2
Etc.

2) Constructed a vector B(j) of the probabilities a second drn would be less than or equal to j. So:
B(1)=A(1)
B(2)=A(1)+A(2)
B(3)=A(1)+A(2)+A(3)
Etc.

3) Constructed a matrix M such that M(i,j) = A(i)*B(j). Therefore, each M(i,j) = P(X&lt;=i+j | drn1=i).

4) Summing the / diagonals of this matrix (i.e. all M(i,j) whose i+j are identical) gives the probability that the 2d6oe will be less than or equal to i+j.

So for example, lets take the case when we want the 2d6oe &lt;= 3. This is only possible 2 ways: if drn1=1 &amp; drn2&lt;=2, or if drn1=2 &amp; drn2=1.

We therefore have:
A(1)=1/6
A(2)=1/6

B(1)=1/6
B(2)=2/6

M(1,2)=(1/6)*(1/6)
M(2,1)=(1/6)*(2/6)

So M(1,2)+M(2,1)= 0.083

Of course, this summation becomes larger for larger X=i+j.
When X=7, you'll need to add M(1,6)+M(2,5)+M(3,4)+...+M(6,1).

Phew.

DonCorazon May 11th, 2008 06:59 PM

Re: Maths problem: fatigue vs critical hits
 
And now in English? http://forum.shrapnelgames.com/images/smilies/happy.gif

cleveland May 11th, 2008 07:30 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

DonCorazon said:
And now in English? http://forum.shrapnelgames.com/images/smilies/happy.gif

English? I didn't do very well in English... http://forum.shrapnelgames.com/images/smilies/happy.gif

lch May 11th, 2008 09:23 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

cleveland said:
Here's roughly what I did:
1) Constructed a vector A(i) of the explicit probabilities for each single drn outcome i. This is pretty straightforward:
A(1)=A(2)=...=A(5)=1/6
A(6)=A(7)=...=A(10)=(1/6)^2
Etc.

I think this is already where I fail, because the rest is pretty much the same. I was jumping back and forth between modulo 5 and modulo 6 just because the whole thing is offset by 1 and the gaps didn't work out. Let's correct this now...

Let X-1 = 5a + b, 0 &lt;= b &lt; 5. (notice the -1!!) Then the probability that a DRN gives exactly X is p(DRN = X) = (1/6)^(a+1).
The probability that it is X or greater is:
http://img159.imageshack.us/img159/5...etexcgilv4.gif

Now, we have two ways of measuring all the (x,y) in IN x IN which sum is equal to or greater than X: Either we take all the (x,y) with x+y &lt; X and subtract the probability of them showing up simultaneously from 1, thus inverting the set, like you did if I understood right, or measure the following (with a loose mathematical notation): <font class="small">Code:</font><hr /><pre> (1, &gt;= X-1)
(2, &gt;= X-2)
(3, &gt;= X-3)
... etc.
(X-1, &gt;= 1)
(&gt;= X, *)</pre><hr />
which should be equal to {(x,y) | x+y &gt;= X}. I implemented both versions in Python again: <font class="small">Code:</font><hr /><pre>#!/usr/bin/env python

# p(DRN) &gt;= x
def p_1(x):
if x &lt; 1:
return 1
b = (x-1) % 5
a = (x-1) / 5
return (6-b)*pow((float(1)/6), a+1)

# p(DRN) == x
def p_2(x):
if x &lt; 1:
return 0
b = (x-1) % 5
a = (x-1) / 5
return pow((float(1)/6), a+1)

# p(2d6oe) &gt;= x
def doubledrn(x):
M = [(a,b) for a in range(1,x-1) for b in range(1,x-a)]
s = 0.0
for (x_1, x_2) in M:
s += p_2(x_1)*p_2(x_2)
return 1-s

# p(2d6oe) &gt;= x (alternate version)
def doubledrn_2(x):
s = p_1(x)
for y in range(1,x):
s += p_2(y)*p_1(x-y)
return s

for x in range(2,20):
print "&gt;= %2d : %f" % (x, doubledrn(x))
print "&gt;= %2d : %f" % (x, doubledrn_2(x))</pre><hr /> and huzzah, they both give the same result, and it is: <font class="small">Code:</font><hr /><pre>&gt;= 2 : 1.000000
&gt;= 3 : 0.972222
&gt;= 4 : 0.916667
&gt;= 5 : 0.833333
&gt;= 6 : 0.722222
&gt;= 7 : 0.583333
&gt;= 8 : 0.462963
&gt;= 9 : 0.361111
&gt;= 10 : 0.277778
&gt;= 11 : 0.212963
&gt;= 12 : 0.166667
&gt;= 13 : 0.127315
&gt;= 14 : 0.094907
&gt;= 15 : 0.069444
&gt;= 16 : 0.050926
&gt;= 17 : 0.039352
&gt;= 18 : 0.029578
&gt;= 19 : 0.021605</pre><hr />
http://forum.shrapnelgames.com/image...es/biggrin.gif http://forum.shrapnelgames.com/image...es/biggrin.gif http://forum.shrapnelgames.com/image...es/biggrin.gif

MaxWilson May 11th, 2008 09:23 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

cleveland said:
Max,

You're absolutely right that the table needs to be shifted, but upon closer inspection of the mechanic, it seems that the shift only needs to be by one row.

Yeah, you're right. Serves me right for misremembering the mechanic.

-Max

lch May 11th, 2008 10:30 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

lch said:
The probability that it is X or greater is: (...) (6-b)(1/6)^(a+1)

I just noticed that it is way easier to get the same result in a different way than I did. We already know that each element in a modulo "layer" shares the same probability, and that all the following layers together are cramped into something having the same probability, too. So you just need to count from the current element to the end and sum up.

Pehmyt May 25th, 2008 07:48 PM

Re: Maths problem: fatigue vs critical hits
 
I don't know if you are still interested in this, but I was, as it says "maths problem" in the title http://forum.shrapnelgames.com/images/smilies/happy.gif For future reference, if nothing else, the actual probability distributions for 1d6oe and 2d6oe (=DRN in the manual) are:
http://www.helsinki.fi/~mtvepsal/p1x.png
http://www.helsinki.fi/~mtvepsal/p2x.png
and for the original question,
http://www.helsinki.fi/~mtvepsal/p2sum.png
In all expressions X=5n+r, with 1&lt;=r&lt;=5 (note limits!).

The first one is more or less trivial, the second is proven by induction in n and the third follows from that by straightforward summation.

Revolution May 25th, 2008 07:56 PM

Re: Maths problem: fatigue vs critical hits
 
http://forum.shrapnelgames.com/images/smilies/shock.gif
I started reading all of this and thought of this picture...

http://i289.photobucket.com/albums/l...jun20gal49.jpg

moderation May 25th, 2008 09:32 PM

Re: Maths problem: fatigue vs critical hits
 
So that is what kids are learning in school these days. http://forum.shrapnelgames.com/images/smilies/eek.gif

Wick May 25th, 2008 10:10 PM

Re: Maths problem: fatigue vs critical hits
 
With only a little calculus long, long ago I can't play math, but I do enjoy watching it.

lch May 25th, 2008 11:53 PM

Re: Maths problem: fatigue vs critical hits
 
Quote:

Pehmyt said:
http://www.helsinki.fi/~mtvepsal/p2sum.png
In all expressions X=5n+r, with 1&lt;=r&lt;=5 (note limits!).

With a little redesign, this translates into python code as follows: <font class="small">Code:</font><hr /><pre># p(2d6oe) &gt;= x (Pehmyt's version)
def doubledrn_3(x):
n = (x-1) / 5
r = (x-1) % 5
r += 1
return float((62-15*r+r*r)*5*n+70+3*r-r*r)/(2*6**(n+2))</pre><hr />
which produces the right output. Very nice! I think that if you lose the tricky quotient/remainder representation of yours and just work on x-1 like I did in my third attempt, your formula might look a little simpler than the current one.

lch May 26th, 2008 12:01 AM

Re: Maths problem: fatigue vs critical hits
 
Okay, the result isn't as great as I hoped, this is what Maple makes out of it: <font class="small">Code:</font><hr /><pre>&gt; p := ((62-15*r+r*r)*5*n+70+3*r-r*r)/(2*6^(n+2));
2 2
5 (62 - 15 r + r ) n + 70 + 3 r - r
p := ------------------------------------
(n + 2)
2 6
&gt; factor(subs(r=r-1, p));
2 2
390 n - 85 n r + 5 n r + 66 + 5 r - r
---------------------------------------
(n + 2)
2 6</pre><hr />

Micah May 26th, 2008 01:00 AM

Re: Maths problem: fatigue vs critical hits
 
I'm still amused over the painstaking research to figure out how something works when it doesn't actually follow the behavior described.

I just tested this with a troll king with a robe of invulnerability vs 12 and 13 damage chaff (25 body prot, somewhat more on the head since the chassis has a helmet). Under 15 fatigue he gets damaged twice over 8 rounds of combat in melee. As soon as he crests 15 fatigue he starts taking about 2 damaging hits EVERY ROUND. The chances for a crit at 15-30 fatigue should be 1 in 36, since it requires a one on both dice (open ended rolling doesn't kick in til way later). He's only taking 21 swings per round. In addition, even if a crit lands it only has about a 50% chance of doing damage (half his prot value still is equal to the damage of the attacks).

The crit system as described in the rulebook does not mesh with reality. I've observed this phenomenon time and again while playing with SCs, but now I actually sat down and counted swings.

Endoperez May 26th, 2008 05:00 AM

Re: Maths problem: fatigue vs critical hits
 
It's just random variation. Str 10 + spear 3 units can deal damage against a non-fatigue Colossal Fetisch with 32 body protection twice in the same turn, and then be unable to harm him for several turns while he has 30 fatigue (from Flaming Helmet). The amount of hits he takes varies a lot, but jumps in damage occur much more after the fatigue goes over 14, and then over 30 points. It's mostly 1 or 2 points of damage before critical hits, then they start dealing 4-7 points.

Because spearman can score hits even before the fetish is fatigued (no helmet, so it stays at 0 fatigue all the time), actual data and statistics would be necessary to figure out if there's something wrong with the formula. The thing that surprised me in my tests was that high protection protected you from most hits, but the hits that got through could deal 5 or 7 or 13 points of damage. I guess that's why size 2 units make so poor thugs - whatever you do with them, a single stroke of bad luck will finish them off.


All times are GMT -4. The time now is 03:41 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.