/**
 * Demo
 * CS1101 Lab #4 Exercise 3: FourPegs.java
 * This program defines the Four-Peg class.
 */

class FourPegs {
  
   // Data members
   private Peg peg1, peg2, peg3, peg4;

   // Constructors
   public FourPegs() {
      this(new Peg('R'), new Peg('R'), new Peg('R'), new Peg('R'));
   }

   public FourPegs(FourPegs pegs) {
      this(new Peg(pegs.peg1), 
           new Peg(pegs.peg2),
           new Peg(pegs.peg3),
           new Peg(pegs.peg4));
   }

   public FourPegs(Peg p1, Peg p2, Peg p3, Peg p4) {
      peg1 = p1;
      peg2 = p2;
      peg3 = p3;
      peg4 = p4;
   }

//-------------------------------------------------
//      Public Methods:
//          void setColour ( int, char );
//          char getColour ( int );
//          String toString ( );
//          int countSinks ( FourPegs );
//          int countHits ( FourPegs );
//------------------------------------------------
   
   // Changes the colour of the selected peg
   public void setColour (int whichPeg, char c) {
       switch (whichPeg) {
         case 1: peg1.setColour(c); break;
         case 2: peg2.setColour(c); break;
         case 3: peg3.setColour(c); break;
         case 4: peg4.setColour(c); break;
         default: System.err.println("No such peg!");
                  System.exit(1);
       }
   }

   // Returns colour of the selected peg 
   public char getColour (int whichPeg) {
       char c = ' ';
       switch (whichPeg) {
         case 1: c = peg1.getColour(); break;
         case 2: c = peg2.getColour(); break;
         case 3: c = peg3.getColour(); break;
         case 4: c = peg4.getColour(); break;
         default: System.err.println("No such peg!");
                  System.exit(2);
       }
       return c;
   }

   // Returns string representation of a FourPegs object
   public String toString () {
       // this is a stub
       return "";
   }

   // Returns the number of sinks between object and guessPegs
   public int countSinks (FourPegs guessPegs) {
       // this is a stub
       return 0;
   }

   // Returns the number of hits between object and guessPegs
   public int countHits (FourPegs guessPegs) {
       // this is a stub
       return 0;
   }

}


