Advertisement
yangjason69

HarvestAdvancedTester

Mar 26th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1.  
  2. import kareltherobot.*;
  3. import java.awt.Color;
  4.  
  5. /**
  6.  * Write a concise summary of class HarvestAdvancedTester here.
  7.  *
  8.  * @author  Jason Yang
  9.  *
  10.  * @version 2/11/2017
  11.  */
  12. public class HarvestAdvancedTester 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-3.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.         HarvestAdvanced karel = new HarvestAdvanced(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.run();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement