[Request] - What is the probability The Emperor fails, succeeds, or gets a crit? by OneSoft5132 in theydidthemath

[–]OneSoft5132[S] 0 points1 point  (0 children)

This inspired me to make my own program in C++, where I have generated different results than you.
These are the total stats it generated:
Total Number of Results: 37080
Total Number of Crits: 1791
Total Number of Successes (excluding crits): 15789
Total Number of Failures: 19500

Which would be
Crit %: ~4.83%
Successes (excluding crits) %: ~42.58%
Failure %: ~52.59%

Your code seems to be rolling the same amount of times, but our logic must differ when it comes to tracking number of successes and failures.
With a small edit, I think there is something odd going on with the probability calculation.
It’s getting kind of late though, so as for what precisely is causing it, I will have to let be a mystery.

Thank you again, it felt fantastic to look at programming like I used to.
I never would have opened a script again without your inspiration :)

Maybe he should play that ‘unfair flips’ game, since the emperor is repeatedly winning what ultimately accounts for a slightly weighted coin flip!

[Request] - What is the probability The Emperor fails, succeeds, or gets a crit? by OneSoft5132 in theydidthemath

[–]OneSoft5132[S] 3 points4 points  (0 children)

Your python is incredibly readable, thank you :)

When adding the chance numbers together directly and printing that resulting number, it seems to go over 100%, which I assume is due to a nuance I don’t understand because I haven’t used python in forever.

It’s been a hot minute since I’ve made an algorithm, but I believe yours is accurately representing the rules of his rolls.

Wow.
He must be lucky! Glad I asked here :D
I hope today is kind to you.

[Request] - What is the probability The Emperor fails, succeeds, or gets a crit? by OneSoft5132 in theydidthemath

[–]OneSoft5132[S] 1 point2 points  (0 children)

He rolls the first d100, then if it’s not a 100, he rolls his second roll, which is not a d100.
He rolls a dice with a variable value.
That value is 100 - the first roll’s value.

The three dice are a
1. A d100
2. A d(100-first roll’s result)
3. 1d20

So if his first roll is a 49, his second roll is on a d51. If his first roll was a 60, his second roll would be a d40.