Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Preventing infinite loops in exponding/rerolling when multiple conditions are specified #23

Open
adrianocola opened this issue Oct 24, 2018 · 0 comments

Comments

@adrianocola
Copy link
Contributor

The change in #22 added a check to explode/reroll condition to verify if the condition included all dice results (if that was allowed if would make explodes/rerolls forever). Roll20 don't do that, it simply allows 1000 rerolls and then stops (accepting the last roll, whatever it is). Try using this dice roll in Roll20: /roll 1d2r<3 (wait a few seconds to get a result).

Explode/reroll logic is done with while:
https://github.com/trwolfe13/dice-typescript/blob/dce5f9b6126ede665883f587704423bb78d03660/src/interpreter/dice-interpreter.class.ts#L223
https://github.com/trwolfe13/dice-typescript/blob/dce5f9b6126ede665883f587704423bb78d03660/src/interpreter/dice-interpreter.class.ts#L341)

This would still cause infinite loops if adding more complex explode/reroll conditions (eg: d2r=1r=2 or d8r=4r<4r>4)

How about setting a hard limit to rerolls (like Roll20 does)?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant