Roll: a dice-language interpreter.
Web page: the Roll web page
Some sample dice expressions:
d6
: Roll a 6 sided die2 # d6
: Roll two 6 sided dice2d6
: Roll and add two 6 sided diced(d 6)
: Roll a 6 sided die to get n, and then roll an n-sided died(sum(2#d6))
: Roll an n-sided die where n is the sum of two six-sided die rolls.if d6 < 4 then 4 else 2#d4
: Roll a d6, and if that is less than 4 return 4, otherwise return a bag consisting of the results of rolling 2 d4's.max 2 (3#d5)
: Return the largest 2 values after rolling three five-sided dice.min 2 (3#(if d6 < d6 then 1 else 2))
: Roll two dice. If the first is smaller, return 1, else 2. Do this three times and select the lowest two values.
Roll also supports definitions, which can be loaded from a file:
attribute = 3d6
frodo attack = d20 + 2
twice = 2 # frodo attack
: dofrodo attack
twicechar = 6#sum max 3 4#d6
: Definechar
to be the result of six trials of the following: roll 4 six-sided dice and sum the 3 largest.