Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Carlos Garcia
- Lesson 2 Evaluation 1
- Exponential Growth
- */
- {
- public static void main(String[] args) {
- World.setDelay(2);
- World.setVisible();
- World.setBeeperColor(Color.blue);
- World.setSize(50, 8);
- UrRobot zgod = new UrRobot(1, 1, North, -1);
- // loop to make time for the program to load
- for (int s=0; s<40; s++){
- zgod.turnLeft();
- }
- // outside loop runs 7 times total
- for (int i=1; i<=7; i++){
- // puts a beeper and moves as many times as i squared is
- for (int j=0; j<i*i; j++) {
- zgod.putBeeper();
- zgod.move();
- }
- zgod.turnLeft();
- zgod.turnLeft();
- // comes back down to street 1 (moves i squared times)
- for (int b=0; b<i*i; b++) {
- zgod.move();
- }
- // moves to the next avenue and faces back up
- zgod.turnLeft();
- zgod.move();
- zgod.turnLeft();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement