Object for simulating a set of an m-numbered set of n-sided dice. More...
Public Member Functions | |
def | __init__ |
Constructor for the dice object. | |
def | __eq__ |
overloaded equality test for Die object | |
def | __invariant__ |
Tests to insure the Die object's state is valid. | |
def | __str__ |
String conversion routine for the Die object. | |
def | highest |
The highest possible roll of a Die object. | |
def | lowest |
The lowest possible roll of a Die object. | |
def | roll |
Produces the summed result of a random roll of the dice Each die is rolled invididually. | |
Public Attributes | |
num_die | |
the number of dice in a Die object (integer) | |
die_sides | |
the number of sides on a Die object (integer) |
Object for simulating a set of an m-numbered set of n-sided dice.
>>> print wyckedsceptre.Die('1d20') 1d20
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::__eq__ | ( | self, | ||
other | ||||
) |
overloaded equality test for Die object
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::__init__ | ( | self, | ||
die_str = '1d20' | ||||
) |
Constructor for the dice object.
die_str | string that takes the form "MdN" where M is the number of dice and N is the number of sides each die has |
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::__invariant__ | ( | self | ) |
Tests to insure the Die object's state is valid.
Throws a ValueError exception if any problems are detected.
ValueError | if # of sides or dice is invalid |
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::__str__ | ( | self | ) |
String conversion routine for the Die object.
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::highest | ( | self | ) |
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::lowest | ( | self | ) |
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::roll | ( | self | ) |
Produces the summed result of a random roll of the dice Each die is rolled invididually.
the number of sides on a Die object (integer)
the number of dice in a Die object (integer)