Advertisement
mmayoub

School, Turtle example 1, 15.10.2017

Oct 15th, 2017
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. Turtle example 1
  2. ----------------
  3. import unit4.turtleLib.Turtle;
  4.  
  5. public class Hw1 {
  6.     static Turtle t = new Turtle();
  7.  
  8.     public static void main(String[] args) {
  9.  
  10.         t.tailDown();
  11.  
  12.         t.setDelay(100);
  13.  
  14.         mostatil(150, 65);
  15.  
  16.         t.moveForward(65);
  17.         t.turnLeft(90);
  18.         t.moveForward(50);
  19.         t.turnRight(90);
  20.  
  21.         mostatil(50, 100);
  22.  
  23.         t.tailUp();
  24.         t.moveBackward(150);
  25.  
  26.         t.tailDown();
  27.         moraba3(60);
  28.  
  29.     }
  30.  
  31.     public static void mostatil(double width, double height) {
  32.         for (int i = 0; i < 2; i += 1) {
  33.             t.moveForward(height);
  34.             t.turnLeft(90);
  35.             t.moveForward(width);
  36.             t.turnLeft(90);
  37.         }
  38.     }
  39.  
  40.     public static void moraba3(double x) {
  41.         mostatil(x, x);
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement