was designed and implemented at WPI.
Instantiated with new
State: position on grid, # beepers, ...
Send Message: tell
Methods: move, turnleft, putbeeper, pickbeeper, turnoff s
Initially, the RoBOTL world is empty.
We can create
one of its inhabitants (called a basic_bot) using:
and the following program:
execute
{
new basic_bot Eve;
}
Note that Eve has been placed in square (0,0)
and is facing East. Let's make one more basic_bot named
Adam, near Eve.
execute
{
new basic_bot Adam at 0,5;
new basic_bot Eve;
}
When basic_bot's like Eve or Adam
are created, they know
how to do a few things (these are their methods:)
To get it to perform any of these actions, you must send a message
using
Tell
Let's tell Eve to TurnLeft and Move 1 square
towards Adam :
execute
{
new basic_bot Adam at 0,5;
new basic_bot Eve;
tell Eve:
{
TurnLeft;
Move 1;
}
}
And we will have Adam TurnLeft and Move 1 square
away from Eve :
execute
{
new basic_bot Adam at 0,5;
new basic_bot Eve;
tell Eve:
{
TurnLeft;
Move 1;
}
tell Adam:
{
TurnLeft;
Move 1;
}
}
How do we
control the robots and their world?
execute
{
new basic_bot Eve;
new basic_bot Adam at 0,5;
tell Eve:
{
iterate 3 times
TurnLeft;
Move 1;
}
tell Adam:
{
TurnLeft;
Move 1;
}
}
Notice that Eve only TurnLeft's 3 times. If we want her
to both TurnLeft and Move 1 all 3 times, we'd have
to put braces,
{ }, around those 2 instructions:
execute
{
new basic_bot Adam;
new basic_bot Eve at 5,5;
tell Eve:
{
iterate 3 times
{
TurnLeft;
Move 1;
}
}
tell Adam:
{
TurnLeft;
Move 1;
}
}
If we are concerned that a Robot may run into the edge of the
world, we can test:
execute
{
new basic_bot Eve;
tell Eve:
{
iterate 3 times
{
TurnLeft;
if (FrontIsClear) Move 1;
}
}
}
More RoBOTL

Web References
Karel, the Robot,
RoBOTL's predecessor
Jim Meddick's
Robotman

Send questions and comments to: Karen Lemone