import becker.robots.*;

class MysteryRobot extends Robot
{
    int maxNumberOfThings;
    
    MysteryRobot( City c, int st, int ave, Direction dir, int num)
    {
        super(c, st, ave, dir, num);
    }

    public void setMaxThings(int maxThings)
    {
        this.maxNumberOfThings = maxThings;
    }

    public void pickThingLimited()
    {
        // The robot is only allowed to pick up this.maxNumberOfThings things
        if( this.countThingsInBackpack() < this.maxNumberOfThings)
        {
            this.pickThing();                    // pick it up
        }

        // What if in main, we use pickThing, instead?
    }
}

public class ICE_06_Demo_2 extends Object
{
    public static void main(String[] args)
    { 
        City ForgetsVille = new City();
        MysteryRobot joe = new MysteryRobot(ForgetsVille, 3, 1, Direction.EAST, 0);
        joe.setMaxThings(1); // joe can carry at most 1 things
        joe.setColor(java.awt.Color.blue); // color joe green - ignore this line
        
        new Thing(ForgetsVille, 3, 1);
        new Thing(ForgetsVille, 3, 2);

        // Joe will attempt to pick up all 2 things
        joe.pickThingLimited();
        joe.move();
        joe.pickThingLimited();
        joe.move();
    }
}

