Advertisement
KillianMills

Diamondfield.java

Nov 19th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. //one of the fist programs I wrote for robot world in college,2011. kept as a reminder
  2.  
  3. Public class Diamondfield
  4. {
  5.     Public static void main (String [] args)
  6.     {
  7.         World diamond = new World();
  8.         //Add Beepers to the field in a diamond shape
  9.         Field.addBeeper (6, 4);
  10.         Field.addBeeper (7, 5);
  11.         Field.addBeeper (8, 6);
  12.         Field.addBeeper (9, 7);
  13.         Field.addBeeper (5, 5);
  14.         Field.addBeeper (6, 6);
  15.         Field.addBeeper (7, 7);
  16.         Field.addBeeper (8, 8);
  17.         Field.addBeeper (4, 6);
  18.         Field.addBeeper (5, 7);
  19.         Field.addBeeper (6, 8);
  20.         Field.addBeeper (7, 9);
  21.         Field.addBeeper (3, 7);
  22.         Field.addBeeper (4, 8);
  23.         Field.addBeeper (5, 9);
  24.         Field.addBeeper (6, 10);
  25.        
  26.         //Add robot to the world
  27.         Robot steppy = new Robot();
  28.         diamond.add (steppy  2, 6, "east");
  29.  
  30.         //Collect Beepers
  31.  
  32.         steppy.turnLeft();
  33.         steppy.move();
  34.         steppy.turnRight();
  35.         steppy.move();
  36.         steppy,pickBeeper();
  37.         steppy.turnLeft();
  38.         steppy.move();
  39.         steppy.turnRight();
  40.         steppy.move();
  41.         steppy,pickBeeper();
  42.         steppy.turnLeft();
  43.         steppy.move();
  44.         steppy.turnRight();
  45.         steppy.move();
  46.         steppy,pickBeeper();
  47.         steppy.turnLeft();
  48.         steppy.move();
  49.         steppy,pickBeeper();
  50.         steppy.turnLeft();
  51.  
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement