0.1.5::wyckedsceptre::wyckedsceptre::Die Class Reference

Object for simulating a set of an m-numbered set of n-sided dice. More...

Inheritance diagram for 0.1.5::wyckedsceptre::wyckedsceptre::Die:
Inheritance graph
[legend]
Collaboration diagram for 0.1.5::wyckedsceptre::wyckedsceptre::Die:
Collaboration graph
[legend]

List of all members.

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)

Detailed Description

Object for simulating a set of an m-numbered set of n-sided dice.

>>> print wyckedsceptre.Die('1d20') 1d20


Member Function Documentation

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.

Parameters:
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
Todo:
add regular expression support die_str
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.

Exceptions:
ValueError if # of sides or dice is invalid
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::__str__ (   self  ) 

String conversion routine for the Die object.

Returns:
a string version of the die object in MdN format example: 1d20
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::highest (   self  ) 

The highest possible roll of a Die object.

Returns:
the highest possible roll of a Die object as an integer
def 0.1.5::wyckedsceptre::wyckedsceptre::Die::lowest (   self  ) 

The lowest possible roll of a Die object.

Returns:
the lowest possible roll of a Die object as an integer
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.

Returns:
the sum of all die rolls as an integer

Member Data Documentation

the number of sides on a Die object (integer)

the number of dice in a Die object (integer)


The documentation for this class was generated from the following file:
Generated on Tue Nov 2 22:28:25 2010 for wyckedsceptre by  doxygen 1.6.3