import java.awt.Color;


public class Laser extends MobileSimObject {
    // OVERVIEW: A Laser is a MobileSimObject that moves north until it cannot, and then dies.



    public Laser () {
	;
    }

    public Color getColor()
    {
	return Color.white;
    }

    public void executeTurn() throws RuntimeException
    	//EFFECTS: Moves north or is removed
	{

	Direction dir = new Direction(-1,0);
	int newrow = getRow () + dir.northerlyDirection ();
	int newcol = getColumn () + dir.easterlyDirection ();


	if (getGrid ().validLocation (newrow, newcol)) {
	    if (getGrid().isSquareEmpty (newrow, newcol))
		{
		    setLocation (newrow, newcol);
		}
	}
	else {
		getGrid().removeObject(this);

	}


    }
}