diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-10-06 19:14:55 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-10-06 19:14:55 -0400 |
| commit | a166818ea312c83489d9397165bd16aa61fe5438 (patch) | |
| tree | 8dc4741b987e45611d3929db91a4fe1ab7ad01a5 /dice/src/main/java/bjc/dicelang/dicev2/Die.java | |
| parent | 5a26fb2c0d899b1c80fabb39366a7b7db4d8ca41 (diff) | |
Info cleanup
Diffstat (limited to 'dice/src/main/java/bjc/dicelang/dicev2/Die.java')
| -rw-r--r-- | dice/src/main/java/bjc/dicelang/dicev2/Die.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/dice/src/main/java/bjc/dicelang/dicev2/Die.java b/dice/src/main/java/bjc/dicelang/dicev2/Die.java index ab4f880..9fadb2d 100644 --- a/dice/src/main/java/bjc/dicelang/dicev2/Die.java +++ b/dice/src/main/java/bjc/dicelang/dicev2/Die.java @@ -4,25 +4,40 @@ import java.util.Random; /** * An abstract class that represents a single pool of dice. + * * @author Ben Culkin * */ public abstract class Die { private static final Random BASE = new Random(); + /** + * The RNG to use. + */ protected Random rng; + /** + * Create a new basic die. + */ protected Die() { rng = BASE; } + /** + * Create a new basic die. + * + * @param rnd + * The RNG to use. + */ protected Die(Random rnd) { rng = rnd; } /** * Set the RNG this die pool uses. - * @param rnd The RNG used by the die pool. + * + * @param rnd + * The RNG used by the die pool. */ public void setRandom(Random rnd) { rng = rnd; @@ -30,27 +45,33 @@ public abstract class Die { /** * Roll the entire die pool. + * * @return The results from rolling the dice. */ public abstract long[] roll(); + /** * Roll a single die in the pool. * * For pools with multiple die, this may be somewhat arbitrary. + * * @return Result from rolling a single die in the pool. */ - public abstract long rollSingle(); + public abstract long rollSingle(); /** * Can this pool be optimized? + * * @return Is the pool optimizable? */ public abstract boolean canOptimize(); + /** * Optimize the die pool. * * Is undefined if called while canOptimize is false. + * * @return The optimized version of the pool. */ - public abstract long optimize(); + public abstract long optimize(); } |
