A simple dice roller for the command line.
|
il y a 5 ans | |
---|---|---|
src | il y a 5 ans | |
.gitignore | il y a 5 ans | |
Cargo.lock | il y a 5 ans | |
Cargo.toml | il y a 5 ans | |
README.md | il y a 5 ans |
Because that's why I wrote this program.
The following line builds the program and links it as roll
into ~/.local/bin
. This assumes you have this directory in your path.
cargo build --release && ln -s $PWD/target/release/feeling-dicey $HOME/.local/bin/roll
Can be used either with arguments:
roll 4d6 1d4 # rolls four six-sided and one four-sided die
or via stdin:
echo '2d20 4d8' | roll
and can be used interactively by simply running it without arguments. This will wait for input and every newline will trigger rolling. End with Ctrl+D
. Example:
roll
4d6 2d4
Rolled 4d6: 17 ([2, 4, 6, 5])
Rolled 2d4: 8 ([4, 4])
= 25
1d20
Rolled 1d20: 9 ([9])
= 9
6d8 4d6
Rolled 6d8: 32 ([7, 3, 8, 7, 4, 3])
Rolled 4d6: 17 ([5, 5, 5, 2])
= 49