Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public class KarelProgram extends Karel {
  2.    
  3.     public void run() {
  4.         putInPosition();
  5.         turnLeft();
  6.         putInPosition();
  7.         turnRight();
  8.         makeFlower();
  9.         putInPosition();
  10.         makeFlower();
  11.         turnRight();
  12.         putInPosition();
  13.         turnLeft();
  14.     }
  15.    
  16.     private void makeFlower() {
  17.         putBall();
  18.         turnLeft();
  19.         moveAndPut();
  20.         turnRight();
  21.         moveAndPut();
  22.         turnRight();
  23.         moveAndPut();
  24.         turnLeft();
  25.     }
  26.    
  27.     private void putInPosition() {
  28.         move();
  29.         move();
  30.         move();
  31.     }
  32.    
  33.     private void moveAndPut() {
  34.         move();
  35.         putBall();
  36.     }
  37.    
  38.     private void turnRight() {
  39.         turnLeft();
  40.         turnLeft();
  41.         turnLeft();
  42.     }
  43.    
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement