View Single Post
  #21  
Old May 25th, 2008, 11:53 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:
Pehmyt said:

In all expressions X=5n+r, with 1<=r<=5 (note limits!).
With a little redesign, this translates into python code as follows: Code:
# p(2d6oe) >= 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))


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.
__________________
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