Example #1
0
 public Outcome throwDice(int[] dice) {
   dice[0] = random.nextInt(6) + 1;
   dice[1] = random.nextInt(6) + 1;
   round.addNumber(dice[0], dice[1]);
   Outcome outcome = Outcome.CAN_ROLL;
   if (dice[0] == 1 && dice[1] == 1) {
     resetRounds();
     round.resetCounts();
     nextRound();
     outcome = Outcome.CANT_ROLL;
   }
   if (dice[0] == 1 || dice[1] == 1) {
     round.resetCounts();
     nextRound();
     outcome = Outcome.CANT_ROLL;
   }
   if ((dice[0] == dice[1]) && dice[0] != 1) {
     outcome = Outcome.MUST_ROLL;
   }
   return outcome;
 }
Example #2
0
 private void resetRounds() {
   for (Round round : rounds) round.resetCounts();
 }