OO-Concepts in RoBOTL

by Professor Lemone



RoBOTL is an Object-Oriented Language

How do we send a send a message to a robot?

What methods do basic-bot's know to begin with?

In OO, objects are instantiated. How are objects instantiated in RoBOTL?

Inheritance allows software to be reused. How is inheritance implemented in Robotl?


define
{
   NewRobotType human_bot
   {
     IsLikeA basic_bot;
   }
}
execute
{
new human_bot Eve;
new human_bot Adam at 5,5;
  tell Eve:
  {
    TurnLeft;
    Move 1;
  }
  tell Adam:
  {
    Move 1;
    TurnLeft;
  }
}

As well as inheriting methods, we can DefineInitialBeepers for the new robot type and even DefineNewInstructions for it.


define
{
   NewRobotType man_bot
   {
     IsLikeA basic_bot;
   }
   NewRobotType woman_bot
   {
     IsLikeA basic_bot;
   }
   NewRobotType boy_bot
   {
     IsLikeA man_bot;
     DefineInitialBeepers 5;
     DefineNewInstruction spin as
     {
       iterate 4 times TurnLeft;
     }
   }
} 
execute
{
new woman_bot Eve;
new man_bot Adam at 5,5;
  tell Eve:
  {
    TurnLeft;
    Move 1;
  }
  tell Adam:
  {
    Move 1;
    TurnLeft;
  }
new boy_bot Cain at 7,7; 
   tell Cain:
  {
	spin;
  }
}

So far, the Robot's world has been empty. We can define our own worlds:



define {
      WorldEntity Adamsville {
      Beeper at 0,0;
      Beeper at 0,19= 3;    
      Beeper at 19,19 = 2;
      Beeper at 19,0;
      }
}

execute{
      
      place Adamsville;
      new basic_bot Adam;
            
      tell Adam: {
            iterate 4 times {
            move 19;
            turnleft;
            pickbeeper;
            }
      }
}

Web References

RoBOTL Tutorial

RoBOTL Reference Guide

Walter Ching's awesome RoBOTL site

Jim Meddick's Robotman

Send questions and comments to: Karen Lemone

What do these buttons mean?