1
0
Fork
You've already forked roll_dice
0
Roll any dice from the command line.
  • Python 100%
2023年11月06日 17:46:12 +00:00
.gitignore Initial commit 2023年10月02日 18:02:46 +00:00
README.md Update README.md 2023年10月02日 18:21:33 +00:00
roll.py Update roll.py 2023年11月06日 17:46:12 +00:00

roll_dice

Roll any dice from the command line.

Usage

You can use the following formats:

  • d[SIDES], [DICE]d[SIDES], [DICE]d[SIDES]+/-[MODIFIER]. Add a trailing a to roll with (dis)advantage.
  • f or f+/-[MODIFIER] to roll FATE dice.
  • -i for interactive mode. Just hit return to exit interactive mode.

Examples:

> python roll.py
Usage: python roll.py [X]dY[+-]Z[a] or f[+-]Z
> python roll.py d20
[15] + 0 => 15
> python roll.py d20a
[17] + 0 => 17
[3] + 0 => 3
> python roll.py 3d6+2
[6, 6, 3] + 2 => 17
> python roll.py 4d4-1
[2, 2, 1, 2] + -1 => 6 
> python roll.py f
[ + + -] + 0 => 1 
> python roll.py f+3
[ +] + 3 => 4

Use -i for interactive mode.

> python roll.py -i
Roll: 2d4
[2, 3] + 0 => 5 
Roll: help
Please use XdY[+-]Z[a] or f[+-]Z format.
 
Roll: 
>