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

This Month's Specials

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

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 2: The Ascension Wars

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old January 1st, 2004, 07:21 AM

alexti alexti is offline
First Lieutenant
 
Join Date: Dec 2003
Location: Calgary, Canada
Posts: 762
Thanks: 0
Thanked 0 Times in 0 Posts
alexti is on a distinguished road
Default Re: Dominions Dice Roll Chart

Quote:
Originally posted by Saber Cherry:
quote:
Originally posted by alexti:
Interesting... The chart doesn't exactly match the numbers I got myself. The numbers are quite close though. I would post my formula, but I can't even think of trying to type in HTML
Well, they're the same to 4 digits, which is about all I'd expect with 200 million rolls.
Maybe the difference is down to the random number generator you're using. Pseudo-random number generator does not give exactly correct distribution, I wonder if you'd get a bit different results with another RNG.

Quote:
You actually have a statistical formula that predicts the outcome, without simulation? That would be quite useful and speed up the combat simulator a lot
Yes, here's it:

A(m): { n1, n2: n1+n2=m, where n1,n2 independent illwinter dice rolls }
pA(m) = (q^(u+1))*{u(6-v(1-q)-q)+q(v-1)}, where u and v, such that m=5u+v and, u>=0 and v=1..5

B(m): { n1, n2: n1+n2>=m, where n1,n2 independent illwinter dice rolls }
pB(m) = (q^(u+1)*{u(20-5(v-1)(14-v)/12)+6-(v-1)(v-2)/12}

D(m): { n1, n2, n3, n4: n1+n2>=n3+n4+m, where n1,n2,n3,n4 independent illwinter dice rolls }
pD(m) = sum[s=1..5-v]f[s,u,s+v] + sum[s=6-v..5]f(s,u+1,s+v-5)
where u and v, such that m=5u+v and, u>=0 and v=1..5
and f(s,u,w) = (q^(u+2)){c2(q^2)*a1(s)*b2(u,w)+c1(q^2)*(a1(s)*b2( u,w)+a2(s)*b1(w))+c0(q^2)*a2(s)*b2(u,w)},
and
a1(s) = 6-s(1-q)-q
a2(s) = q(s-1)
b1(w) = 20 - 5(w-1)(14-w)/12
b2(u,w) = u*b1(w) + 6 - (w-1)(w-2)/12
c0(q) = 1/(1-q)
c1(q) = q/((1-q)^2)
c2(q) = (q+q^2)/((1-q)^3)

Hard to write formulas here I had to be creative in a few places. Hopefully it's understandable. For interested, I was just writing sequences of probabilities of various outcomes, writing roll results in 5u+v form and then getting summing by v in from of summing by u, summing by u is from 0 to infinity so I could roll it in (see c0,c1,c2 constants) and only leave summing from 1 to 5.

If you want I can send you code that implements it too.

Quote:
Oh... also... it seems that the rounding of the Last digit may differ... all my numbers are rounded up for 5-9, and down for 0-4.
I'm using double float precision (15 digits) and only round when outputing the text, rounding is mathematical (same as yours).

P.S. Edited: fixed missed parametrization of Ci(q)

[ January 01, 2004, 05:58: Message edited by: alexti ]
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 03:49 AM.


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