1 : the most simple and boring input. 1d4 : duh. 4d6h3 : roll 4d6 sum highest three values. 2d4l1 : roll 2d4 take lowest value. 3d6m1 : roll 3d6 take the median value. 4d4m2 : roll 4d4 sum the two median values. 6d10<5 : roll 6d10 sum all values lower than 5. 3d{-1,0,1} : roll 3 fudge dice. 8d6ch : roll 8d6 and count all highest values (all 6s) as successes. 9d6cl : roll 9d6 and count all lowest values (all 1s). 5d10c>7 : roll 5d10 and count all values greater than 7 (all 8s, 9,s and 10s). 6d10c{-1,0,0,0,0,0,1,1,1,2} : roll 6d10 where 7-9 counts as one success, 10 as two, and 1 as -1. 4d(1d4+1d8)cl : roll 1d4+1d8 four times and count how often you get a 2. 3(2d4)c{-1,0,0,0,1,1,1} : roll 2d4 three times, count 6-8 as one success and a 2 as -1. 4d8e3h : roll 4d8 and reroll all 8s, but reroll a single die at most 3 times. 2d10e2<5 : roll 2d10 and reroll all results lower than 5, at most twice. 1d4e3{0,0,0,2} : roll 1d4 and reroll a 4 twice, but do this at most three times. 1d(2d6 + 5)eh1 : roll 2d6+5 and roll the whole thing once more if you get the highest possible result. 4d6h3c=16 : roll 4d6 drop lowest and count how often you get a 16. 10d(2d6cl)eh1 : roll 2d6 and count how often you get a 2. Do this ten times, then once more for each time you got two 2s. 2d6 x 2d4 : show all ways a roll of 2d6 can be followed by a roll of 2d4. 4d6h3^6 : roll a D&D character.

Statement = CartesianProductSequence ['x' CartesianProductSequence]* CartesianProductSequence = Expression ['^' N] Expression = [-] MulExpression [('+' | '-') MulExpression]* MulExpression = Roll ['*' Roll]* Roll = N ['d' Distribution [Filter] [Modifier]] Distribution = N | Set | NestedDistribution | AbsoluteDistribution NestedDistribution = '(' Expression ')' "evaluate expression and use as a new distribution" AbsoluteDistribution = '|' Expression '|' "make all negative values positive" Filter = TakeHighest | TakeLowest | TakeMedian |Comparator TakeHighest = 'h' N "take the higest N values" TakeLowest = 'l' N "take the lowest N values" TakeMedian = 'm' N "take the median N values" Comparator = ('=' | '<' | '>') Int "equal to, less than, or greater than Int" Modifier = Count | Explode Count = 'c' Condition "count how often Condition applies" Explode = 'e' N Condition "reroll whenever Condition applies, but at most N levels deep" Condition = 'h' | 'l' | Set | Comparator "highest or lowest possible values, multiplied by occurances in set, or matching Comparator" Set = '{' Int [',' Int]* '}' Int = [-] N N = Digit [Digit]* Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'

R # %1 1 0.462 7 3.243 19 8.804 37 17.135 61 28.246 91 42.13

R # %0 125 57.871 75 34.722 15 6.943 1 0.46

R # %1 1 0.462 7 3.243 19 8.804 37 17.135 61 28.246 75 34.727 15 6.948 1 0.46