A groovier way to roll dice

Groovy Dice is an open source dice rolling engine written entirely in Groovy that provides a simple way to specify and evaluate complex dice rolling expressions.

Here goes some reasons you should use Groovy Dice:

It's simple

By default, Groovy Dice provides a simple language to express dice rolls:

1.d10     // ten-sided die
1.d50     // fifty-sided die
1.'d%'    // percentile die
1.d(2.d4) // sum two four-sided dice and roll a six-sided die of that many sides

You can roll dice with any number of sides, no matter if they're real or not.

It's powerful

The built-in API allows you to perform dice arithmetic, statistical calculations, modifiers and dice filtering:

1.d10 - 5                  // roll a ten-sided die and append -5 to the results
1.d + 1.d4                 // join a four-sided die with a six-sided die
3.d.mean                   // calculate the mean value of three six-side dice
3.d.worst_die              // get the lowest die
5.d12 * 5.to_every_die     // multiply each die by 5
4.d + 3.to_each_die_if{it.is_odd} // plus 3 to all odd dice
10.d10.the(3.best)         // filter the three highest dice
20.d6.only_if{it.is_odd}   // filter all odd dice

It's extensible

Most built-in features are implemented as plugins, which means you can easily provide your own plugins in order to extend or even replace the entire API:

class FunnyPlugin {
    def dynamicMethods = { api ->
        api.add(method:'dx', to:api.numberClasses) { times ->
            "Roll ${times} X-sided dice"

/* after Groovy Dice initialization... */

2.d10 + 4.d // prints "Sides: 10 , Dice: [10, 10, 6, 6, 6, 6] , Sum: 44"
10.dx    // prints "Roll 10 X-sided dice"

It's free

Groovy Dice uses a flexible open source license that allows you to leverage Groovy Dice in your project, either open or closed source.