Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Updated DiceType to allow for more parsing options #304

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

funnisimo
Copy link
Contributor

DiceType can now support dice (e.g. "2d6+1") as well as simple simple ranges (e.g. "2-12") and constants (e.g. "9").
Simple ranges are implemented as 1dX+Y.
Also, there is a Display implementation that turns the dice back into the string.
And there is an implementation of From<&str> and FromStr for additional parsing/conversion ease.
Changed the default to be 0 instead of 1d4.
Doing the parsing by hand removes regex and lazy_static.

Sorry about the cargo formatting - please feel free to revert that part - my format on save is causing this change.

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

Successfully merging this pull request may close these issues.

1 participant