![]() |
Sample Code: Pick3.javapackage examples; import becker.robots.*; public class Pick3 extends Object { public static void main(String[] args) { // Declare the objects needed City newYork = new City(); newYork.showThingCounts(true); Robot hal = new Robot(newYork, 1, 2, Directions.EAST); Thing t1 = new Thing(newYork, 2, 2); Thing t2 = new Thing(newYork, 3, 2); Thing t3 = new Thing(newYork, 4, 2); CityFrame f = new CityFrame(newYork, 4, 7); hal.move(); hal.pickThing(); hal.move(); hal.pickThing(); hal.move(); hal.pickThing(); hal.move(); hal.putThing(); hal.putThing(); hal.putThing(); hal.move(); } } Note: the source code for an applet is slightly different than for an application. Contact: bwbecker@learningwithrobots.com. |