import becker.robots.*; /** This application programs a Robot to pick up lights on a street and move them one block to the east. */ public class StreetRepaving { public static void main(String[] args) { City vancouver = new City(); Robot lightMover = new Robot(vancouver, 0, 2, Directions.EAST); // Here's where we create flashing lights on 2nd Street. // The last parameter turns the flashing light on. Flasher flash1 = new Flasher(vancouver, 1, 2, true); Flasher flash2 = new Flasher(vancouver, 2, 2, true); Flasher flash3 = new Flasher(vancouver, 3, 2, true); Flasher flash4 = new Flasher(vancouver, 4, 2, true); CityFrame frame = new CityFrame(vancouver); // Program the lightMover Robot to move the lights. lightMover.move(); int i = 0; loop1 : while (true) { if (lightMover.isBesideThing()) { lightMover.pickThing(); lightMover.move(); if (lightMover.isBesideThing()) { while (lightMover.isBesideThing()) { lightMover.putThing(); lightMover.pickThing(); lightMover.move(); if (lightMover.countThingsInBackpack() == 1 && lightMover.getAvenue() == 5) { lightMover.putThing(); break loop1; } } } else { lightMover.putThing(); if (lightMover.getAvenue() == 5) { break loop1; } lightMover.move(); } } else { if (lightMover.getAvenue() == 5) { break loop1; } if (lightMover.countThingsInBackpack() == 1) { lightMover.putThing(); } lightMover.move(); } } } }