For a full description, see the Troll manual
You can choose a dice roll from one of the two drop-down lists. This will bring the roll definition into the text area below the lists. Alternatively, you can enter (or modify) the dice definition in the text area.
When you press the "Make random rolls" button, Troll will makre a number of random dice rolls. You can change the number of rolls by entering a new number in the box.
When you press the "Calculate probabilities" button, Troll will produce a probability distribution that for each possible outcome shows its probability as well as an accumulated probability. The latter can be one of >=, <=, > or <. The probabilities of individual outcomes is also shown as a bar chart.
If the results are single numbers, an average, spread and mean deviation is also calculated and shown below the table of probabilities.
If you have made a dice-roll definition that you want to reuse later or want to share with others, write a short description in the text box below the buttons and press one of the buttons. Your roll is now added to the list of user-contributed rolls using the description as label. The description is also added as a comment to the dice-roll definition, so you shouldn't do that yourself. If you use a description that is already in the list, the entry will be overwritten. This way, you can save a roll and edit it later. Please only change your own entries.
I will from time to time remove junk from the list. If you see offensive text in this list, please email me at torbenm@diku.dk, and I will remove it.
There are some restrictions for probability calculation:
If you want to exceed the limits on time and repetition, download Troll and run it on your own computer.
| dn or Dn | roll one dn (a die labeled 1 - n) |
| mdn or mDn | roll m dn |
| zn or Zn | roll one zn (a die labeled 0 - n) |
| mzn or mZn | roll m zn |
| +, -, *, / | arithmetic on single values |
| sum | add up values in collection |
| count | count values in collection |
| U or @ | union of collections |
| {e1,...,en} | union of e1,...,en |
| min, max | minimum or maximum value in collection |
| minimal, maximal | all minimum or maximum values in collection |
| least n, largest n | n least or n largest values in collection |
| m # e | m samples of e |
| .. | range of values |
| choose | choose value from collection |
| e pick n | pick (without replacement) n values from collection e |
| <, <=, >, >= , =, =/= | filters: Keep values from 2nd argument that compare to 1st argument |
| drop | elements found in 1st argument and not in 2nd |
| keep | elements found in 1st argument that are also found in 2nd |
| different | remove duplicates |
| if-then-else | conditional. Any non-empty is considered true |
| ?p | return 1 with probability p and {} otherwise |
| & | substitute for logical and |
| x := e1; e2 | bind x to value of e1 in e2. |
| foreach x in e1 do e2 | evaluate e2 for each value in e1 and union the results. |
| repeat x := e1 while/until e2 | repeatedly evaluate e1 while or until e2 becomes true (non-empty). Return last value |
| accumulate x := e1 while/until e2 | repeatedly evaluate e1 while or until e2 becomes true (non-empty). Return union of all values |
| function | define function |
| compositional | define compositional function |
| call | call function |
| ' | make text box of single sample |
| n ' | make text box of n samples (right-aligned) |
| || | Combine text boxes horisontally |
| |> | Combine text boxes vertically, left-aligned |
| <| | Combine text boxes vertically, right-aligned |
| <> | Combine text boxes vertically, centre-aligned |
The text-box features are not available in the probability calculator.
Variable names are sequences of letters (both upper and lower case), so they can not contain digits. Nor can variable names be identical to operators (e.g., d, z or sum). Names are case-sensitive.
Spaces are optional in most places, but space is required between two adjacent numbers and between two adjacent alphabetical operators or variables. For example, "dX" is a variable called "dX", while "d X" is a die with X sides. Similarly, "Nd6" is a variable called "Nd" followed by the number 6, while "N d6" is a collection of N d6s.
Comments can be added to die-roll definitions. Comments begin with a backslash ("\") and extend until the end of the line.
Operator precedences from highest to lowest are:
| Grouping | Operators |
|---|---|
| n/a | prefix D prefix d prefix Z prefix z |
| right | infix D infix d infix Z infix z # |
| right | = < > <= >= =/= |
| n/a | choose count sum min max least largest different minimal maximal ' |
| n/a | prefix - |
| left | * / |
| left | + infix - |
| right | @ |
| left | drop keep pick |
| none | .. |
| right | |> <| <> || |
| n/a | else while until do |
| right | ; |
When the left column in the table says "left", "right" or "none", the operators in the right column are infix operators, otherwise (i.e, if the left column says "n/a") they are prefix or multi-operand operators.
When two operators from the same group can be combined, they are grouped left or right according to the left column of the table above, so for example 3<6>x is equivalent to 3<(6>x) while d6+d8-3 is equivalent to (d6+d8)-3. Parentheses can be used to override the precedences.
There are two cases of minus: A prefix minus binds more tightly than *, but infix minus binds like +. Similarly, prefix d binds tighter than infix d.
Note that you can not group several occurrences of .., i.e., 2..3..4 is not valid syntax.