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

This Month's Specials

Air Command 3.0- Save $12.00
War Plan Pacific- Save $7.00

   







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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
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
 

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 02:16 PM.


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