From 77a797089a2e065cc8cf2a83ae8356b16591aebe Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Sun, 21 Feb 2016 15:40:30 -0500 Subject: Revamping of the way dice work --- .../src/main/java/bjc/utils/dice/CompoundDice.java | 43 ++++++++ .../bjc/utils/dice/CompoundDiceExpression.java | 45 +++++++-- BJC-Utils2/src/main/java/bjc/utils/dice/Dice.java | 39 -------- .../main/java/bjc/utils/dice/DiceExpression.java | 5 - .../java/bjc/utils/dice/DiceExpressionBuilder.java | 108 +++++++++++++++++++-- .../java/bjc/utils/dice/DiceExpressionParser.java | 80 +++++++++++++-- .../bjc/utils/dice/DiceExpressionParserTest.java | 52 +++++++--- .../java/bjc/utils/dice/DiceExpressionType.java | 3 + BJC-Utils2/src/main/java/bjc/utils/dice/Die.java | 21 +++- .../main/java/bjc/utils/dice/IDiceExpression.java | 15 +++ .../src/main/java/bjc/utils/dice/LazyDice.java | 93 ++++++++++++++++++ .../main/java/bjc/utils/dice/PolyhedralDice.java | 95 ++++++++++++++---- .../java/bjc/utils/dice/ScalarDiceExpression.java | 27 +++++- .../src/main/java/bjc/utils/dice/ScalarDie.java | 14 ++- 14 files changed, 538 insertions(+), 102 deletions(-) create mode 100644 BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDice.java delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/dice/Dice.java delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpression.java create mode 100644 BJC-Utils2/src/main/java/bjc/utils/dice/IDiceExpression.java create mode 100644 BJC-Utils2/src/main/java/bjc/utils/dice/LazyDice.java (limited to 'BJC-Utils2/src/main/java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDice.java b/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDice.java new file mode 100644 index 0000000..ceb62aa --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDice.java @@ -0,0 +1,43 @@ +package bjc.utils.dice; + +/** + * Implements a "compound dice" + * + * To explain, a compound dice is something like a d100 composed from two + * d10s instead of a hundred sided die. + * + * @author ben + * + */ +public class CompoundDice implements IDiceExpression { + /** + * The left die of the expression + */ + private IDiceExpression l; + /** + * The right die of the expression + */ + private IDiceExpression r; + + /** + * Create a new compound dice using the specified dice + * + * @param l + * The die to use on the left + * @param r + * The die to use on the right + */ + public CompoundDice(IDiceExpression l, IDiceExpression r) { + this.l = l; + this.r = r; + } + + @Override + public int roll() { + /* + * Make the combination of the two dice + */ + return Integer.parseInt(l.roll() + "" + r.roll()); + } + +} diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDiceExpression.java b/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDiceExpression.java index c4ebbe5..4dd6926 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDiceExpression.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/CompoundDiceExpression.java @@ -1,13 +1,39 @@ package bjc.utils.dice; -public class CompoundDiceExpression implements DiceExpression { +/** + * Implements a class for combining two dice with an operator + * + * @author ben + * + */ +public class CompoundDiceExpression implements IDiceExpression { + /** + * The operator to use for combining the dice + */ private DiceExpressionType det; - private DiceExpression left; - private DiceExpression right; + /** + * The dice on the left side of the expression + */ + private IDiceExpression left; - public CompoundDiceExpression(DiceExpression right, - DiceExpression left, DiceExpressionType det) { + /** + * The dice on the right side of the expression + */ + private IDiceExpression right; + + /** + * Create a new compound expression using the specified parameters + * + * @param right + * The die on the right side of the expression + * @param left + * The die on the left side of the expression + * @param det + * The operator to use for combining the dices + */ + public CompoundDiceExpression(IDiceExpression right, + IDiceExpression left, DiceExpressionType det) { this.right = right; this.left = left; this.det = det; @@ -15,6 +41,9 @@ public class CompoundDiceExpression implements DiceExpression { @Override public int roll() { + /* + * Handle each operator + */ switch (det) { case ADD: return right.roll() + left.roll(); @@ -23,11 +52,15 @@ public class CompoundDiceExpression implements DiceExpression { case MULTIPLY: return right.roll() * left.roll(); case DIVIDE: + /* + * Round to keep results as integers. + * We don't really have any need for floating-point dice + */ return Math.round(right.roll() / left.roll()); default: throw new IllegalStateException( "Got passed a invalid ScalarExpressionType " - + det); + + det + ". WAT"); } } diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/Dice.java b/BJC-Utils2/src/main/java/bjc/utils/dice/Dice.java deleted file mode 100644 index 84c2d0a..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/Dice.java +++ /dev/null @@ -1,39 +0,0 @@ -package bjc.utils.dice; - -public class Dice implements DiceExpression { - private Die die; - private int nDice; - - public Dice(int nDce, Die de) { - nDice = nDce; - die = de; - } - - public Dice(int nDce, int nSides) { - this(nDce, new Die(nSides)); - } - - public int roll() { - int res = 0; - - for (int i = 0; i < nDice; i++) { - res += die.roll(); - } - - return res; - } - - public static Dice fromString(String dice) { - String[] strangs = dice.split("d"); - - try { - return new Dice(Integer.parseInt(strangs[0]), - Integer.parseInt(strangs[1])); - } catch (NumberFormatException nfex) { - throw new IllegalStateException( - "Attempted to create a dice using something that's not" - + " an integer: " + strangs[0] + " and " - + strangs[1] + " are likely culprits.s"); - } - } -} diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpression.java b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpression.java deleted file mode 100644 index cd68918..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpression.java +++ /dev/null @@ -1,5 +0,0 @@ -package bjc.utils.dice; - -public interface DiceExpression { - public int roll(); -} diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionBuilder.java b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionBuilder.java index bcfbb81..6dcd5e3 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionBuilder.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionBuilder.java @@ -2,60 +2,150 @@ package bjc.utils.dice; import static bjc.utils.dice.DiceExpressionType.*; +/** + * Build a dice expression piece by piece + * + * @author ben + * + */ public class DiceExpressionBuilder { - private DiceExpression baking; + /** + * The dice expression we are building + */ + private IDiceExpression baking; - public DiceExpressionBuilder(Dice firstDice) { + /** + * Build a dice expresssion from a seed dice + * + * @param firstDice + * The dice to use as a seed + */ + public DiceExpressionBuilder(LazyDice firstDice) { baking = firstDice; } - public DiceExpressionBuilder(DiceExpression seed) { + /** + * Build a dice expression from a seed dice expression + * + * @param seed + * The dice expression to use as a seed + */ + public DiceExpressionBuilder(IDiceExpression seed) { baking = seed; } + /** + * Build a dice expression from a seed dice + * + * @param nSides + * The number of sides in the dice + * @param nDice + * The number of dice in the group + */ public DiceExpressionBuilder(int nSides, int nDice) { - baking = new Dice(nSides, nDice); + baking = new LazyDice(nSides, nDice); } - public DiceExpressionBuilder add(DiceExpression exp) { + /** + * Add a term to this dice expression + * + * @param exp + * The expression to use on the left + * @return A new expression adding the two dice + */ + public DiceExpressionBuilder add(IDiceExpression exp) { baking = new CompoundDiceExpression(baking, exp, ADD); return this; } + /** + * Add a scalar to this dice + * + * @param num + * The scalar to add to the dice + * @return A dice expression adding a scalar to this + */ public DiceExpressionBuilder add(int num) { baking = new ScalarDiceExpression(baking, num, ADD); return this; } - public DiceExpression bake() { + /** + * Bake the expression being built to completion + * + * @return A usable dice expression + */ + public IDiceExpression bake() { return baking; } - public DiceExpressionBuilder divide(DiceExpression exp) { + /** + * Divide a term from dice expression + * + * @param exp + * The expression to use on the left + * @return A new expression dividing the two dice + */ + public DiceExpressionBuilder divide(IDiceExpression exp) { baking = new CompoundDiceExpression(baking, exp, DIVIDE); return this; } + /** + * Divide a scalar from this dice + * + * @param num + * The scalar to add to the dice + * @return A dice expression dividing a scalar from this + */ public DiceExpressionBuilder divide(int num) { baking = new ScalarDiceExpression(baking, num, DIVIDE); return this; } - public DiceExpressionBuilder multiply(DiceExpression exp) { + /** + * Multiply a term by this dice expression + * + * @param exp + * The expression to use on the left + * @return A new expression multiplying the two dice + */ + public DiceExpressionBuilder multiply(IDiceExpression exp) { baking = new CompoundDiceExpression(baking, exp, MULTIPLY); return this; } + /** + * Multiply a scalar by this dice + * + * @param num + * The scalar to multiply to the dice + * @return A dice expression multiplying a scalar to this + */ public DiceExpressionBuilder multiply(int num) { baking = new ScalarDiceExpression(baking, num, MULTIPLY); return this; } - public DiceExpressionBuilder subtract(DiceExpression exp) { + /** + * Add a term to this dice expression + * + * @param exp + * The expression to use on the left + * @return A new expression adding the two dice + */ + public DiceExpressionBuilder subtract(IDiceExpression exp) { baking = new CompoundDiceExpression(baking, exp, SUBTRACT); return this; } + /** + * Add a scalar to this dice + * + * @param num + * The scalar to add to the dice + * @return A dice expression adding a scalar to this + */ public DiceExpressionBuilder subtract(int num) { baking = new ScalarDiceExpression(baking, num, SUBTRACT); return this; diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParser.java b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParser.java index 3be56e4..71801f8 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParser.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParser.java @@ -6,27 +6,80 @@ import bjc.utils.funcdata.FunctionalList; import bjc.utils.funcdata.FunctionalStringTokenizer; import bjc.utils.parserutils.ShuntingYard; +/** + * Parse a dice expression from a string + * + * @author ben + * + */ public class DiceExpressionParser { - public DiceExpression parse(String exp) { + /** + * Parse a dice expression from a string + * + * @param exp + * The string to parse an expression from + * @return The parsed dice expression + */ + public IDiceExpression parse(String exp) { + /* + * Create a tokenizer over the strings + */ FunctionalStringTokenizer fst = new FunctionalStringTokenizer(exp); + /* + * Create a shunter to rewrite the expression + */ ShuntingYard yard = new ShuntingYard<>(); + /* + * Add our custom operators to the yard + */ + yard.addOp("d", 5); // dice operator: use for creating variable + // size dice groups + yard.addOp("c", 6); // compound operator: use for creating compound + // dice from expressions + + /* + * Shunt the expression to postfix form + */ FunctionalList ls = yard.postfix(fst.toList(s -> s), s -> s); - Stack dexps = new Stack<>(); + /* + * Create a stack for building an expression from parts + */ + Stack dexps = new Stack<>(); + /* + * Create the expression from parts + */ ls.forEach((tok) -> { - if (tok.contains("d")) { - dexps.push(Dice.fromString(tok)); + /* + * Handle compound dice + */ + if (tok.contains("c") && !tok.equalsIgnoreCase("c")) { + String[] strangs = tok.split("c"); + + dexps.push(new CompoundDice(LazyDice.fromString(strangs[0]), + LazyDice.fromString(strangs[1]))); + } else if (tok.contains("d") && !tok.equalsIgnoreCase("d")) { + /* + * Handle dice groups + */ + dexps.push(LazyDice.fromString(tok)); } else { try { + /* + * Handle scalar numbers + */ dexps.push(new ScalarDie(Integer.parseInt(tok))); } catch (NumberFormatException nfex) { - DiceExpression l = dexps.pop(); - DiceExpression r = dexps.pop(); + /* + * Apply an operation to two dice + */ + IDiceExpression l = dexps.pop(); + IDiceExpression r = dexps.pop(); switch (tok) { case "+": @@ -45,13 +98,26 @@ public class DiceExpressionParser { dexps.push(new CompoundDiceExpression(l, r, DiceExpressionType.DIVIDE)); break; + case "c": + dexps.push(new CompoundDice(l, r)); + break; + case "d": + dexps.push(new LazyDice(l, r)); + break; default: - throw new IllegalStateException("Detected invalid operator " + tok); + /* + * Tell the user the operator is invalid + */ + throw new IllegalStateException( + "Detected invalid operator " + tok); } } } }); + /* + * Return the built expression + */ return dexps.pop(); } } diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParserTest.java b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParserTest.java index ff95ef3..4783b00 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParserTest.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionParserTest.java @@ -2,28 +2,58 @@ package bjc.utils.dice; import java.util.Scanner; +/** + * Driver class for testing expression parser + * + * @author ben + * + */ public class DiceExpressionParserTest { + /** + * Run the parser test + * + * @param args + * Unused CLI arguments + */ public static void main(String[] args) { + /* + * Get a scanner for input + */ Scanner scn = new Scanner(System.in); - + + /* + * Ask to enter a expression + */ System.out.print("Enter dice expression: "); - + String exp = scn.nextLine(); - + + /* + * Enter amount of times to roll an expression + */ System.out.print("Enter number of times to roll: "); - + int nTimes = Integer.parseInt(scn.nextLine()); - + + /* + * Parse the string expression into a dice expression + */ DiceExpressionParser dep = new DiceExpressionParser(); - - DiceExpression dexp = dep.parse(exp); - - for(int i = 1; i <= nTimes; i++) { + + IDiceExpression dexp = dep.parse(exp); + + /* + * Roll the dice a specified amount of times + */ + for (int i = 1; i <= nTimes; i++) { int roll = dexp.roll(); - + System.out.println("Rolled " + roll); } - + + /* + * Clean up after ourselves + */ scn.close(); } } diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionType.java b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionType.java index eb573ed..6493dd5 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionType.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/DiceExpressionType.java @@ -1,5 +1,8 @@ package bjc.utils.dice; +/* + * Enumeration for dice expression operators + */ public enum DiceExpressionType { ADD, DIVIDE, MULTIPLY, SUBTRACT } \ No newline at end of file diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java b/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java index 9998ae7..dc512b4 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java @@ -2,15 +2,34 @@ package bjc.utils.dice; import java.util.Random; -public class Die { +/** + * A single polyhedral dice + * @author ben + * + */ +public class Die implements IDiceExpression { + /** + * Random # gen to use for dice + */ private static Random rng = new Random(); + /** + * Number of sides this die has + */ private int nSides; + /** + * Create a die with the specified number of sides + * @param nSides The number of sides this dice has + */ public Die(int nSides) { this.nSides = nSides; } + /** + * Roll this dice once + * @return The result of rolling the dice + */ public int roll() { return rng.nextInt(nSides + 1); } diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/IDiceExpression.java b/BJC-Utils2/src/main/java/bjc/utils/dice/IDiceExpression.java new file mode 100644 index 0000000..4bd0973 --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/IDiceExpression.java @@ -0,0 +1,15 @@ +package bjc.utils.dice; + +/** + * An expression for something that can be rolled like a polyhedral die + * + * @author ben + * + */ +public interface IDiceExpression { + /** + * Roll the dice once + * @return The result of rowing the dice + */ + public int roll(); +} diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/LazyDice.java b/BJC-Utils2/src/main/java/bjc/utils/dice/LazyDice.java new file mode 100644 index 0000000..c1d775f --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/LazyDice.java @@ -0,0 +1,93 @@ +package bjc.utils.dice; + +/** + * Implements a collection of one or more of a particular die, where the + * number of dice in the group is variable. + * + * @author ben + * + */ +public class LazyDice implements IDiceExpression { + /** + * The die being rolled + */ + private IDiceExpression die; + + /** + * The number of the specified die to roll + */ + private IDiceExpression nDice; + + /** + * Create a new collection of dice + * + * @param nDce + * The number of dice in the collection + * @param de + * The type of dice the collection is composed of + */ + public LazyDice(IDiceExpression nDce, IDiceExpression de) { + nDice = nDce; + die = de; + } + + /** + * Create a new collection of dice + * + * @param nDce + * The number of dice in the collection + * @param de + * The type of dice the collection is composed of + */ + public LazyDice(int nSides, int de) { + nDice = new ScalarDie(nSides); + die = new Die(de); + } + + @Override + public int roll() { + int res = 0; + + /* + * Add the results of rolling each die + */ + int nRoll = nDice.roll(); + + for (int i = 0; i < nRoll; i++) { + res += die.roll(); + } + + return res; + } + + /** + * Create a dice from a string expression + * + * @param dice + * The string to parse the dice from + * @return A dice group parsed from the string + */ + public static LazyDice fromString(String dice) { + /* + * Split it on the dice type marker + */ + String[] strangs = dice.split("d"); + + try { + /* + * Create the actual dice + */ + return new LazyDice( + new ScalarDie(Integer.parseInt(strangs[0])), + new Die(Integer.parseInt(strangs[1]))); + } catch (NumberFormatException nfex) { + /* + * Tell the user the expression is invalid + */ + throw new IllegalStateException( + "Attempted to create a dice using something that's not" + + " an integer: " + strangs[0] + " and " + + strangs[1] + " are likely culprits."); + } + } +} diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/PolyhedralDice.java b/BJC-Utils2/src/main/java/bjc/utils/dice/PolyhedralDice.java index a8bebe6..0ce483a 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/PolyhedralDice.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/PolyhedralDice.java @@ -1,31 +1,86 @@ package bjc.utils.dice; +/** + * Class that produces common polyhedral dice + * + * @author ben + * + */ public class PolyhedralDice { - public static Dice d10(int nDice) { - return new Dice(nDice, 10); + /** + * Produce the specified number of 10-sided dice + * + * @param nDice + * The number of ten-sided dice to produce + * @return A group of ten-sided dice of the specified size + */ + public static LazyDice d10(int nDice) { + return new LazyDice(nDice, 10); } - - public static Dice d100(int nDice) { - return new Dice(nDice, 100); + + /** + * Produce the specified number of 100-sided dice + * + * @param nDice + * The number of hundred-sided dice to produce + * @return A group of hundred-sided dice of the specified size + */ + public static LazyDice d100(int nDice) { + return new LazyDice(nDice, 100); } - - public static Dice d12(int nDice) { - return new Dice(nDice, 12); + + /** + * Produce the specified number of 12-sided dice + * + * @param nDice + * The number of twelve-sided dice to produce + * @return A group of twelve-sided dice of the specified size + */ + public static LazyDice d12(int nDice) { + return new LazyDice(nDice, 12); } - - public static Dice d20(int nDice) { - return new Dice(nDice, 20); + + /** + * Produce the specified number of 20-sided dice + * + * @param nDice + * The number of twenty-sided dice to produce + * @return A group of twenty-sided dice of the specified size + */ + public static LazyDice d20(int nDice) { + return new LazyDice(nDice, 20); } - - public static Dice d4(int nDice) { - return new Dice(nDice, 4); + + /** + * Produce the specified number of 10-sided dice + * + * @param nDice + * The number of ten-sided dice to produce + * @return A group of ten-sided dice of the specified size + */ + public static LazyDice d4(int nDice) { + return new LazyDice(nDice, 4); } - - public static Dice d6(int nDice) { - return new Dice(nDice, 6); + + /** + * Produce the specified number of 10-sided dice + * + * @param nDice + * The number of ten-sided dice to produce + * @return A group of ten-sided dice of the specified size + */ + public static LazyDice d6(int nDice) { + return new LazyDice(nDice, 6); } - - public static Dice d8(int nDice) { - return new Dice(nDice, 8); + + /** + * Produce the specified number of 10-sided dice + * + * @param nDice + * The number of ten-sided dice to produce + * @return A group of ten-sided dice of the specified size + */ + public static LazyDice d8(int nDice) { + return new LazyDice(nDice, 8); } } diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDiceExpression.java b/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDiceExpression.java index 4b73dd5..205c216 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDiceExpression.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDiceExpression.java @@ -1,12 +1,33 @@ package bjc.utils.dice; -public class ScalarDiceExpression implements DiceExpression { +/** + * A dice expression that combines a scalar and a dice + * + * @author ben + * + */ +public class ScalarDiceExpression implements IDiceExpression { + /** + * The operation to combine with + */ private DiceExpressionType det; - private DiceExpression exp; + /** + * The expression to be combined + */ + private IDiceExpression exp; + /** + * The scalar to be combined + */ private int scalar; - public ScalarDiceExpression(DiceExpression dex, int scalr, + /** + * Create a dice expression with a scalar + * @param dex The dice to use + * @param scalr The scalar to use + * @param dt The operation to combine with + */ + public ScalarDiceExpression(IDiceExpression dex, int scalr, DiceExpressionType dt) { exp = dex; scalar = scalr; diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDie.java b/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDie.java index 7694afd..dde09b4 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDie.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/ScalarDie.java @@ -1,6 +1,14 @@ package bjc.utils.dice; -public class ScalarDie implements DiceExpression { +/** + * A die that represents a static number + * @author ben + * + */ +public class ScalarDie implements IDiceExpression { + /** + * The represented number + */ private int num; @Override @@ -8,6 +16,10 @@ public class ScalarDie implements DiceExpression { return num; } + /** + * Create a dice with the specified number + * @param num The number used for the dice + */ public ScalarDie(int num) { this.num = num; } -- cgit v1.2.3