Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Carlos Garcia
- Lesson 2 Activity 3
- Running laps
- */
- {
- public static void main(String[] args) {
- World.setDelay(10);
- World.setVisible();
- World.setBeeperColor(Color.blue);
- World.readWorld("Lesson2World1.kwld");
- UrRobot zgod = new UrRobot(5, 3, North, -1);
- // making robot face right
- zgod.turnLeft();
- zgod.turnLeft();
- zgod.turnLeft();
- // loop that goes half the rectangle. Runs 10 times in order to do 5 full laps
- for (int i=0; i<10; i++){
- zgod.putBeeper();
- zgod.move();
- zgod.move();
- zgod.move();
- zgod.move();
- zgod.putBeeper();
- zgod.turnLeft();
- zgod.move();
- zgod.move();
- zgod.turnLeft();
- }
- // final move to face right direction at the end
- zgod.move();
- zgod.turnLeft();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement