SHARE
TWEET

Untitled

a guest Sep 20th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import javakara.JavaKaraProgram;
  2.        
  3. /* BEFEHLE:  kara.
  4.  *   move()  turnRight()  turnLeft()
  5.  *   putLeaf()  removeLeaf()
  6.  *
  7.  * SENSOREN: kara.
  8.  *   treeFront()  treeLeft()  treeRight()
  9.  *   mushroomFront()  onLeaf()
  10.  */
  11. public class BaumBeschauung2 extends JavaKaraProgram {
  12.  
  13.   // hier können Sie eigene Methoden definieren
  14.  
  15.   public void myProgram() {
  16.     // hier kommt das Hauptprogramm hin, zB:
  17.     while (true) {
  18.         if (kara.onLeaf()) {
  19.             kara.removeLeaf();
  20.             break;
  21.         } else if (kara.treeFront()) {
  22.             kara.turnLeft();
  23.             kara.move();
  24.             kara.turnRight();
  25.             kara.move();
  26.             kara.move();
  27.             if (kara.treeRight()) {
  28.                 kara.move();
  29.                 kara.turnRight();
  30.                 kara.move();
  31.                 kara.turnLeft();
  32.                 } else {
  33.                     kara.turnRight();
  34.                     kara.move();
  35.                     kara.turnLeft();
  36.                     }
  37.             } else {
  38.                 kara.move();
  39.                 }
  40.     }
  41.   }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top