Advertisement
Guest User

For Jonathan

a guest
Aug 31st, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. //(C) A+ Computer Science
  2. // Christian Moss
  3. // FencedIn
  4. // August 31st, 2015
  5.  
  6. // Get on my lvl, Moss City
  7. // ultimate skill
  8.  
  9. method main()
  10. {
  11.   Jeroo Man = new Jeroo();
  12.  
  13.   //initial while loop
  14.   //while jeroo doesn't have flower
  15.   while (!Man.hasFlower())
  16.   {
  17.      
  18.      if (Man.isFlower(AHEAD))
  19.      {
  20.         Man.hop();
  21.         Man.pick();
  22.      }
  23.      //if there isn't a flower in front;
  24.      else
  25.      {
  26.         Man.hop();
  27.        
  28.         if (!Man.isClear(AHEAD))
  29.         {
  30.            if (Man.isFacing(SOUTH))
  31.            {
  32.               //TO PREVENT TURNING IN A CIRCLE
  33.               Man.turn(LEFT);
  34.            }
  35.            else
  36.            {
  37.               Man.turn(RIGHT);
  38.            }
  39.         }
  40.      }
  41.   }
  42.  
  43.   //this block of code should be reached
  44.   //after the while loop is completed;
  45.  
  46.   //NO WORRIES!!
  47.  
  48.   Man.turn(RIGHT);
  49.   Man.hop();
  50.   Man.toss();
  51.  
  52.   //i think tossing the flower on a trap
  53.   //cancels it
  54.  
  55.   Man.hop(5);
  56.   //goal reached +10 points skill
  57. }
  58.  
  59. //end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement