   import becker.robots.*;

    public class ICE_05_Demo_1 extends Object
   {
       public static void main(String[] args)
      {
         City wallville = new City(5, 22);
         Robot rover = new Robot(wallville, 4, 0, Direction.EAST, 0);
      
        // For right now, ignore the following lines (L19 - L24)
         int i = 0;
         while(i < 20)
         {
         	i = i + 1;
	         new Thing(wallville, 4, i);
			}
        // Ok, stop ignoring the code, and pay attention again :)
      
      
        // This is the key idea:
        // The program will execute line 27 above, then advance down
        // to line 31, just like normal.
        // Much like the "if" statement, the line will ask the 
        // question "is rover beside a thing?"
        // And, like an if statement, if the answer is yes, the program
        // will execute everything between the curly braces (lines 32 to 35 )
        // HOWEVER, what make a while loop DIFFERENT from an if statement,
        // is that if the stuff in the curly braces gets run, you'll then
        // GO BACK TO THE WHILE (line 31), INSTEAD OF GOING ON
         rover.move();

         while( rover.canPickThing() )
         {
            rover.pickThing();
            rover.move(); // after executing this line, jump BACK to line 31
         }
        // Once we get a "no" answer on line 31, then we should jump here,
        // and resume the normal, top-to-bottom stepping that programs normally
        // do.
         rover.turnLeft();
         rover.move();
      }
   }
