/**
 * Produces graphics dice displays 
 */
public class DiceDisplay {
  
  private String[] faces = new String[6];  
  
  /**
   * @param d the dice to be displayed
   * @param x x-coordinate for the upper left corner of the window
   * @param y y-coordinate for the upper left corner of the window
   */
  public DiceDisplay() {
    faces[0] = "images/Die1.png";
    faces[1] = "images/Die2.png";
    faces[2] = "images/Die3.png";
    faces[3] = "images/Die4.png";
    faces[4] = "images/Die5.png";
    faces[5] = "images/Die6.png";
  }
  
  void display(Dice d, int x, int y) {
    int index = d.getValue() - 1;
    new ImageDisplay(faces[index], 230, 230, x, y);
  }
  
  /**
   * Demonstration program
   */
  public static void main(String[] args) {
    Dice d = new Dice();
    DiceDisplay dd = new DiceDisplay();   
    for (int i =0; i<12; i++) {
      d.roll();
      //dd.display(d, 0, 0); 
      dd.display(d, i%4*240, i/4*280);
    }
    System.out.println();
  }
  
}