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 10 things
        if( this.countThingsInBackpack() < this.maxNumberOfThings)
        {
            this.pickThing();                    // pick it up
        }

        // What if in main, we use pickThing, instead?
    }
}

public class ICE_06_Trace_2 extends Object
{
    public static void main(String[] args)
    { 
        City ForgetsVille = new City();
        MysteryRobot mary = new MysteryRobot(ForgetsVille, 4, 1, Direction.EAST, 0);
        mary.setMaxThings(10); // mary can carry at most 10 things
        MysteryRobot joe = new MysteryRobot(ForgetsVille, 3, 1, Direction.EAST, 0);
        joe.setMaxThings(1); // joe can carry at most 3 things
        joe.setColor(java.awt.Color.blue); // color joe green - ignore this line
        
        new Thing(ForgetsVille, 4, 1);
        new Thing(ForgetsVille, 4, 2);
        new Thing(ForgetsVille, 4, 3);

        new Thing(ForgetsVille, 3, 1);
        new Thing(ForgetsVille, 3, 2);
        
        
        // Mary will attempt to pick up all 3 things
        mary.pickThingLimited();
        mary.move();
        mary.pickThingLimited();
        mary.move();
        mary.pickThingLimited();
        mary.move();

        // Joe will attempt to pick up all 2 things
        joe.pickThingLimited();
        joe.move();
        joe.pickThingLimited();
        joe.move();
    }
}

