
/**
 * Modified version of Project 1 option 2 for CS112 - showing how a
 * relay race for three robots demonstrates the need for the do..while
 * 
 * @author Russell C. Bjork 
 * @version March 11, 2008
 */
import kareltherobot.*;

public class Project1Modified implements Runnable, Directions
{
    /** Main method - set up the world and start the program
     */
    public static void main(String [] args)
    { 
        World.readWorld("RelayRace.world");
        World.setVisible(true);
        World.setupThread(new Project1Modified());
        World.setTrace(false);
        World.showSpeedControl(true);
    }
    
    /** Method that describes the task to be performed.
     */  
    public void run()
    {
		RacerRobot karel = new RelayRobot(1, 1, East, 1);
		RacerRobot doofus = new RelayRobot(1, 3, East, 0);
        RacerRobot zelda = new RacerRobot(1, 5, East, 0);

       	karel.runRace(); 
       	karel.putBeeper(); 
       	karel.turnOff();
       	
       	doofus.pickBeeper();
        doofus.runRace(); 
        doofus.putBeeper();
        doofus.turnOff();

		zelda.pickBeeper();
		zelda.runRace();
		zelda.turnOff();
    }
    
}