Usage: DefineGlobalInteger Name [ "=" Expression ] ";"
For much the same reasons that you would create an integer variable for exclusive use by a specific robot type, the DefineGlobalInteger instruction will create an integer variable for use in "execute" statements as well as robot instructions.
define { DefineGlobalInteger MinBeepers = 1; /* Creates a variable 'MinBeepers' for use within everything in the "execute" section. The initial value is set to 1. */ ... } execute { ... }
Usage: DefineMapSize Expression
The world of RoBOTL is laid out on a map of default size 20x20. This is a nice size for most things, but sometimes you require a different size to fit your needs. The optional DefineMapSize "define" Statement can help here.
Restrictions:Example:
define { DefineMapSize 25; // Makes a 25x25 Map ... } execute { ... }
Usage: NewRobotType Name "{" NewRobotType_Instructions "}"
By default, the only defined robot type is basic_bot, which has no defined functions, no non-default instructions, and no initial beepers. While using the basic_bot type is perfectly fine, you will usually want to make a new robot type with changes to the basic_bot design. This will allow you to create new robot instructions (such as a 'turnright' instruction), give a new robot a specified number of beepers to use, and other things which are not possible using the basic_bot robot type.
The first NewRobotType_Instruction MUST be the IsLikeA instruction. You can follow this with any other NewRobotType_Instructions that you wish. These are: DefineNewInstruction, DefineInitialBeepers, and DefineInteger.Usage: IsLikeA Name ";"
The IsLikeA instruction will declare that the robot type which is being defined is "like" the robot type given by Name. This declaration will cause the new robot type to "inherit" all of the other robot type's information (number of initial beepers, instructions, and integers.)
Example:
define { NewRobotType Pete_Bot { IsLikeA basic_bot; // Pete_Bot "inherits" the basic_bot information. DefineInteger count; // Pete_Bot has an integer variable called count now. } NewRobotType Theo_Bot { IsLikeA Pete_Bot; /* Theo_Bot "inherits" the Pete_Bot information, which means Theo_Bot now has an integer variable called count. */ DefineInteger count2; // Theo_Bot also has a integer variable count2 now. } ... } execute { ... }
Usage: DefineNewInstruction Name "as" Instructions
The default "basic_bot" robot doesn't have a lot of built-in instructions. Sometimes you'll want to build a new instruction from the instructions that are currently defined. The new instruction that is most typically defined using the DefineNewInstruction instruction is 'turnright', which will make the robot turn 90° to the right.
Example:
define { NewRobotType Pete_Bot { IsLikeA basic_bot; DefineNewInstruction turnright as { // Turning right is lots of fun. iterate 3 times turnleft; } } ... } execute { ... }
Usage: DefineInitialBeepers Expression ";"
By default, robots have no beepers in their beeper bag. If you would like to give a robot type some beepers to start with, the DefineInitialBeepers instruction will do what you want.
define { NewRobotType Pete_Bot { IsLikeA basic_bot; DefineInitialBeepers 5; // Give all Pete_Bot type robots 5 beepers to start with. } ... } execute { ... }
Usage: DefineInteger Name [ "=" Expression ] ";"
By default, robots have no integer variables of their own in which to store values. The DefineInteger instruction will create a variable for robots of the declared type to use. If the optional '"=" Expression' is in the instruction, the integer variable will be set to the specified initial value.
define { NewRobotType mrv_Bot { IsLikeA basic_bot; DefineInteger MaxBeepers; /* All robots of type mrv_Bot will be able to store values in MaxBeepers */ } ... } execute { ... }
Usage: WorldEntity Name "{" World_Entity_Instructions "}"
To make the map more exciting for your robots, you can use the WorldEntity statement to create a "world" for your robot to explore. This world has the same number of rows/columns that the map has, and can be placed on the map using the Place "execute" Statement. The World_Entity_Instructions are Beeper, Block, and Wall. (You can read more about them below.)
Usage: Beeper "at" Coordinates [ "=" Expression ] ";"
A beeper is simply an object which a robot can pick-up, carry, and put-down. Beepers are usually used to mark a square.
When defining beepers, the '"=" Expression' section is optional. You can use it to place more than one beeper on a square at a time.
Example:
define { WorldEntity Eden at 0,0 { Beeper at 1,1 = 5; // Place 5 beepers on the square 1,1. ... } execute { ... }
Usage: Block "at" Coordinates ";"
Blocks are objects which occupy an entire square, and do not allow any beepers or robots to be located within the same square. If a robot walks into a block, the robot is damaged, and turns off. You cannot turn the robot on again when it is damaged.
Usage: Wall "from" Coordinates Direction "for" Expression ";"
Walls are simply a collection of Blocks on the RoBOTL map, created starting from the given Coordinates, and laid out in the given Direction for a length given by Expression.