I collect dice of various types, mostly d6s (six-sided dice) and polyhedral RPG dice (d4s, d6s, d8s, d10s, d12s, d20s, and d100s). I like the idea of dice mechanics in tabletop RPGs and standalone dice games. However, I’d like to study dice mechanics and maybe design my own games with them.

To help my quest, I’d like to create a library that makes it easy to gather information about dice rolls.

Imagine something like this:

```
>>> die = Die(6)
>>> die.roll()
3
>>> die.mean
3.5
>>> die.variance
#???
>>> die.std_deviation
#???
```

and so on…

Of course, rolling one die isn’t enough. In many games we roll several dice and add them together or try to roll against a target number. For that I might make other classes that represent more complex dice expressions:

```
>>> dice = DieSum(Die(6), Die(6), Die(4)) #2D6 + 1D4
>>> dice.roll()
8
>>> die.mean
9.5
>>> die.variance
#???
>>> die.std_deviation
#???
```

I’d also include features for calculating probabilities.

Another feature that would be useful to have is to be able to parse standard
dice notation like `4d6 + 1`

.

While this idea has been done before I’m sure, I’d love to do it from scratch to get a better feel for learning about statistics and probability.