diff options
| author | EVE <EVE@EVE-PC> | 2017-03-13 16:41:45 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-13 16:41:45 -0400 |
| commit | 01136c6796e21f023713e026674576d8e623462d (patch) | |
| tree | e77886fe0e0adaf3c0430fba9ce248ef83f74fe4 /dice-lang/src/bjc/dicelang/dice | |
| parent | 870d769cfc152171d27b2331a7c590d0b307ad48 (diff) | |
Formatting
Diffstat (limited to 'dice-lang/src/bjc/dicelang/dice')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/CompoundDie.java | 6 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/CompoundingDie.java | 26 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/DiceBox.java | 86 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/Die.java | 4 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/DieExpression.java | 22 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/DieList.java | 6 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/ExplodingDice.java | 57 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/FudgeDie.java | 4 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/MathDie.java | 12 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/SimpleDie.java | 21 | ||||
| -rw-r--r-- | dice-lang/src/bjc/dicelang/dice/SimpleDieList.java | 10 |
11 files changed, 143 insertions, 111 deletions
diff --git a/dice-lang/src/bjc/dicelang/dice/CompoundDie.java b/dice-lang/src/bjc/dicelang/dice/CompoundDie.java index a20095a..d4bb4b5 100644 --- a/dice-lang/src/bjc/dicelang/dice/CompoundDie.java +++ b/dice-lang/src/bjc/dicelang/dice/CompoundDie.java @@ -15,8 +15,10 @@ public class CompoundDie implements Die { /**
* Create a new compound die.
*
- * @param lft The left die
- * @param rght The right die
+ * @param lft
+ * The left die
+ * @param rght
+ * The right die
*/
public CompoundDie(Die lft, Die rght) {
left = lft;
diff --git a/dice-lang/src/bjc/dicelang/dice/CompoundingDie.java b/dice-lang/src/bjc/dicelang/dice/CompoundingDie.java index 3291b52..28badf4 100644 --- a/dice-lang/src/bjc/dicelang/dice/CompoundingDie.java +++ b/dice-lang/src/bjc/dicelang/dice/CompoundingDie.java @@ -14,13 +14,15 @@ public class CompoundingDie implements Die { private Die source;
private Predicate<Long> compoundOn;
- private String compoundPattern;
+ private String compoundPattern;
/**
* Create a new compounding die with no pattern.
*
- * @param src The die to compound from
- * @param compound The conditions to compound on
+ * @param src
+ * The die to compound from
+ * @param compound
+ * The conditions to compound on
*/
public CompoundingDie(Die src, Predicate<Long> compound) {
this(src, compound, null);
@@ -29,14 +31,18 @@ public class CompoundingDie implements Die { /**
* Create a new compounding die with a specified pattern.
*
- * @param src The die to compound from
- * @param compound The conditions to compound on
- * @param patt The string pattern the condition came from, for printing
+ * @param src
+ * The die to compound from
+ * @param compound
+ * The conditions to compound on
+ * @param patt
+ * The string pattern the condition came from, for
+ * printing
*/
public CompoundingDie(Die src, Predicate<Long> compound, String patt) {
source = src;
- compoundOn = compound;
+ compoundOn = compound;
compoundPattern = patt;
}
@@ -55,7 +61,7 @@ public class CompoundingDie implements Die { long res = source.roll();
long oldRes = res;
- while(compoundOn.test(oldRes)) {
+ while (compoundOn.test(oldRes)) {
oldRes = source.rollSingle();
res += oldRes;
@@ -72,7 +78,7 @@ public class CompoundingDie implements Die { long res = source.rollSingle();
long oldRes = res;
- while(compoundOn.test(oldRes)) {
+ while (compoundOn.test(oldRes)) {
oldRes = source.rollSingle();
res += oldRes;
@@ -83,7 +89,7 @@ public class CompoundingDie implements Die { @Override
public String toString() {
- if(compoundPattern == null) {
+ if (compoundPattern == null) {
return source + "!!";
} else {
return source + "!!" + compoundPattern;
diff --git a/dice-lang/src/bjc/dicelang/dice/DiceBox.java b/dice-lang/src/bjc/dicelang/dice/DiceBox.java index 92e58af..85edc77 100644 --- a/dice-lang/src/bjc/dicelang/dice/DiceBox.java +++ b/dice-lang/src/bjc/dicelang/dice/DiceBox.java @@ -21,23 +21,24 @@ public class DiceBox { /* * Only bother will valid expressions */ - if(!isValidExpression(exp)) return null; + if (!isValidExpression(exp)) + return null; - if(scalarDiePattern.matcher(exp).matches()) { + if (scalarDiePattern.matcher(exp).matches()) { /* * Parse scalar die */ Die scal = new ScalarDie(Long.parseLong(exp.substring(0, exp.indexOf('s')))); return new DieExpression(scal); - } else if(simpleDiePattern.matcher(exp).matches()) { + } else if (simpleDiePattern.matcher(exp).matches()) { /* * Parse simple die groups */ String[] dieParts = exp.split("d"); long right = Long.parseLong(dieParts[1]); - if(dieParts[0].equals("")) { + if (dieParts[0].equals("")) { /* * Handle short-form expressions. */ @@ -47,65 +48,65 @@ public class DiceBox { Die scal = new SimpleDie(Long.parseLong(dieParts[0]), right); return new DieExpression(scal); } - } else if(fudgeDiePattern.matcher(exp).matches()) { + } else if (fudgeDiePattern.matcher(exp).matches()) { /* * Parse fudge dice */ String nDice = exp.substring(0, exp.indexOf('d')); return new DieExpression(new FudgeDie(Long.parseLong(nDice))); - } else if(compoundDiePattern.matcher(exp).matches()) { + } else if (compoundDiePattern.matcher(exp).matches()) { /* * Parse compound die expressions */ String[] dieParts = exp.split("c"); - DieExpression left = parseExpression(dieParts[0]); + DieExpression left = parseExpression(dieParts[0]); DieExpression right = parseExpression(dieParts[1]); return new DieExpression(new CompoundDie(left.scalar, right.scalar)); - } else if(compoundingDiePattern.matcher(exp).matches()) { + } else if (compoundingDiePattern.matcher(exp).matches()) { /* * Parse compounding die expressions */ String[] dieParts = exp.split("!!"); - DieExpression left = parseExpression(dieParts[0]); + DieExpression left = parseExpression(dieParts[0]); Predicate<Long> right = deriveCond(dieParts[1]); Die scal = new CompoundingDie(left.scalar, right, dieParts[1]); return new DieExpression(scal); - } else if(explodingDiePattern.matcher(exp).matches()) { + } else if (explodingDiePattern.matcher(exp).matches()) { /* * Parse exploding die expressions */ String[] dieParts = exp.split("!"); - DieExpression left = parseExpression(dieParts[0]); + DieExpression left = parseExpression(dieParts[0]); Predicate<Long> right = deriveCond(dieParts[1]); DieList lst = new ExplodingDice(left.scalar, right, dieParts[1], false); return new DieExpression(lst); - } else if(penetratingDiePattern.matcher(exp).matches()) { + } else if (penetratingDiePattern.matcher(exp).matches()) { /* * Parse penetrating die expressions */ String[] dieParts = exp.split("p!"); - DieExpression left = parseExpression(dieParts[0]); + DieExpression left = parseExpression(dieParts[0]); Predicate<Long> right = deriveCond(dieParts[1]); DieList lst = new ExplodingDice(left.scalar, right, dieParts[1], true); return new DieExpression(lst); - } else if(diceListPattern.matcher(exp).matches()) { + } else if (diceListPattern.matcher(exp).matches()) { /* * Parse simple die lists */ String[] dieParts = exp.split("dl"); - DieExpression left = parseExpression(dieParts[0]); + DieExpression left = parseExpression(dieParts[0]); DieExpression right = parseExpression(dieParts[1]); - + DieList lst = new SimpleDieList(left.scalar, right.scalar); return new DieExpression(lst); } @@ -120,23 +121,23 @@ public class DiceBox { /* * Defines a comparison predicate */ - private static final String comparePoint = "[<>=]\\d+"; + private static final String comparePoint = "[<>=]\\d+"; /* * Defines a scalar die. * * This is just a number. */ - private static final String scalarDie = "[\\+\\-]?\\d+sd"; - private static final Pattern scalarDiePattern = Pattern.compile("\\A" + scalarDie + "\\Z"); + private static final String scalarDie = "[\\+\\-]?\\d+sd"; + private static final Pattern scalarDiePattern = Pattern.compile("\\A" + scalarDie + "\\Z"); /* * Defines a simple die. * * This is a group of one or more dice of the same size. */ - private static final String simpleDie = "(?:\\d+)?d\\d+"; - private static final Pattern simpleDiePattern = Pattern.compile("\\A" + simpleDie + "\\Z"); + private static final String simpleDie = "(?:\\d+)?d\\d+"; + private static final Pattern simpleDiePattern = Pattern.compile("\\A" + simpleDie + "\\Z"); /* * Defines a fudge die. @@ -144,24 +145,24 @@ public class DiceBox { * This is like a simple die, but all the die give -1, 0, or 1 as * results. */ - private static final String fudgeDie = "(?:\\d+)?dF"; - private static final Pattern fudgeDiePattern = Pattern.compile("\\A" + fudgeDie + "\\Z"); + private static final String fudgeDie = "(?:\\d+)?dF"; + private static final Pattern fudgeDiePattern = Pattern.compile("\\A" + fudgeDie + "\\Z"); /* * Defines a compound die. * * This is like using two d10's to simulate a d100 */ - private static final String compoundDie = simpleDie + "c(?:(?:" + simpleDie + ")|(?:\\d+))"; - private static final Pattern compoundDiePattern = Pattern.compile("\\A" + compoundDie + "\\Z"); + private static final String compoundDie = simpleDie + "c(?:(?:" + simpleDie + ")|(?:\\d+))"; + private static final Pattern compoundDiePattern = Pattern.compile("\\A" + compoundDie + "\\Z"); /* * Defines a compound group. * * This is used for forming die list type expressions. */ - private static final String compoundGroup = "(?:(?:" + scalarDie + ")|(?:" + simpleDie + ")|(?:" - + compoundDie + ")|(?:" + fudgeDie +"))"; + private static final String compoundGroup = "(?:(?:" + scalarDie + ")|(?:" + simpleDie + ")|(?:" + compoundDie + + ")|(?:" + fudgeDie + "))"; /* * Defines a compounding die. @@ -169,7 +170,7 @@ public class DiceBox { * This is like an exploding die, but is a single die, not a group of * them. */ - private static final String compoundingDie = compoundGroup + "!!" + comparePoint; + private static final String compoundingDie = compoundGroup + "!!" + comparePoint; private static final Pattern compoundingDiePattern = Pattern.compile("\\A" + compoundingDie + "\\Z"); /* @@ -178,7 +179,7 @@ public class DiceBox { * This is a die that you reroll the component of if it meets a certain * condition. */ - private static final String explodingDie = compoundGroup + "!" + comparePoint; + private static final String explodingDie = compoundGroup + "!" + comparePoint; private static final Pattern explodingDiePattern = Pattern.compile("\\A" + explodingDie + "\\Z"); /* @@ -187,7 +188,7 @@ public class DiceBox { * This is like an exploding die, but the exploded result gets a -1 * penalty. */ - private static final String penetratingDie = compoundGroup + "!" + comparePoint; + private static final String penetratingDie = compoundGroup + "!" + comparePoint; private static final Pattern penetratingDiePattern = Pattern.compile("\\A" + penetratingDie + "\\Z"); /* @@ -195,30 +196,31 @@ public class DiceBox { * * This is an array of dice of the specified size */ - private static final String diceList = compoundGroup + "dl" + compoundGroup; - private static final Pattern diceListPattern = Pattern.compile("\\A" + diceList + "\\Z"); + private static final String diceList = compoundGroup + "dl" + compoundGroup; + private static final Pattern diceListPattern = Pattern.compile("\\A" + diceList + "\\Z"); /** * Check if a given string is a valid die expression. * - * @param exp The string to check validity of. + * @param exp + * The string to check validity of. * * @return Whether or not the string is a valid command */ public static boolean isValidExpression(String exp) { - if(scalarDiePattern.matcher(exp).matches()) { + if (scalarDiePattern.matcher(exp).matches()) { return true; - } else if(simpleDiePattern.matcher(exp).matches()) { + } else if (simpleDiePattern.matcher(exp).matches()) { return true; - } else if(fudgeDiePattern.matcher(exp).matches()) { + } else if (fudgeDiePattern.matcher(exp).matches()) { return true; - } else if(compoundDiePattern.matcher(exp).matches()) { + } else if (compoundDiePattern.matcher(exp).matches()) { return true; - } else if(compoundingDiePattern.matcher(exp).matches()) { + } else if (compoundingDiePattern.matcher(exp).matches()) { return true; - } else if(explodingDiePattern.matcher(exp).matches()) { + } else if (explodingDiePattern.matcher(exp).matches()) { return true; - } else if(penetratingDiePattern.matcher(exp).matches()) { + } else if (penetratingDiePattern.matcher(exp).matches()) { return true; } else if (diceListPattern.matcher(exp).matches()) { return true; @@ -231,9 +233,9 @@ public class DiceBox { * Derive a predicate from a compare point */ private static Predicate<Long> deriveCond(String patt) { - long num = Long.parseLong(patt.substring(1)); + long num = Long.parseLong(patt.substring(1)); - switch(patt.charAt(0)) { + switch (patt.charAt(0)) { case '<': return (roll) -> roll < num; case '=': diff --git a/dice-lang/src/bjc/dicelang/dice/Die.java b/dice-lang/src/bjc/dicelang/dice/Die.java index 22ba522..0ce7d3b 100644 --- a/dice-lang/src/bjc/dicelang/dice/Die.java +++ b/dice-lang/src/bjc/dicelang/dice/Die.java @@ -12,6 +12,7 @@ public interface Die { * @return Whether this die can be optimized or not.
*/
boolean canOptimize();
+
/**
* Optimize this die to a single number.
*
@@ -20,7 +21,7 @@ public interface Die { *
* @return The optimized form of this die
*/
- long optimize();
+ long optimize();
/**
* Roll this die.
@@ -28,6 +29,7 @@ public interface Die { * @return A possible roll of this die
*/
long roll();
+
/**
* Roll only a single portion of this die.
*
diff --git a/dice-lang/src/bjc/dicelang/dice/DieExpression.java b/dice-lang/src/bjc/dicelang/dice/DieExpression.java index 81d0b7d..95e7dae 100644 --- a/dice-lang/src/bjc/dicelang/dice/DieExpression.java +++ b/dice-lang/src/bjc/dicelang/dice/DieExpression.java @@ -16,7 +16,7 @@ public class DieExpression { /**
* The scalar value in this expression, if there is one.
*/
- public Die scalar;
+ public Die scalar;
/**
* The list value in this expression, if there is one.
*/
@@ -25,7 +25,8 @@ public class DieExpression { /**
* Create a scalar die expression.
*
- * @param scal The scalar value of this expression.
+ * @param scal
+ * The scalar value of this expression.
*/
public DieExpression(Die scal) {
isList = false;
@@ -35,24 +36,29 @@ public class DieExpression { /**
* Create a list die expression.
*
- * @param lst The list value of this expression.
+ * @param lst
+ * The list value of this expression.
*/
public DieExpression(DieList lst) {
isList = true;
- list = lst;
+ list = lst;
}
@Override
public String toString() {
- if(isList) return list.toString();
- else return scalar.toString();
+ if (isList)
+ return list.toString();
+ else
+ return scalar.toString();
}
/**
* Get the value of this expression as a string.
*/
public String value() {
- if(isList) return Arrays.toString(list.roll());
- else return Long.toString(scalar.roll());
+ if (isList)
+ return Arrays.toString(list.roll());
+ else
+ return Long.toString(scalar.roll());
}
}
diff --git a/dice-lang/src/bjc/dicelang/dice/DieList.java b/dice-lang/src/bjc/dicelang/dice/DieList.java index 5454759..5cabc77 100644 --- a/dice-lang/src/bjc/dicelang/dice/DieList.java +++ b/dice-lang/src/bjc/dicelang/dice/DieList.java @@ -12,6 +12,7 @@ public interface DieList { * @return Whether or not this list cna be optimized.
*/
boolean canOptimize();
+
/**
* Optimize this list, if it can be done.
*
@@ -19,12 +20,13 @@ public interface DieList { *
* @return The optimized form of this list.
*/
- long[] optimize();
+ long[] optimize();
/**
* Roll this group of dice.
*
- * @param A possible roll of this group.
+ * @param A
+ * possible roll of this group.
*/
long[] roll();
}
diff --git a/dice-lang/src/bjc/dicelang/dice/ExplodingDice.java b/dice-lang/src/bjc/dicelang/dice/ExplodingDice.java index 59e739e..eeafbd1 100644 --- a/dice-lang/src/bjc/dicelang/dice/ExplodingDice.java +++ b/dice-lang/src/bjc/dicelang/dice/ExplodingDice.java @@ -16,20 +16,22 @@ public class ExplodingDice implements DieList { /*
* The source die to use.
*/
- private Die source;
+ private Die source;
/*
* The conditions for exploding.
*/
private Predicate<Long> explodeOn;
- private String explodePattern;
- private boolean explodePenetrates;
+ private String explodePattern;
+ private boolean explodePenetrates;
/**
* Create a new exploding die.
*
- * @param src The source die for exploding.
- * @param explode The condition to explode on.
+ * @param src
+ * The source die for exploding.
+ * @param explode
+ * The condition to explode on.
*/
public ExplodingDice(Die src, Predicate<Long> explode) {
this(src, explode, null, false);
@@ -38,10 +40,13 @@ public class ExplodingDice implements DieList { /**
* Create a new exploding die that may penetrate.
*
- * @param src The source die for exploding.
- * @param explode The condition to explode on.
- * @param penetrate Whether or not for explosions to penetrate (-1 to
- * exploded die).
+ * @param src
+ * The source die for exploding.
+ * @param explode
+ * The condition to explode on.
+ * @param penetrate
+ * Whether or not for explosions to penetrate (-1 to
+ * exploded die).
*/
public ExplodingDice(Die src, Predicate<Long> explode, boolean penetrate) {
this(src, explode, null, penetrate);
@@ -50,17 +55,20 @@ public class ExplodingDice implements DieList { /**
* Create a new exploding die that may penetrate.
*
- * @param src The source die for exploding.
- * @param explode The condition to explode on.
- * @param penetrate Whether or not for explosions to penetrate (-1 to
- * exploded die).
- * @param patt The string the condition came from, for printing.
+ * @param src
+ * The source die for exploding.
+ * @param explode
+ * The condition to explode on.
+ * @param penetrate
+ * Whether or not for explosions to penetrate (-1 to
+ * exploded die).
+ * @param patt
+ * The string the condition came from, for printing.
*/
- public ExplodingDice(Die src, Predicate<Long> explode, String patt,
- boolean penetrate) {
- source = src;
- explodeOn = explode;
- explodePattern = patt;
+ public ExplodingDice(Die src, Predicate<Long> explode, String patt, boolean penetrate) {
+ source = src;
+ explodeOn = explode;
+ explodePattern = patt;
explodePenetrates = penetrate;
}
@@ -81,10 +89,11 @@ public class ExplodingDice implements DieList { List<Long> resList = new LinkedList<>();
- while(explodeOn.test(oldRes)) {
+ while (explodeOn.test(oldRes)) {
oldRes = source.rollSingle();
- if(explodePenetrates) oldRes -= 1;
+ if (explodePenetrates)
+ oldRes -= 1;
resList.add(oldRes);
}
@@ -92,9 +101,9 @@ public class ExplodingDice implements DieList { newRes[0] = res;
int i = 1;
- for(long rll : resList) {
+ for (long rll : resList) {
newRes[i] = rll;
- i += 1;
+ i += 1;
}
return newRes;
@@ -102,7 +111,7 @@ public class ExplodingDice implements DieList { @Override
public String toString() {
- if(explodePattern == null) {
+ if (explodePattern == null) {
return source + (explodePenetrates ? "p" : "") + "!";
} else {
return source + (explodePenetrates ? "p" : "") + "!" + explodePattern;
diff --git a/dice-lang/src/bjc/dicelang/dice/FudgeDie.java b/dice-lang/src/bjc/dicelang/dice/FudgeDie.java index 554c7ff..8061475 100644 --- a/dice-lang/src/bjc/dicelang/dice/FudgeDie.java +++ b/dice-lang/src/bjc/dicelang/dice/FudgeDie.java @@ -21,10 +21,10 @@ public class FudgeDie implements Die { public long roll() {
long res = 0;
-
+
long nDice = numDice.roll();
- for(int i = 0; i < nDice; i++) {
+ for (int i = 0; i < nDice; i++) {
res += rollSingle();
}
diff --git a/dice-lang/src/bjc/dicelang/dice/MathDie.java b/dice-lang/src/bjc/dicelang/dice/MathDie.java index 7e9204d..2e82a6e 100644 --- a/dice-lang/src/bjc/dicelang/dice/MathDie.java +++ b/dice-lang/src/bjc/dicelang/dice/MathDie.java @@ -5,7 +5,7 @@ public class MathDie implements Die { ADD, SUBTRACT, MULTIPLY;
public String toString() {
- switch(this) {
+ switch (this) {
case ADD:
return "+";
case SUBTRACT:
@@ -26,7 +26,7 @@ public class MathDie implements Die { public MathDie(MathDie.MathOp op, Die lft, Die rght) {
type = op;
- left = lft;
+ left = lft;
right = rght;
}
@@ -35,7 +35,7 @@ public class MathDie implements Die { }
private long performOp(long lft, long rght) {
- switch(type) {
+ switch (type) {
case ADD:
return lft + rght;
case SUBTRACT:
@@ -48,21 +48,21 @@ public class MathDie implements Die { }
public long optimize() {
- long lft = left.optimize();
+ long lft = left.optimize();
long rght = right.optimize();
return performOp(lft, rght);
}
public long roll() {
- long lft = left.roll();
+ long lft = left.roll();
long rght = right.roll();
return performOp(lft, rght);
}
public long rollSingle() {
- long lft = left.rollSingle();
+ long lft = left.rollSingle();
long rght = right.rollSingle();
return performOp(lft, rght);
diff --git a/dice-lang/src/bjc/dicelang/dice/SimpleDie.java b/dice-lang/src/bjc/dicelang/dice/SimpleDie.java index 5ba76ef..fc1aacd 100644 --- a/dice-lang/src/bjc/dicelang/dice/SimpleDie.java +++ b/dice-lang/src/bjc/dicelang/dice/SimpleDie.java @@ -5,36 +5,39 @@ public class SimpleDie implements Die { private Die diceSize;
public SimpleDie(long nDice, long size) {
- numDice = new ScalarDie(nDice);
+ numDice = new ScalarDie(nDice);
diceSize = new ScalarDie(size);
}
public SimpleDie(Die nDice, long size) {
- numDice = nDice;
+ numDice = nDice;
diceSize = new ScalarDie(size);
}
public SimpleDie(long nDice, Die size) {
- numDice = new ScalarDie(nDice);
+ numDice = new ScalarDie(nDice);
diceSize = size;
}
public SimpleDie(Die nDice, Die size) {
- numDice = nDice;
+ numDice = nDice;
diceSize = size;
}
public boolean canOptimize() {
- if(diceSize.canOptimize() && (diceSize.optimize() <= 1)) {
+ if (diceSize.canOptimize() && (diceSize.optimize() <= 1)) {
return numDice.canOptimize();
- } else return false;
+ } else
+ return false;
}
public long optimize() {
long optSize = diceSize.optimize();
- if(optSize == 0) return 0;
- else return numDice.optimize();
+ if (optSize == 0)
+ return 0;
+ else
+ return numDice.optimize();
}
public long roll() {
@@ -43,7 +46,7 @@ public class SimpleDie implements Die { long nDice = numDice.roll();
long dSize = diceSize.roll();
- for(int i = 0; i < nDice; i++) {
+ for (int i = 0; i < nDice; i++) {
total += (Math.abs(DiceBox.rng.nextLong()) % dSize) + 1;
}
diff --git a/dice-lang/src/bjc/dicelang/dice/SimpleDieList.java b/dice-lang/src/bjc/dicelang/dice/SimpleDieList.java index cca1f04..e166949 100644 --- a/dice-lang/src/bjc/dicelang/dice/SimpleDieList.java +++ b/dice-lang/src/bjc/dicelang/dice/SimpleDieList.java @@ -10,7 +10,7 @@ public class SimpleDieList implements DieList { }
public boolean canOptimize() {
- if(size.canOptimize() && size.optimize() <= 1) {
+ if (size.canOptimize() && size.optimize() <= 1) {
return numDice.canOptimize();
} else {
return false;
@@ -18,12 +18,12 @@ public class SimpleDieList implements DieList { }
public long[] optimize() {
- int sze = (int)numDice.optimize();
+ int sze = (int) numDice.optimize();
long res = size.optimize();
long[] ret = new long[sze];
- for(int i = 0; i < sze; i++) {
+ for (int i = 0; i < sze; i++) {
ret[i] = res;
}
@@ -31,11 +31,11 @@ public class SimpleDieList implements DieList { }
public long[] roll() {
- int num = (int)numDice.roll();
+ int num = (int) numDice.roll();
long[] ret = new long[num];
- for(int i = 0; i < num; i++) {
+ for (int i = 0; i < num; i++) {
ret[i] = size.roll();
}
|
