import java.util.ArrayList;
import java.util.Collections;

public class RollGame2 {
  private ArrayList<Die> dice;
  private static final int NUM_DICE = 5;

  public RollGame2() {
    this.dice = new ArrayList<Die>();
	    
    this.dice.add(new ColoredDie(6, DieColor.RED));
    for (int i = 1; i < RollGame2.NUM_DICE; i++) {
      this.dice.add(new Die(6));
    }
    Collections.shuffle(dice);
  }

  public int rollPoints() {
    int total = 0;
    for (Die d : this.dice) {
      int roll = d.roll();
      total += roll;
      if (d instanceof ColoredDie) {
        ColoredDie cd = (ColoredDie)d;
        if (cd.getColor() == DieColor.RED) {
          total += roll;
        }
      }
    }
    return total;
  }
}
