Math is hard

Jul 14, 2009 15:44

I have a mathy question, a challenge even, for those good at math ( Read more... )

Leave a comment

Comments 1

redbeard13 July 15 2009, 00:33:27 UTC
I think I got something I'm happy with. It's got predefined settings at the tail end, while the front end is a linear extrapolation of values from that which is required to roll nd1 to the predefined settings at the end. The magicnumbers are floating around there to allow this to work without having to hit the floating point unit (numerical analysis class pays off).

It looks like this:

switch (curve)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7: magicnumber=10000/avg + (1200*curve - 10000*curve/avg)/7; break;
case 8: magicnumber=2500; break;
case 9: magicnumber=5000; break;
case 10: magicnumber=10000; break;
}

sides = magicnumber*((2*avg)-1)/10000;
ndice = 2*avg/(sides+1);

Reply


Leave a comment

Up