A super simple gem for rolling polyhedral dice with ruby.
I wrote this when learning how to develop a rubygem.
- help-output for
- add support for the SW dice system (Edge of the Empire, Age of Rebellion)
include the gem in your project with
easy_dicewill parse dice formatted as Strings
irb> d = EasyDice.read("1d6 + 8") => #<Die:0x00 ... > irb> d.roll => 10
- you can throw straight ruby at
irb> d = 2.d(8) + 1.d(6) + 12 => #<Die:0x00 ... > irb> d.roll => 28 irb> (12.d(6) + 10).roll => 61
easy_dicecan give you a little bit of miscellaneous information
irb> d = 1.d(6) + 1.d(8) => #<Die:0x00 ... > irb> d.min # what's the smallest number that can be rolled? => 2 irb> d.max # what's the largest number that can be rolled? => 14 irb > puts d # "i forgot what dice i was going to roll" 1d6 + 1d8 => nil
$ roll 1d8 + 1d6 + 8 16
help me help you
If you've come across a bug or error in
easy_dice, please submit a Github issue describing the problem, and what version of
easy_dice you're using.