Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Activity3;
- import kareltherobot.*;
- public class Activity3Main implements Directions{
- public static void main(String[] args) {
- World.readWorld("Lesson2World.kwld");
- World.setVisible();
- World.setDelay(25);
- UrRobot trevor = new UrRobot(5,3, North,20);
- for(int x = 0; x < 7; x++){
- trevor.turnLeft();
- }
- for(int out = 0; out < 10; out++){ //runs 10 times, total of 5 laps
- for (int length = 0; length < 4; length++){ //runs code for the long section of structure
- trevor.move();
- }
- trevor.turnLeft(); //the robot puts beeper and turns to get ready for the next section
- trevor.putBeeper();
- for (int width = 0; width < 2; width++){ //runs code for short section of structure
- trevor.move();
- }
- trevor.turnLeft(); //the robot puts beeper and turns to get ready for the next section
- trevor.putBeeper();
- }
- trevor.move(); //robot moves out of the way to reveal beepers
- trevor.turnLeft();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement