.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #1  
Old May 10th, 2008, 06:02 PM
Endoperez's Avatar

Endoperez Endoperez is offline
National Security Advisor
 
Join Date: Sep 2003
Location: Eastern Finland
Posts: 7,110
Thanks: 145
Thanked 153 Times in 101 Posts
Endoperez is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old May 10th, 2008, 07:12 PM
cleveland's Avatar

cleveland cleveland is offline
Captain
 
Join Date: Oct 2007
Location: guess - and you'll be wrong
Posts: 834
Thanks: 33
Thanked 187 Times in 66 Posts
cleveland is on a distinguished road
Default 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.

Edit: cleaned up the table, apparently the forums don't like TAB
Reply With Quote
  #3  
Old May 10th, 2008, 07:18 PM
cleveland's Avatar

cleveland cleveland is offline
Captain
 
Join Date: Oct 2007
Location: guess - and you'll be wrong
Posts: 834
Thanks: 33
Thanked 187 Times in 66 Posts
cleveland is on a distinguished road
Default 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%



Edit: And an image...
Edit2: Values shifted & new image uploaded based on MaxWilson's feedback (thanks!). Also changed to %

Reply With Quote
The Following User Says Thank You to cleveland For This Useful Post:
  #4  
Old May 10th, 2008, 07:22 PM
lch's Avatar

lch lch is offline
General
 
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
lch is on a distinguished road
Default 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 <= b < 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 < Y < 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.
__________________
Come to the Dom3 Wiki and help us to build the biggest Dominions-centered knowledge base on the net.
Visit my personal user page there, too!
Pretender file password recovery
Emergency comic relief
Reply With Quote
  #5  
Old May 10th, 2008, 07:42 PM

Micah Micah is offline
Major
 
Join Date: Dec 2006
Posts: 1,226
Thanks: 12
Thanked 86 Times in 48 Posts
Micah is on a distinguished road
Default 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.
Reply With Quote
  #6  
Old May 10th, 2008, 07:48 PM
Kristoffer O's Avatar

Kristoffer O Kristoffer O is offline
General
 
Join Date: Aug 2003
Location: Sweden
Posts: 4,463
Thanks: 25
Thanked 92 Times in 43 Posts
Kristoffer O is on a distinguished road
Default Re: Maths problem: fatigue vs critical hits

In what way?

OTOH I don't think I know how it is supposed to work.
2d6oe < fat/10 to get Prot/2 if I take a wild guess.
__________________
www.illwinter.com
Reply With Quote
  #7  
Old May 10th, 2008, 10:02 PM

MaxWilson MaxWilson is offline
Major General
 
Join Date: Mar 2007
Location: Seattle
Posts: 2,497
Thanks: 165
Thanked 105 Times in 73 Posts
MaxWilson is on a distinguished road
Default 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 < 2, which means there's a .03 probability that it's >= 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 > 2, and .03 that it's <= 2. This is the opposite of what I typed.
__________________
Bauchelain - "Qwik Ben iz uzin wallhax! HAX!"
Quick Ben - "lol pwned"

["Memories of Ice", by Steven Erikson. Retranslated into l33t.]
Reply With Quote
  #8  
Old May 11th, 2008, 09:25 AM
cleveland's Avatar

cleveland cleveland is offline
Captain
 
Join Date: Oct 2007
Location: guess - and you'll be wrong
Posts: 834
Thanks: 33
Thanked 187 Times in 66 Posts
cleveland is on a distinguished road
Default 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 --> 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 < 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.
Reply With Quote
  #9  
Old May 11th, 2008, 11:19 AM
lch's Avatar

lch lch is offline
General
 
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
lch is on a distinguished road
Default 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 < Y < 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 <= b < 6. Then the probability that a DRN gives X or higher on a roll is P(">= 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:

Code:
#!/usr/bin/env python

def p_1(x):
if x < 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 < 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 ">= %2d : %f" % (x, doubledrn(x))


And here's the output of it: Code:
>=  2 : 1.000000
>= 3 : 0.972222
>= 4 : 0.916667
>= 5 : 0.833333
>= 6 : 0.722222
>= 7 : 0.583333
>= 8 : 0.462963
>= 9 : 0.361111
>= 10 : 0.277778
>= 11 : 0.212963
>= 12 : 0.166667
>= 13 : 0.119599
>= 14 : 0.079475
>= 15 : 0.046296
>= 16 : 0.020062
>= 17 : 0.000772


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.
__________________
Come to the Dom3 Wiki and help us to build the biggest Dominions-centered knowledge base on the net.
Visit my personal user page there, too!
Pretender file password recovery
Emergency comic relief
Reply With Quote
  #10  
Old May 11th, 2008, 06:16 PM
cleveland's Avatar

cleveland cleveland is offline
Captain
 
Join Date: Oct 2007
Location: guess - and you'll be wrong
Posts: 834
Thanks: 33
Thanked 187 Times in 66 Posts
cleveland is on a distinguished road
Default 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<=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 <= 3. This is only possible 2 ways: if drn1=1 & drn2<=2, or if drn1=2 & 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.
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 01:37 AM.


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