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
 
Printer Friendly Page

Sample Code: GraphThreads.java

package examples;
import becker.robots.*;

public class GraphMultiple extends Object
{  	 
   public static void main(String[] args)
   {
      GraphCity gc = new GraphCity(7, 1, 1, 10);
      gc.showThingCounts(true);
      ThreadedGraphBot karel = new ThreadedGraphBot(gc, 1, 1, Directions.EAST);
      ThreadedGraphBot hal = new ThreadedGraphBot(gc, 1, 3, Directions.EAST);
      ThreadedGraphBot sue = new ThreadedGraphBot(gc, 1, 5, Directions.EAST);
      CityFrame f = new CityFrame(gc, 12, 9);

      Thread sueThread = new Thread(sue);
      sueThread.start();

      Thread halThread = new Thread(hal);
      halThread.start();

      Thread karelThread = new Thread(karel);
      karelThread.start();
   }
}

Note: the source code for an applet is slightly different than for an application.



Contact: bwbecker@learningwithrobots.com.