Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //one of the fist programs I wrote for robot world in college,2011. kept as a reminder
- Public class Diamondfield
- {
- Public static void main (String [] args)
- {
- World diamond = new World();
- //Add Beepers to the field in a diamond shape
- Field.addBeeper (6, 4);
- Field.addBeeper (7, 5);
- Field.addBeeper (8, 6);
- Field.addBeeper (9, 7);
- Field.addBeeper (5, 5);
- Field.addBeeper (6, 6);
- Field.addBeeper (7, 7);
- Field.addBeeper (8, 8);
- Field.addBeeper (4, 6);
- Field.addBeeper (5, 7);
- Field.addBeeper (6, 8);
- Field.addBeeper (7, 9);
- Field.addBeeper (3, 7);
- Field.addBeeper (4, 8);
- Field.addBeeper (5, 9);
- Field.addBeeper (6, 10);
- //Add robot to the world
- Robot steppy = new Robot();
- diamond.add (steppy 2, 6, "east");
- //Collect Beepers
- steppy.turnLeft();
- steppy.move();
- steppy.turnRight();
- steppy.move();
- steppy,pickBeeper();
- steppy.turnLeft();
- steppy.move();
- steppy.turnRight();
- steppy.move();
- steppy,pickBeeper();
- steppy.turnLeft();
- steppy.move();
- steppy.turnRight();
- steppy.move();
- steppy,pickBeeper();
- steppy.turnLeft();
- steppy.move();
- steppy,pickBeeper();
- steppy.turnLeft();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement