The hebrew University, The Institute of CS 

Basic Robot Project

Author: Itai Yarom


How to run it?

This is the robot simulate applet:
If it isn't running (now applet above), you can run it by typing: appletviewer RobotSim.htm
 

How it works?

The program simulate a user program running. To run a user program, Enter it's name and press run. You can press on Running Options, to control on the running: go back to the first step, go back one step (<<<),go forward one step (>>>) or to continune the running. Here there is three simples user programs: FirstProgram, SecondProgram and Third Program.

Creating your own program

To create your own program, let's say userProgram, you should do:

The robot interface

The BasicRobot interface, means the command you can give to the robot object, are:

In the user program there is a world object called myWorld. The user can ask the world those questions:

How it loads the user program

Let's say we have a user program look like this:

public class UserProgram extends RobotProgram {
    public void main(String[] args) {
        BasicRobot lisa = new BasicRobot(2,3,4,"East",this);
        lisa.turnLeft();
        lisa.turnLeft();
        lisa.goForward();
        BasicRobot joe = new BasicRobot(3,4,1,"West",this);
        joe.goForward();
        joe.turnLeft();
        joe.goForward();
        lisa.turnLeft();
        lisa.goForward();
        lisa.goForward();
    }
}

When you run the Robot.class (by running RobotSim.htm), and pressing the run button, when the the program file is UserProgram, it does the following:

  1. It send the request to the dynamicLoaderThrad, to load the program.
  2. The dynamicLoaderThrad takes the fileName string and make it a RobotProgram class.
  3. makes a RobotProgram object.
  4. runs it main method.
  5. When a BasicRobot object has been created, as a process of the RobotProgram running, it turn the RobotProgram to be an observer of the BasicRobot object.
  6. For every action that the BasicRobot done, it inform the RobotProgram who calling the repaint action of the Robot.

The project objects

Some notes


last updated at 29.10.98

return to itai's home page.