Parsing a Dice Roll String

new topic     » topic index » view thread      » older message » newer message

I'm writing a die roller and need to be
able to parse a dice function string.

Some examples:

   3d6+5 (roll 6-sided die 3 times, add 5 to sum)
   4d6-Lowest (roll 6-sided die 4 times, discard lowest die)
   4d6-Highest (roll 6-sided die 4 times, discard highest die)
   2d10*3-3d4 (roll 10-sided die twice, multiply by 3, then subtract
               the result of rolling a 4-sided die three times)
   5d12/10 (roll 12-sided die five times, divide result by 10)

I actually tried starting this function, but couldn't get through it.
Anybody else want to try? :)

The current roller and a die-roll graphing program
can be found here: http://www.cklester.com/euphoria/

Thanks!!!
-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu