yangjason69

HarvestPresentTester

Mar 26th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1.  
  2. import kareltherobot.*;
  3. import java.awt.Color;
  4.  
  5. /**
  6.  * Harvests a row if the row is present.
  7.  *
  8.  * @author  Jason Yang
  9.  *
  10.  * @version 3/25/2017
  11.  */
  12. public class HarvestPresentTester implements Directions
  13. {
  14.     /**
  15.      * Creates and positions a robot.
  16.      *
  17.      * @param args arguments from the command line
  18.      */
  19.     public static void main(String [] args)
  20.     {    
  21.         World.reset();
  22.         //World.readWorld("C:/worldFilesDOS/fig3-2.kwld");  // use for PC
  23.         World.readWorld("/worldFilesDOS/fig5-1.kwld");    // use for MAC
  24.        
  25.         /* Sets up the GUI for the Karel world. */
  26.         World.setVisible(true);
  27.         World.setDelay(20);
  28.         World.setSize(10,10);
  29.         //World.showSpeedControl(true); // use setDelay method as above
  30.         WorldBuilder myBuilder = new WorldBuilder(false);
  31.        
  32.         /* Creates a robot */
  33.         HarvestPresent karel = new HarvestPresent(2, 2, East, 0);
  34.        
  35.         karel.setUserPause(true); //enables use of userPause
  36.         karel.userPause("start. Press [enter/return] to start");//pauses
  37.        
  38.         /* Calls the method(s)to be tested. */
  39.         karel.harvest();
  40.     }
  41. }
Add Comment
Please, Sign In to add comment