Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chaos Scrolling Probabilities (C++)
#1
Doing something with my brother, wondering if this works. Basically finding the chance of getting a certain attack, or range of attacks using chaos scrolls. I'm just learning how now, so I have no clue myself. =x

Quote:#include <cstdio>

void series(int total, int count, float temp);

float per = 0;

int main()
{
int total = 2;
series(total, 1, 1.0);
printf("%f\n", per);
getchar();
return 0;
}

void series(int total, int count, float temp)
{
for(int i = -6; i < 6; i++)
{
int tempTot = total;
float t = temp;
if(i == -6)
t *= 0.4;
else
{
t *= 0.6 * (1.0/11);
tempTot += i;
if(tempTot < 0)
tempTot = 0;
}
if(count < 5 && tempTot != 0)
series(tempTot, count + 1, t);
else if(count == 5 && tempTot >= 10)
{
per += t;
}
}
}
Thanks,
Chris

EDIT: Adding on stuff now so can change the amount of scrolls and the base easier.

Question: Is it -5 to +5 on all stats on the item? How does this work?

Say for a pink cape.

2atk
15 def
15 mag def

Outcome:

7 atk
20 def
20 mag def

Or-

7 atk
18 def
17 mag def

I've heard different possibilities, which one is the best maximum output?
Reply


Messages In This Thread
Chaos Scrolling Probabilities (C++) - by »-Chris-&gt; - 2009-02-07, 02:08 AM
Chaos Scrolling Probabilities (C++) - by Stereo - 2009-02-07, 01:02 PM
Chaos Scrolling Probabilities (C++) - by Harrisonized - 2009-02-08, 05:14 AM
Chaos Scrolling Probabilities (C++) - by DeadHead - 2009-02-08, 05:42 PM
Chaos Scrolling Probabilities (C++) - by Harrisonized - 2009-02-08, 06:38 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)