Exemple #1
0
 public static void main(String[] args) {
   World.setVisible(true); // makes world visible
   World.setDelay(10); // speed of world is 10
   UrRobot karel = new UrRobot(1, 1, East, 0); // new robot named karel
   UrRobot sarah = new UrRobot(3, 2, East, 0);
   squareDance(sarah);
   squareDance(karel);
   sarah.turnOff();
   karel.turnOff();
 }
 public static void main(String[] args) {
   World.setSize(10, 22);
   World.setVisible(true);
   World.setDelay(0);
   MessageScribe sophia = new MessageScribe(5, 1, East, infinity);
   MessageScribe matthew = new MessageScribe(2, 1, East, infinity);
   MessageScribe josh = new MessageScribe(3, 1, East, infinity);
   MessageScribe mark = new MessageScribe(4, 1, East, infinity);
   MessageScribe john = new MessageScribe(1, 1, East, infinity);
   sophia.scribeOne();
   matthew.scribeTwo();
   josh.scribeThree();
   mark.scribeFour();
   john.scribeFive();
 }
 static { // The World
   kareltherobot.World.setSize(15, 15);
   kareltherobot.World.setDelay(-5);
   kareltherobot.World.setBeeperColor(Color.blue.darker());
   kareltherobot.World.setStreetColor(Color.blue);
   kareltherobot.World.setNeutroniumColor(Color.green.darker());
   kareltherobot.World.setVisible(true);
 }
  /*
   * Modify this to manipulate the World.
   */
  static {
    kareltherobot.World.setSize(100, 100);
    kareltherobot.World.setDelay(1);
    kareltherobot.World.setBeeperColor(Color.magenta);
    kareltherobot.World.setStreetColor(Color.blue);
    kareltherobot.World.setNeutroniumColor(Color.green.darker());

    // kareltherobot.World.readWorld("folder", "worldfile");
    // kareltherobot.World.showSpeedControl(true);
    // See the JavaDocs for class World for more options

    kareltherobot.World.setVisible(true);
  }
  /*
   * Modify this to manipulate the World.
   */
  static {
    kareltherobot.World.setSize(12, 12);
    kareltherobot.World.setDelay(50);
    kareltherobot.World.setBeeperColor(Color.magenta);
    kareltherobot.World.setStreetColor(Color.blue);
    kareltherobot.World.setNeutroniumColor(Color.green.darker());

    for (int i = 1; i < 10; i++) {
      kareltherobot.World.placeNSWall(1, (int) (Math.random() * 8 + 1), (int) (Math.random() * 4));
    }

    // kareltherobot.World.readWorld("folder", "worldfile");
    // kareltherobot.World.showSpeedControl(true);
    // See the JavaDocs for class World for more options

    kareltherobot.World.setVisible(true);
  }