/**
 * Simple class that models a colored dot.
 *   @author Dave Reed
 *   @version 1/25/17
 */
public class Dot {
    private Die die;
	private String dotColor;
	private int dotPosition;
	
	/**
	 * Constructs a dot object.
	 *   @param color the color of the dot (e.g., "blue", "red")
	 *   @param maxStep the maximum distance that can be covered in a single step
	 */
	public Dot(String color, int maxStep) {
	    this.die = new Die(maxStep);
	    this.dotColor = color;
	    this.dotPosition= 0;
	}

	/**
	 * Simulates taking a random step and moving the dot accordingly.
	 */
	public void step() {
	    this.dotPosition += this.die.roll();
	}
	
	/**
	 * Reset the dot back to the start position (0).
	 */
	public void reset() {
	    this.dotPosition = 0;
	}
	
	/**
	 * Reports the current position of the dot.
	 *   @return the dot position relative to start (0)
	 */
	public int getPosition() {
	    return this.dotPosition;
	}
		
	/**
	 * Prints the current color and position of the dot.
	 */
	public void showPosition() {
	    System.out.println(this.dotColor + ": " +
                           this.dotPosition);
	}
}
