import java.util.Random;
import java.awt.Color;

abstract public class MobileSimObject extends SimObject {
    // OVERVIEW: A MobileSimObject is a simulator object that can move.
    //    Note: its still an abstract class since we didn't implement executeTurn.

    public  void setLocation (int newrow, int newcol)
	// REQUIRES: The square in the grid at newrow, newcol is empty.
        //@requires isInitialized
	// MODIFIES: this
	// EFFECTS: sets this SimObject's location to newrow, newcol.
    {
	if (grid.getObjectAt (newrow, newcol) != null) {
	    throw new RuntimeException ("BUG: SimObject.setLocation - row: " + newrow + " col: " + newcol + " already occupied.");
	}

	// Empty location, move to it.
	mrow = newrow;
	mcol = newcol;
    } //@nowarn Exception // Don't warn about the unexpected Runtime exception.
}