class MyRobot


/**
 *  Title:  class MyRobot
 *  Description: Class to run a robot program having created a room.
 *  Copyright (c) 2004
 *  Organisation: UCL
 *  @author Graham Roberts 
 *  @version 1.2 10/04
 */
 

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


class MyRobot
{
  // Don't delete or modify.
  private Robot robot;
  private Room room;

  // This method contains the actual robot program.
  private void runRobotProgram()
  {
    // Put your statements to control the robot here.
    // To adjust the speed of the robot, uncomment the next line and
    // change the number.
    // robot.setSpeed(0.5);
    // An example program:
    while (robot.canMoveForward())
    {
      robot.forward();
    }
    robot.done();
  }


  // Method to initialise the room and robot.
  // Modify the statements to set up the conditions you need.
  private void setUp()
  {
    // This statement must be present. The room size can be
    // changed by modifying the parameters. (10,10) sets up
    // a 10x10 room, (50,25) sets up a 50x25 room.
    room = new Room(10,10);

    // This statement must be present. The door position
    // can be modified by changing the parameters.    
    room.setDoorPosition(Room.NORTH,3);

    // This statement must be present. The robot start
    // position and initial direction can be modified
    // by changing the parameters.
    robot = new Robot(5,7,Room.NORTH,room);

    // Statements to place obstacles or widgets should
    // follow here.
    // For example,
    // room.setWidget(3,4);
    // room.setObstacle(9,9);
  }
  

  private void createFrame()
  {
    // Do not modify or delete these statements
    RobotFrame frame = new RobotFrame("Robot Program",room);
    frame.pack();
    frame.setVisible(true);  
  }

  public void run()
  {
    // Do not modify or delete these statements
    setUp();
    createFrame();
    runRobotProgram();      
  }

  // This part of the program sets everything up
  // and displays the drawing window.
  public static void main(String[] args)
  {
    // Do not modify or delete these statements
    MyRobot program = new MyRobot();
    program.run();
  }
}