NoDice is a small tool for statistics and simulation of dice rolls. It may be interesting for students or players and designers of games.
To build NoDice from source you will need an F# 3.1 compiler (or newer) and a .NET development environment. The
.fsproj file in the source directories should be understood by .NET Core command line tools, MSBuild or IDEs such as VSCode or VisualStudio.
NoDice is a command line tool. It accepts a number of options to modify its behaviour and expressions involving constants and random variables specified in reverse polish notation. Each argument to the program pushes an expression onto a stack or manipulates the existing contents of the stack. After processing all arguments NoDice expects to find a single item on the stack which is then evaluated.
The simplest expressions understood by the software are constants, for example
will produce a report stating that the result of this expression is 10 with 100% probability.
The next building block of expressions are random variables, for example the standard six sided die can be simulated using
which will produce a report with uniform probabilities for all sides of the die and some random sample results. You can change the number of generated samples using the --samples option.
More complex expressions can be formed using postfix operators, for example
NoDice d6 3 add
will add 3 to the result of each "dice roll" or
NoDice d6 explode
will create an "exploding die" that is rerolled whenever it produces its highest result and the results from all rerolls are summed up.
Summing multiple instance of the same expression can be done with the sum operator family, for example
NoDice d6 5 2 sum-l
will produce information about rolls of five dice, discarding the lowest two results and summing up the remaining three for each roll.
To report sums of probabilites over all results less than or greater than any possible threshold, use the --aggregate option. For example
NoDice d6 3 sum --aggregate=le
will report the probabilities for each of the possible results or any lower value when summing up three rolls of six-sided dice.
To list the available options and operators, run NoDice with the --help option.