Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Lesson2;
- import kareltherobot.*;
- public class Activity2Main implements Directions {
- public static void main(String[] args) {
- World.setDelay(2);
- World.setVisible();
- //Declares Robot object
- UrRobot gary = new UrRobot(1, 1, East, -1);
- //For loop that runs 9 times so the robot move 9 times and sets 9 stacks of beepers
- for(int i =0; i<9;i++){
- //For loop that sets 1000 beepers
- for(int j= 0; j<1000; j++){
- gary.putBeeper();
- }
- gary.move();
- }
- //Sets the 10th set of 1000 beepers
- for(int j= 0; j<1000; j++){
- gary.putBeeper();
- }
- //Turns robot and moves it facing north
- gary.turnLeft();
- gary.move();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement