/**
 * This class simulates a dot race beween 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 1/24/12
 */
public class DotRace {
    private Dot redDot;
    private Dot blueDot;    

    /**
     * Constructs a dot race where each dot's step is a random int in the range 1..maxStep
     *   @param maxStep the maximum distance a dot can cover in any one step
     */
    public DotRace(int maxStep) {
        this.redDot = new Dot("red", maxStep);
        this.blueDot = new Dot("blue", maxStep);
      }

    /**
     * Accessor method for determining the red dot's position.
     *   @return the position of the red dot (starting position = 0)
     */
    public int getRedPosition() {
        return this.redDot.getPosition();
    }
    
    /**
     * Accessor method for determining the blue dot's position.
     *   @return the position of the blue dot (starting position = 0)
     */
    public int getBluePosition() {
        return this.blueDot.getPosition();
    }   
    
    /**
     * Simulates a random step for each of the dots (updating their positions).
     */
    public void step() {
        this.redDot.step();
        this.blueDot.step();
    }
       
    /**
     * Displays the current status of the race.
     *   @return the position of the blue dot (starting position = 0)
     */   
    public void showStatus() {
        this.redDot.showPosition();
        this.blueDot.showPosition();
    }
    
    /**
     * Resets the race so that both dots are at the starting position (= 0).
     */
    public void reset() {
        this.redDot.reset();
        this.blueDot.reset();
    }
}
