||Models an ensemble of dice: >= 1 dice, with each die having >= 1 sides.|
Dice in the ensemble can have different numbers of sides.
All the dice can be rolled, their pips (and pip sum) can be queried.
||Methods defined here:|
- __init__(self, max_pips)
- Instantiate like Dice([6,6]) for 2 six-sided dice
Dice instance is unrolled (many operations require dice to be rolled first).
max_pips: a list of positive (>=1) integers
A Dice instance with len(max_pips) dice, the ith of which
has maxPip[i] sides, which has been rolled 0 times.
- Return dice as a str
Returns a string representation for a Dice, such that
d2 = eval(str(d)) copies the state of d
- Returns a list of the maximum pips for each die.
- Returns a list of all pips showing.
Note: d.all_pips()[i] == d.pips_on(i)
- Returns the number of dice in the ensemble (>= 1).
- Returns the sum of the pips showing on all the dice.
- pips_on(self, i)
- Returns the number of pips showing in die i (first die is i = 0).
- Returns whether or not all die show the same number of pips.
For 2 dice, asking pips_same is the same as asking doubles.
- Returns the dice ensemble after rolling every die in it.
Allows cascaded calls: d.roll().pip_sum()
- Returns the number of times the dice have been rolled (>=0).
- Returns None
Seeds the random number generator so that the same sequence of
rolls will occur, which allows for debugging of the same
Data descriptors defined here:
- dictionary for instance variables (if defined)
- list of weak references to the object (if defined)