Advertisement
GARC923

Untitled

Sep 13th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. /*
  2. Carlos Garcia
  3. Lesson 2 Evaluation 1
  4. Exponential Growth
  5. */
  6.  
  7. {
  8.  
  9.     public static void main(String[] args) {
  10.         World.setDelay(2);
  11.         World.setVisible();
  12.         World.setBeeperColor(Color.blue);
  13.         World.setSize(50, 8);
  14.  
  15.         UrRobot zgod = new UrRobot(1, 1, North, -1);
  16.  
  17.         // loop to make time for the program to load
  18.         for (int s=0; s<40; s++){
  19.             zgod.turnLeft();
  20.         }
  21.  
  22.         // outside loop runs 7 times total
  23.         for (int i=1; i<=7; i++){
  24.  
  25.             // puts a beeper and moves as many times as i squared is
  26.             for (int j=0; j<i*i; j++) {
  27.                 zgod.putBeeper();
  28.                 zgod.move();
  29.             }
  30.             zgod.turnLeft();
  31.             zgod.turnLeft();
  32.  
  33.             // comes back down to street 1 (moves i squared times)
  34.             for (int b=0; b<i*i; b++) {
  35.                 zgod.move();
  36.             }
  37.  
  38.             // moves to the next avenue and faces back up
  39.             zgod.turnLeft();
  40.             zgod.move();
  41.             zgod.turnLeft();
  42.         }
  43.  
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement