
/**
 * A class that models a simple Dot from a dot race.
 *   @author Dave Reed
 *   @version 8/15/13
 */
public class Dot {
    private Die die;
    private String dotColor;
    private int dotPosition;
    
    /**
     * Constructs a die of the specified color and step range.
     *   @param color the color of the die (e.g., "red")
     *   @param maxStep the maximum distance covered in a single step
     */    	
    public Dot(String color, int maxStep) {
    	this.die = new Die(maxStep);
    	this.dotColor = color;
    	this.dotPosition= 0;
    }

    /**
     * Simulates a single step of the Dot, moving it forward a random amount.
     */
    public void step() {
    	this.dotPosition += this.die.roll();
    }
    
    /**
     * Resets the position of the Dot back to 0.
     */
    public void reset() {
        this.dotPosition = 0;
    }
    
    /**
     * Acessor method that determines the current position of the Dot.
     *   @return the Dot's position
     */
    public int getPosition() {
    	return this.dotPosition;
    }
    
    /**
     * Displays the color and current position of the Dot.
     */
    public void showPosition() {
        System.out.println(this.dotColor + ": " + this.dotPosition);
    }
}
