Advertisement
GARC923

L4A4

Oct 30th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /**
  2. Carlos Garcoa
  3. Lesson 4 Activity 4
  4. Road Worker
  5. */
  6.  
  7. package Lesson4;
  8.  
  9. import kareltherobot.World;
  10.  
  11.  
  12. public class Activity4 extends EsperBot {
  13.     public Activity4(int street, int avenue, Direction direction, int beeperCount) {
  14.         super(street, avenue, direction, beeperCount);
  15.     }
  16.  
  17.  
  18.     public static void main(String[] args) {
  19.         World.setDelay(50);
  20.         World.setVisible();
  21.         World.setSize(10, 10);
  22.         World.showSpeedControl(true);
  23.         World.readWorld("Lesson4World3.kwld");
  24.  
  25.         Activity4 zgod = new Activity4(3, 1, North, -1);
  26.  
  27.         zgod.fixRoad();
  28.     }
  29.  
  30.     /**
  31.      * Fills the potholes
  32.      * @return void
  33.      * */
  34.     public void fixRoad() {
  35.         for (int i = 0; i < 10; i++) {
  36.             if (onPothole()) {
  37.                 fillPothole();
  38.                 walk();
  39.             }else{
  40.                 walk();
  41.             }
  42.         }
  43.     }
  44.  
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement