Picture of Cover

         
Home
Textbook
Software
Robot Examples
Pick3
GraphOne
GraphMultiple
GraphThreads
Checkers
Robots Documentation
Demos of becker.xtras
Java Documentation
Downloads
Installation
Favorite Tools
Change Log
Instructors
 
Printer Friendly Page

Sample Code: Pick3.java

package 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.