Skip to content

Trebek/pyroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyRoller: Dice Package

A relatively simple package containing a class & methods for simulating dice. Can also simulate coin tosses, and Fudge dice as well.

Install/Uninstall with PIP

Install

pip install https://github.com/Trebek/pyroller/archive/master.zip

Uninstall

pip uninstall pyroller

Basic Usage

Create & Roll a Die Object

import pyroller

d6 = pyroller.Pyroller("d6")

result = d6.roll()

print result

Example output:

5

Create a "Bag" of Dice & Roll Them

from pyroller import Pyroller

notations = ["d6", "3d6", "d20", "4dF", "coin"]

bag = Pyroller.build_bag(notations)

for key in bag:
    roll_str = str(bag[key].roll())
    print "%s = %s" % (key, roll_str)

Example output:

d6 = 4
d20 = 9
3d6 = [4, 2, 5]
coin = Tails
4dF = [' ', ' ', '+', '-']

Relevant Links

About

PyRoller is a module containing a class/methods for simulating dice.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages