Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Infinite Dice Rolling Loop

February 23 (11 years ago)

Edited February 23 (11 years ago)
Infinite Dice Re-Rolling Loop

/r 5d6r<6
Keep rolling a six-sided die until it returns a result greater than 6.
Sanity check on re-roll mechanic for sides of die? Or potentially, just don't allow a re-roll of a die more than a reasonable number of times, such as 20 times?

Also, '<' doesn't equal '<=' (the software developer in me had to).
February 23 (11 years ago)
Gauss
Forum Champion
It seems you are making two suggestions rather than posting a bug. Perhaps you could explain the bug?
February 23 (11 years ago)
Lithl
Pro
Sheet Author
API Scripter

Matt K. said:

Also, '<' doesn't equal '<=' (the software developer in me had to).
This is, apparently, an artifact of people being used to other VTTs where < was used for <=. User experience is more important than mathematical integrity. ~_^
February 23 (11 years ago)
Using the above posted formula, the re-rolling mechanic would not come to a final result as it would continue to re-roll every die because they would always be of a value of 6 or less, thus needed to be re-rolled.

I wasn't receiving a final result but I was noticing CPU usage, even after the 3D dice animations stopped, and the only way to end the roll was to exit the current session. When I rejoined, it was not still running as far as I could tell.
--
As for the '<' vs '<=', sometimes the user doesn't know what they really needed out of the situation because they were used to something and didn't want to change. My experience on that is working with a department of a company that wants everything to work exactly as before... when the before code is VB and written mid-90s vs the rewritten code is C# (we can do it better as we are rewriting the entire process). At this point, I do doubt getting a user base to change their formulas would be easy but I'd still stand by it being incorrect practice. But that's not the reason for this bug report, it was an extra comment as it led into my finding the infinite re-rolling bug because I was curious to see how many times it would take 5d6 to roll all 6's by re-rolling all of non-6's. I expected '<' to include 1-5, not 1-6.
February 23 (11 years ago)
Gauss
Forum Champion
Ok, now I understand. You did not initially state that this was a 3D dice problem.

There is a limit for the number of rerolls but it is in the hundreds. I can see how that impacts things with 3d dice rerolls. I will let the Devs know.
February 24 (11 years ago)

Gauss said:

Ok, now I understand. You did not initially state that this was a 3D dice problem.

There is a limit for the number of rerolls but it is in the hundreds. I can see how that impacts things with 3d dice rerolls. I will let the Devs know.

While it does cause performance issues with 3D dice, my problem was more with no sanity check performed for re-rolling formula when re-rolling all values at or below 6 when rolling a d6. I was expecting an error message stating my formula was wrong, as '/r d6<6' should never technically end as the d6 will never naturally roll a 7 or better.
February 24 (11 years ago)
Gauss
Forum Champion
The way things are currently set up in Roll20 it will end after several hundred rolls of each die. I forget the exact limit (and don't want to count) but the limit does exist.
Honestly, just having an error message thrown to call me stupid when I try to perform a bad roll like that would be preferred. Should be an easy enough test of $reroll_result vs $sides.
March 01 (11 years ago)
Gauss
Forum Champion
As I stated earlier, I let the Devs know.