RoBOTL Expressions

An expression is typically made up of operators, variables, integer functions, and boolean functions.


Operators

Operators are used to perform mathematical calculations. For instance, '3 + 4' is made up of the number 3 and 4, and the operator '+' meaning addition.

Valid Operators in RoBOTL (from lowest to highest order of precedence):

Operator TypeOperatorExample(s)
Boolean OR||, orvariable1 || variable1
Boolean AND&&, andvariable1 and variable2
Relation!=, ==1 != 2
Less-than/Greater-than<, >, <=,>=3 > 2
Additional+, -3 + 2
Multiplicitive*, /8 / 4
Not and Signnot, !, +, --2


Variables

In RoBOTL, Variables are names of locations in which you can store an integer value. Variable names must follow the rules for Names.

Variables occur in both "execute" statements and robot instructions (also called global variables), or in just robot instructions (also called local variables.)

Variables can be used only after being created. You can use the following commands to create a variable for use:

Unless given an initial value using one of the above methods, the integer variable will be set by default to a value of 0.


Integer Functions

Integer Functions will return an integer value corresponding to the function.

Function NameDescriptionWhere Available
BeepersInBagReturns the number of beepers that the robot has in its beeper bag.robot instructions
BeepersOnFloorReturns the number of beepers on the floor in the square the robot is occupying.robot instructions
XPositionReturns the current X Position of the robot.robot instructions
YPositionReturns the current Y Position of the robot.robot instructions
MapSizeReturns the order (# of columns/rows) of the current map.global


Boolean Functions

Boolean Functions will return a true (1) or false (0) value corresponding to the function. Boolean Functions are only valid when used within a robot instruction.

Function NameDescription
FrontIsClear/LeftIsClear/RightIsClearReturns false if there is an obsticle (robot or wall) in front/to the left/to the right of the robot.
FacingNorth/FacingSouth/FacingEast/FacingWestReturns true if the robot is facing the declared direction.


This guide is not great to look at under text-only browsers. Sorry. Since you need a graphical browser for the applet, we figured you'd be using it for the reference guide.

Document Last Revised: Tuesday December 16th, 1997 at 2:00am
Copyright ©1997 Worcester Polytechnic Institute
Page Written by: Theo Van Dinter (felicity@kluge.net)