Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Activity2;
- import kareltherobot.*;
- public class Activity2Main implements Directions{
- public static void main(String[] args) {
- World.setVisible();
- World.setDelay(2); //low delay because of the large amount of beepers
- UrRobot johnny = new UrRobot(5,1, East,1000);
- for(int temp = 0; temp < 20; temp++){ //spins in place to give the program time to load
- johnny.turnLeft();
- }
- for(int out = 0; out < 10; out++){ //loop runs inner loop 10 times and moves forward each time
- for(int in = 0; in < 100; in++){ //loop puts 100 beepers
- johnny.putBeeper();
- }
- johnny.move();
- }
- johnny.turnLeft(); //moves so we can see beepers
- johnny.move();
- johnny.turnLeft();
- for(int i = 0; i < 10; i++){ //robot moves back to the left of the map
- johnny.move();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement