No Description

olinox 1d34b28551 Integrate the 'd', 'Ad', and 'dX' short notations 8 years ago
dist bd27a26605 Build package 8 years ago
docs 740279dff2 Update docs cosmetic 8 years ago
xdice.egg-info bd27a26605 Build package 8 years ago
.gitignore 1d34b28551 Integrate the 'd', 'Ad', and 'dX' short notations 8 years ago
.travis.yml 57695ab03a Configure travis CI 8 years ago
LICENSE.txt cc23029a8b Add license 8 years ago
MANIFEST.in 0c10bc539d Update readme, build 1.0.0 8 years ago
README.md 1d34b28551 Integrate the 'd', 'Ad', and 'dX' short notations 8 years ago
nose2.cfg 1af1b03105 Rename to 'xdice' 8 years ago
roll.py 1af1b03105 Rename to 'xdice' 8 years ago
setup.py 1af1b03105 Rename to 'xdice' 8 years ago
test.py 1d34b28551 Integrate the 'd', 'Ad', and 'dX' short notations 8 years ago
xdice.py 1d34b28551 Integrate the 'd', 'Ad', and 'dX' short notations 8 years ago

README.md

Build Status Coverage Status Documentation Status

xdice

xdice is a lightweight python library for managing dice, scores, and dice-notation patterns.

It allows to easily interpret literal expressions as rolls of dice ('1d6', '3d4+3', '12d6+1d4'...etc.), then manipulate the results.

Python Versions

DiceRollParser has been tested with python 3.3+

Documentation

See the full documentation

Examples:

import dice

## Roll simple dices with **rolldice()**

score = rolldice(6, amount=2)

# manipulates score as an integer

print( score, score * 2, score == 11 )
>> 11       22      True


# Iterates over the results

for result in score:
    print(result)
>> 5
>> 6

# Parse patterns with **roll()**

ps = roll("2d6+18")

print( ps, ps.format() )
>> 28       '[5,6]+18'

CLI

Run python roll.py [options] <expr>

Usage:
    roll [options] <expr>

Options:
    -s               Numeric score only

    -h --help        Displays help message
    --version        Displays current xdice version

CONTRIBUTION

Any opinion / contribution is welcome, please contact us.

TO INSTALL

pip install xdice

License

xdice is under GNU License

Author

Olivier Massot, 2017, with Cro-ki Lab

Tags

dice roll d20 game random parser dices role board