Advertisement
GARC923

L4A1

Oct 21st, 2022
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. package Lesson4;
  2.  
  3. import kareltherobot.Robot;
  4. import kareltherobot.World;
  5.  
  6.  
  7. public class Activity1 extends EsperBot {
  8.     public Activity1(int street, int avenue, Direction direction, int beeperCount) {
  9.         super(street, avenue, direction, beeperCount);
  10.     }
  11.  
  12.  
  13.     public static void main(String[] args) {
  14.         World.setDelay(50);
  15.         World.setVisible();
  16.         World.setSize(10, 10);
  17.         World.showSpeedControl(true);
  18.         World.readWorld("Lesson4World1.kwld");
  19.  
  20.         Lesson4.Activity1 zgod = new Lesson4.Activity1(1, 3, North, -1);
  21.  
  22.         // calls the move method if the left is not clear. Otherwise, it backflips.Activity1
  23.         if (!zgod.leftIsClear()){
  24.             zgod.move();
  25.             zgod.move();
  26.             zgod.move();
  27.             zgod.move();
  28.         } else {
  29.             zgod.turnLeft();
  30.             zgod.turnLeft();
  31.         }
  32.     }
  33.  
  34.  
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement