diff --git a/Project/DiceCup.java b/Project/DiceCup.java new file mode 100644 index 0000000..ec1cd66 --- /dev/null +++ b/Project/DiceCup.java @@ -0,0 +1,98 @@ +import java.util.ArrayList; + +public class DiceCup{ + private ArrayList dice; + private int creditBalance; + + + public DiceCup(int Dx) { + dice = new ArrayList(); + creditBalance = 10; + + MyDie die; + + if (Dx == 8){ + die = new EightDie(); + } + else{ + die = new SixDie(); + } + + for (int i = 0; i <3; i++){ + dice.add(die); + } + } + + /* Accessors */ + + public int getCredits(){ + return creditBalance; + } + + public ArrayList getDice(){ + return dice; + } + public int getTotal(){ + int total = 0; + for (MyDie die:dice){ + total += die.getValue(); + } + return total; + } + + /* Actions */ + + public void roll(){ + for (MyDie die:dice){ + die.roll(); + } + + } + public void updateCredits(){ + if (enoughCredits()){ + creditBalance -=1; + } + } + + public boolean enoughCredits(){ + if (creditBalance > 0){ + return true; + } + else{ + return false; + } + } + + public void testRoll(int [] values){ + //roll dice until desired 3 int array happens + if (enoughCredits()){ + for (int i =0; i= 10){ + creditBalance +=1; + } + } +}