/**
 * This class simulates a dot race between a red and a blue dot.  At every step,
 * each dot moves forward a random amount (as determined by the roll of a die).
 *   @author Dave Reed 
 *   @version 8/15/13
 */
public class DotRace {

   public final static int GOAL = 20;
   public final static int MAX_STEP = 3;

   public static void main(String[] args) {
      Dot redDot = new Dot("RED", MAX_STEP);
      Dot blueDot = new Dot("BLUE", MAX_STEP);

      while (redDot.getPosition() < GOAL && blueDot.getPosition() < GOAL) {
         redDot.step();
         blueDot.step();

         redDot.showPosition();
         blueDot.showPosition();
      }

      if (redDot.getPosition() >= GOAL && blueDot.getPosition() >= GOAL) {
         System.out.println("It is a tie");
      }
      else if (redDot.getPosition() >= GOAL) {
         System.out.println("RED wins!");
      }
      else {
         System.out.println("BLUE wins!");
      }
   }
}

