import becker.robots.*;

class RobotSmarter extends Robot
{
    RobotSmarter(City c, int st, int ave, Direction dir, int num)
    {
        super(c, st, ave, dir, num);
    }

    public void moveMultiple(int numberOfIntersections)
    {
        int counter = 0;
        while ( counter < numberOfIntersections)
        {
            this.move();
            counter = counter + 1; 
            // counter is given: (the current value of counter plus 1)
        }
    }
}

public class ICE_06_Demo_1 extends Object
{
    public static void main(String[] args)
    {
        City wallville = new City();
        RobotSmarter rob = new RobotSmarter(wallville, 1, 0, Direction.EAST, 0);

        new Thing(wallville, 1, 0);
        new Thing(wallville, 4, 2);
        new Thing(wallville, 1, 2);

        // Instead of giving rob 3 separate "move" commands,
        // simply tell it that you want it to move 3 times
        rob.moveMultiple(2);
        rob.turnLeft();
        rob.turnLeft();
        rob.turnLeft();
        rob.moveMultiple(3);
    }
}
