ndice
Role a
nicedice(or[n|d]ice?)

Table of Contents
About
ndice is a cli dice roller and dice-rolling library.
Dices are writen in the format ${number}${exploding}d{$sides}, e.g. 1d6 means 1 six-sided dice. There's no limit to sides so a non-existing dice like 1d13 can be rolled.
- Each space-speparated argument is counted as one dice notation.
- Dices can be mixed, so
ndice 1d6 2d8 4d10works. - Invalid arguments are ignored.
Installation
Binary
Download a pre-compiled binary from the release page
Cargo
Install with cargo:
Usage (CLI)
Examples:
# Roll 1 six-sided dice
# Roll 2 8 sided dice and 2 four sided dice
Exploding dice
An exploding dice is a dice that is re-rolled when the highest possible value is rolled.
To roll a exploding dice use ed instead of d as argument.
1d6-> normal d61ed6-> exploding d6
Modifier
A positive or negative modifier can be added to each dice.
1d6+2-> add +2 to the result of rolling a d61d20-4-> subtract 4 from the result of rolling a d20
Usage (Library)
ndice can be used as library.
Add the library to Cargo.toml
[]
= 1.0
Optional JSON features can be enabled with a flag.
[]
= { = "1.0", = ["json"] }
And finally, call the two functions: ndice::parse_dices and ndice::roll_dices.
See src/bin.rs for an example implementation.
Contributing
We love and welcome every form of contribution.
Where to start?
Here are some good places to start:
- Issues with label Good first issue
- Issues with label Documentation
- Providing example implementations or usage demos
Tooling
- mktoc is used for table of content generation in the README.md (neat!)
Install dev build
Sometimes it's nice to install a specific version of ndice, this can be done with the following command:
# install specific commit
# install branch
License
MIT, see LICENSE file.