|
Sample Code: ThreadedGraphBot.java
package examples;
import becker.robots.*;
/** Extend the GraphBot class to create a new kind of robot that will
make a graph while executing in a thread, allowing other robots to
work "simultaneously". */
public class ThreadedGraphBot extends GraphBot implements Runnable
{
/** Construct a new threaded graphing robot. */
public ThreadedGraphBot(City aCity, int anAvenue, int aStreet, int aDirection)
{ super(aCity, anAvenue, aStreet, aDirection);
}
public void run()
{ this.makeGraph();
}
} Contact: bwbecker@learningwithrobots.com. |