summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@WIT-136XG42.wvu-ad.wvu.edu>2017-03-01 10:13:41 -0500
committerbjculkin <bjculkin@WIT-136XG42.wvu-ad.wvu.edu>2017-03-01 10:13:41 -0500
commit36e0911c6ec27707a74f0b90b1052a16374243ea (patch)
tree08ca7723b0c0a6a7f3ce1830c59e5211e46168b8 /dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java
parent6ed83507953322c35a456d64d89f8f4f9cb0a6a1 (diff)
Package reorganization
Diffstat (limited to 'dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java')
-rw-r--r--dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java63
1 files changed, 0 insertions, 63 deletions
diff --git a/dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java b/dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java
deleted file mode 100644
index d5991ae..0000000
--- a/dice-lang/src/bjc/dicelang/v2/dice/CompoundingDie.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package bjc.dicelang.v2.dice;
-
-import java.util.function.Predicate;
-
-public class CompoundingDie implements Die {
- private Die source;
-
- private Predicate<Long> compoundOn;
- private String compoundPattern;
-
- public CompoundingDie(Die src, Predicate<Long> compound) {
- this(src, compound, null);
- }
-
- public CompoundingDie(Die src, Predicate<Long> compound, String patt) {
- source = src;
-
- compoundOn = compound;
- compoundPattern = patt;
- }
-
- public boolean canOptimize() {
- return source.canOptimize() && source.optimize() == 0;
- }
-
- public long optimize() {
- return 0;
- }
-
- public long roll() {
- long res = source.roll();
- long oldRes = res;
-
- while(compoundOn.test(oldRes)) {
- oldRes = source.rollSingle();
-
- res += oldRes;
- }
-
- return res;
- }
-
- public long rollSingle() {
- long res = source.rollSingle();
- long oldRes = res;
-
- while(compoundOn.test(oldRes)) {
- oldRes = source.rollSingle();
-
- res += oldRes;
- }
-
- return res;
- }
-
- public String toString() {
- if(compoundPattern == null) {
- return source + "!!";
- } else {
- return source + "!!" + compoundPattern;
- }
- }
-} \ No newline at end of file