# Troll: A dice roll language and calculator

## Use Troll online

There is a web interface for Troll. This is the easiest way to use Troll, and is sufficient for most users.

You can roll dice and calculate probabilities. There are some limitations on probability calculations to avoid stressing the server, so calculations that use a lot of time. This will affect some (but not all) calculations involving many dice or rerolls. If you get into this limitation, you can run Troll on your own computer (by downloading and compiling the sources below), but that will be with a more primitive user interface.

I have combined my research into domain-specific languages and my interest in board games and role-playing games to design and implement a language for specifying dice-roll mechanisms.

The first version of the language Roll was released in early 2002 and a paper about the design and implementation was presented at the conference Practical Aspects of Declarative Languages in New Orleans, January 2003. Roll was used to calculate probabilities for several alternative dice-roll mechanisms during the development of the new version of the RPG World of Darkness system from White Wolf.

Based on experiences with Roll, I in 2006 redesigned the language to make it easier to use and added a few new features. The result is Troll, which is the current version, alebit extended with many new features since its release.

In Troll, you can write a definition for a dice-roll method like `sum largest 3 4d6` (corresponding to a common method for rolling attributes in Dungeons & Dragons) and either get randomly generated results based on this definition or get a probability distribution:

```   Value    % =                 % >=
3 :    0.0771604938272   100.0
4 :    0.308641975309     99.9228395062
5 :    0.771604938272     99.6141975309
6 :    1.62037037037      98.8425925926
7 :    2.93209876543      97.2222222222
8 :    4.78395061728      94.2901234568
9 :    7.02160493827      89.5061728395
10 :    9.41358024691      82.4845679012
11 :   11.4197530864       73.0709876543
12 :   12.8858024691       61.6512345679
13 :   13.2716049383       48.7654320988
14 :   12.3456790123       35.4938271605
15 :   10.1080246914       23.1481481481
16 :    7.25308641975      13.0401234568
17 :    4.16666666667       5.78703703704
18 :    1.62037037037       1.62037037037

Average = 12.2445987654    Spread = 2.84684444531  Mean deviation = 2.31853947569
```

Last update: April 3 2018.

### Troll manual

Last update: April 3 2018.

Note: Requires ML server pages to run.

Last update: April 3 2018.

Last update: April 28 2009.

### Slides for the conference paper

Last update: April 24 2009.

### Article about dice-mechanisms in role-playing games

Last update: March 15 2016.