No project description provided
Project description
Dicey
version 1.0.2
A python package for evaluating dice rolls.
Description
Dicey parses strings of dice rolls of the form:
'1d20 + 2 + 2d4 - 1d8 + 1'
Dicey then rolls the specified dice, and computes the total.
Results can be displayed a few different ways:
- just the total, e.g. '20'
- the original expression and the total, e.g. '1d20 + 2 = 17'
- the original expression, the intermediate dice rolls, and the total, e.g. '1d20 + 2 = (15) + 2 = 17'
Installation
pip install dicey
Usage
Command Line
Usage:
dicey
dicey [-v | -vv] <expression>
Options:
-h --help show this screen.
-v print expression with total
-vv print expression, intermediate results, and total
As a python package
from dicey import roller d = roller.DieRoller() d.roll('1d20 + 1d4 + 2') result = d.result str(result) # >>> "13" str(result.v()) # >>> "1d20 + 1d4 + 2 = 13" print(result.vv()) # >>> "1d20 + 1d4 + 2 = (7) + (4) + 2 = 13 d.reroll() result = d.result print(result) # >>> "23" print(result.v()) # >>> "1d20 + 1d4 + 2 = 23" print(result.vv()) # >>> "1d20 + 1d4 + 2 = (19) + (2) = 23"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size dicey-1.0.2-py3-none-any.whl (4.9 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size dicey-1.0.2.tar.gz (3.2 kB) | File type Source | Python version None | Upload date | Hashes View |