public class DoublingDie extends Die
A doubling die works much like a regular die except that the value of each face increases exponentially by a power of 2, rather than linearly.
Normally, only 6-faced, cube-shaped doublers are seen in the wild. This class, however, allows you to create one with any number of faces.
Constructor and Description |
---|
DoublingDie()
Creates a DoublingDie instance with the default number of sides
(6).
|
DoublingDie(int s)
Creates a new DoublingDie object with
s number of
sides. |
Modifier and Type | Method and Description |
---|---|
int |
roll(int n)
Simulates rolling a number of doubling dice with a number of
sides represented by this instance.
|