Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //(C) A+ Computer Science
- // Christian Moss
- // FencedIn
- // August 31st, 2015
- // Get on my lvl, Moss City
- // ultimate skill
- method main()
- {
- Jeroo Man = new Jeroo();
- //initial while loop
- //while jeroo doesn't have flower
- while (!Man.hasFlower())
- {
- if (Man.isFlower(AHEAD))
- {
- Man.hop();
- Man.pick();
- }
- //if there isn't a flower in front;
- else
- {
- Man.hop();
- if (!Man.isClear(AHEAD))
- {
- if (Man.isFacing(SOUTH))
- {
- //TO PREVENT TURNING IN A CIRCLE
- Man.turn(LEFT);
- }
- else
- {
- Man.turn(RIGHT);
- }
- }
- }
- }
- //this block of code should be reached
- //after the while loop is completed;
- //NO WORRIES!!
- Man.turn(RIGHT);
- Man.hop();
- Man.toss();
- //i think tossing the flower on a trap
- //cancels it
- Man.hop(5);
- //goal reached +10 points skill
- }
- //end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement