
/**
 * A class that models a simple Dot from a dot race.
 * 
 * @author Dave Reed
 * @version 1/24/12
 */
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., "red", "blue")
	 *   @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 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);
	}
}
