import java.util.ArrayList; public class DiceCup{ private ArrayList dice; private int creditBalance; public DiceCup(int Dx) { dice = new ArrayList(); creditBalance = 10; MyDie die; for (int i = 0; i <3; i++){ if (Dx == 8){ die = new EightDie(); } else{ die = new SixDie(); } 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(){ creditBalance -=1; checkTriplets(); checkDoubles(); checkLarge(); } 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()){ creditBalance -= 1; for (int i =0; i= 10){ creditBalance +=1; } } }