Keywords



Command
Short cut
Example Description
PROGRAM PROGRAM ‘Robo_1’

  [ID .....]
  [EQUIPMENT .....]
  [VARIABLE .....]
  [PROCEDURE .....]
  [FUNCTION .....]

BEGIN
  contents of program
END
Required at the beginning of program. Name given in a single quotation mark (max. 16 characters w/o space)will appear in the robot’s status as the robot’s name.

Between the word PROGRAM and the word BEGIN, which denotes the beginning of program, there may appear:
- declaration of users identifier,
- declaration of additional equipment,
- declaration of global variables,
- declaration of procedures and functions used in program

ID_CODE
ID
ID_CODE ‘ZZXL1C2X’ Optional. May appear only after the PROGRAM definition:
Adds the user identifier to the program. All Robots with the same identifier is recognized as “friends”. Length 8 characters in a single quotation mark. May not contain space
EQIPMENT
ADD
EQUIPMENT
  MINE 11
  LASER 2
  ...............
  ...............
Optional. May appear after the PROGRAM, or ID_CODE commands. Denotes non-standard robot equipment. Following the keyword enter the type and quantity of equipment.
Entering less-than-standard qty causes reduction of the given equipment.
VARIABLES
VAR
VARIABLES
   COUNT  NUMERIC
   DIST_11  NUMERIC
   ..............................
Optional. Declaration of global variables (seen by both the main program and the subprograms). The keyword is followed by a list of variables and their types. Further details in the description of types.
PROCEDURE
PR
PROCEDURE SEEK
  [VARIABLES ............]

BEGIN
  program
END
Declaration of procedure/ function.

After the command PROCEDURE there should follow a unique name of a procedure. After the word FUNCTION, there should additionally follow a description of the type of the value returned.

Next, (before the word BEGIN) there may appear a declaration of local variables (seen only inside the current function / procedure). Next, there must appear a pair of commands BEGIN – END with the contents of subprogram in between.

Definitions of procedures and functions may appear in any sequence, but always after the declarations mentioned above, before the beginning of the main program and in sequence accounting for cross-calls. (Procedure being called must be declared before it is being called). Defining procedures and functions inside another procedure is not allowed.

In order for a function to return a value, inside it (at the end) the returned value must be assigned to a variable identical to the name of the function.
FUNCTION
FN
FUNCTION GETX  number
  [VARIABLES ............]


BEGIN
   program
   ......................
   GET_OBJECT = 0

END
BEGIN
END
  Pair of keywords always appearing together with the keywords PROGRAM, PROCEDURE, or FUNCTON. They describe the beginning and the end of the main program, procedure, or a function. They are necessary.

Equipment

Commands modifying the standard equipment of a robot – appear as a list of equipment with a quantity, always following the keyword EQUIPMENT. Executed only once when placing the robot on the arena (*). They are executed in the order they were entered into the program and are effective only if the quantity entered does not exceed the max value for the given piece of equipment – otherwise they are omitted. Max value “BO” means “unrestricted”. The only restriction in force is the maximum mass of the robot - 9500kG (Mass of the robot with standard equipment is 8500kG). Exceeding the maximum mass causes destruction of the robot after placing on the arena (landing). Entering less-than-standard quantity causes removal of equipment (if it is possible – it is not allowed to remove the standard power source) and “reclaiming” some mass to be used for other equipment.

Equipment
Alias
Weight
Quantity
min/stand/max
Description
MINE(*)
#M
10 0 / 0 / W* Mine. Laid with the command “MINE” – explodes when a robot enters the field where it was laid. Causes 20 damage points in the center of explosion and 5 points on the neighboring fields.
BOMB (*)
#B
30 0 / 0 / W* Bomb. Fired with the command “BOMB” onto the given coordinates. Causes 33 damage points in the center and 11 points on the neighboring fields.
SUPERBOMB (*)
#S
100 0 / 0 / W* Superbomb. Fired with the command “SUPERBOMB” onto the given coordinates. Causes 85 damage points in the center and 25 points on the neighboring fields.
(*) - resources are renewed to the max level together with the level of energy after collecting a power pack
REACTOR
#R
800 1 / 1 / W* Produces 10 energy units/cycle, later stored in an accumulator. Fitting every additional reactor increases production of energy by 10 units.
ACCUMULATOR
#A
400 1 / 1 / 3 Stores energy – capacity of a standard accumulator – 100 units. Every additional accumulator increases the total capacity by 50 units.
SHIELD
#SH
500 0 / 1 / 3 Shield. When activated it reduces damage by half. It uses, however, 4 units of energy per cycle. Each additional shield reduces damage by another half, i.e. two shields will reduce damage to 1/4, and three - to 1/8, rounding up the value to the closest lower integer. Energy consumption increases proportionally – i.e. doubles or triples.
LASER
#L
300 0 / 1 / 4 Laser. One shot uses 5 energy units and causes an increase of the robot’s temperature by 2 units. A hit causes 10 units of damage (only in the primary field). Fitting additional lasers increases the damage proportionally, but also causes higher energy consumption and increase of temperature.
COOLER
#C
300 0 / 0 / 4 Engaging it causes a decrease of temperature by additional 2 units per cycle and an increase of energy consumption by 2 units per cycle. Installing additional coolers increases the rate of cooling and energy consumption.

Variables types

They inform about the types of data stored in a variable (an integer, a floating point number, or text). Introduced only for compatibility with most of the “real” programming environments and for possible future development. For the time being, only one variable type is available:

NUMERIC NUM Integer value (–32767 do 32768).

Program commands

TIME – The program is running in cycles, lasting about one second. Information concerning production or consumption of energy and changes of other parameters caused by continuous processes (e.g. decrease of temperature) refers to that time unit. One cycle, however, is divided into 100 units and times of all events (also times of commands) are displayed in these units.

All commands, which do not cause mechanical actions of the robot, always last 1 unit – if they do not call functions calculating any values. For example, command: “IF distance < 10 @SKIP” – if “distance” is a variable, the command will be executed during one time unit. If, however, “distance” is a function, then the time of execution will increase by the time of execution of the commands inside the function (plus one unit for calling the function).

ENERGY – Some mechanical actions, apart from execution time, use some energy or equipment. If available energy is lower than required, the energy is used to zero, but the action is not performed. Using up all the energy causes resetting of the robot’s computer (see: RESET command).

Remarks: If a command requiring coordinates (e.g. STRZAL) is called with coordinates beyond the allowed range – the attempt to execute such an order will take the same amount of time as a correctly executed action, but the energy will not be used and there will be no other consequences apart from the time consumption. If, however, the command cannot be executed for other reasons (e.g. MOVE onto an occupied field), it will be executed (the robot will attempt to enter onto an occupied field), time and energy will be consumed, but there will be no physical consequences (i.e. the robot will not move).

command execution
time
energy
consumption
range description
WAIT
NOP
10     Wait – the robot does nothing for 10 time units.
RRIGHT
ROR
25 2   Turn right by 90 deg. On the SAND it lasts 2 times longer and consumes twice the energy.
RLEFT
ROL
25 2   Turn left by 90 deg. On the SAND it lasts 2 times longer and consumes twice the energy.
MOVE
MOV
50 4   Displacement (if possible) onto a field ahead, according to the direction the robot is facing. On the SAND it lasts 50% longer and consumes twice the energy.
JUMP
JMP
60 10   Displacement (if possible) by two fields ahead, according to the direction the robot is facing. Remark: if the target field is occupied by another robot, or there is a building or rocks on the field the robot is attempting to jump over, the effect will be the same as for a command exceeding the max range – the command will not be executed, but the time will be consumed without losing the energy.
RESET
RST
250     Causes unconditional interruption in the program, a pause of 250 time units (ca. 2.5 sec) and then resets the program - skipping the command to load the equipment. Remark: reset does not change the state of activated accessories (cooling, shields) – unless it is caused by total loss of energy. Does not zero the variables, but nullifies the pointer of interruptions.
SHIELD+
SH+
  4
(see descr.)
  Shield. An activated shield causes a constant use of energy of 4 units per cycle, but minimizes the damage when robot is hit by any kind of weapon. For further details see: “modifications of equipment”.
SHIELD-
SH-
      Deactivation of the shield(s).
COOLER+
CL+
  2
(see descr.)
  Cooling. Usage of the laser causes the robot’s temperature to rise. Without cooling the robot cools down at a rate of 1 unit per cycle. The cooling process may be boosted by additional coolers (if installed). It causes, however, a rise of energy consumption. The rate of cooling depends on the number of cooling devices installed. For further details see: “modifications of equipment”.
COOLER-
CL-
      Deactivation of cooling.
SHOT PX PY
SHT
20 5 20 A laser(s) shot (all lasers installed always shoot at once), onto entered coordinates. PX, PY – coordinates with origin on the field the robot is standing. Apart from energy use each shot causes a temperature rise of 2 units per each laser installed. A hit causes 10 damage points per each laser installed. Hitting an equipment pod causes its explosion. A hit with two lasers causes an explosion of a mine and destruction of bush, and a hit of three or more creates a hole in the ground. See: “damage points table”.
BOMB PX PY
BOM
50   40 Dropping a bomb onto entered coordinates. PX, PY – coordinates with origin on the field the robot is standing. Apart from 33 damage points on the target field, the bomb causes 11 damage points on the neighboring fields. In the epicenter it causes explosion of an equipment pod, or a mine, destruction of bush and creates a hole. On the neighboring fields it only causes explosion of the equipment pod. See: “damage points table”.
SUPERBOMB PX PY
SBOM
50   40 Dropping a superbomb onto entered coordinates. PX, PY – coordinates with origin on the field the robot is standing. Apart from 85 damage points on the target field, the bomb causes 25 damage points on the neighboring fields. In the epicenter it causes explosion of an equipment pod, or a mine, destruction of bush, creates a hole and destructs buildings. On the neighboring fields it causes explosion of the equipment pod or a mine and destruction of bush. See: “damage points table”.
ON_ATTACK NAME
POA
      Memorizes the name of procedure called when the robot is under attack (in case of a hit). After that command is executed and the procedure is activated by command ON_ATTACK+, in case of a hit, the program is interrupted and (unless a service of another, higher priority event is being executed) execution of the predefined procedure begins. After execution of the procedure, the previously interrupted program is resumed. Remark: in the moment of execution, a command ON_ATTACK-, which blocks repeated call of the procedure, is executed.
Priority 6.
ON_ATTACK+
POA+
      Activates the automatic attack response if procedure if it was previously defined.
ON_ATTACK-
POA-
      Blocks the attack response – deactivates the execution of pre-defined procedure.
ON_DAM_HIGH NAME
POU

ON_DAM_HIGH+
POU+
ON_DAM_HIGH-
POU-
      Commands handling excessive damage (above the critical level). A procedure defined by the command ON_DAM_HIGH (if activated by ON_DAM_HIGH+ and no higher priority procedure is being executed) is called when damage sustained by the robot reaches the critical level. This level is set by the command DAMAGE_ALERT. The default level is 80.
Priority 5.
ON_TEMP_HIGH NAME
POT

ON_TEMP_HIGH+
POT+
ON_TEMP_HIGH-
POT+
      Commands handling excessive temperature (above the critical level). A procedure defined by the command ON_TEMP_HIGH (if activated by ON_TEMP_HIGH+ and no higher priority procedure is being executed) is called when the robot’s temperature reaches the critical level. This level is set by the command TEMPER_ALERT. The default level is 80.
Priority 4.
ON_ENER_LOW NAME
POE

ON_ENER_LOW+
POE+
ON_ENER_LOW-
POE-
      Commands handling low energy (below the critical level). A procedure defined by the command ON_ENER_LOW (if activated by ON_ENER_LOW+ and no higher priority procedure is being executed) is called when robot’s energy reaches the critical level. This level is set by the command ENERGY_ALERT. The default level is 20.
Priority 3.
ON_REC_MESS NAME
POK

ON_REC_MESS+
POK+
ON_REC_MESS-
POK-
      Commands handling received radio communication. A procedure defined by the command ON_REC_MESS (if activated by ON_REC_MESS+ and no higher priority procedure is being executed) is called when a radio message is received.
Priority 2.
ON_TIMER NAME
PTI
SET_TIMER XX
UTI
      Commands handling the system clock. After entering with the command ON_TIMER the name of procedure to be executed after a specific time and entering with SET_TIMER a value XX ranging 1-32767, the timer counts down the number of cycles (seconds). When the countdown reaches zero, the procedure is activated. The countdown may be interrupted by entering 0 into the timer.
Priority 1.
DAMAGE ALERT VALUE
PAU
      Sets the critical damage level.
TEMPER_ALERT VALUE
PAT
      Sets the critical temperature.
ENERGY_ALERT VALUE
PAE
      Sets the critical energy level.
IF X ? Y @HERE
IF
      Condition – if variable X is: < <= = >= > < > than variable or number Y (i.e. if the condition is fulfilled) go to label @HERE). Remark: the first compared value must be a variable; the second may either be a variable (function), or a number. Comparing two numbers is illegal.
CALL_IF X ? Y NAME
CIF
      Condition – if variable X is: < <= = >= > <> than variable or number Y (i.e. if the condition is fulfilled) call the indicated procedure, Remark: the first compared value must be a variable; the second may either be a variable (function), or a number. Comparing two numbers is illegal.
GOTO @HERE
GO
      Go (unconditionally) to the label @HERE.
SCANFIELD X Y VAR
SCN
5   64 Quick scan of a field at coordinates X Y and storing the result into the variable. The possible results are:

result

object

description

0

void

scan out of the arena

1

wather

wather

2

stone

building or rock

3

metal

robot or equipment pod

4

plant

tree (but somethin' might be be under it...)

5

sand

desert

6

earth

just earth

TESTFIELD X Y VAR
TST
50   32 Thorough scan of a field at coordinates X Y and storing the result into the variable. The possible results are:
result

object

description

0

void

scan out of the arena

10

water

water

21

rocks

rocks

22

building

building

31

mine

mine

32

robot

robot in any situation except 33

33

robot

robot hidden in bush

34

pod

equipment pod

35

hole

hole caused by explosion of a bomb

40

tree

tree - nothing under it

50

sand

sand, nothing else

60

earth

earth, nothing else

IDENTIFYX Y VAR
RID
15   32 Identification of an object at coordinates X Y and storing the result into the variable. The variable has a value “1” if on the checked field there’s a robot with the same identifier (but not without an identifier!) or “0” otherwise.
SENDMESSAGE X1 X2 X3
SND
20     Sending a radio message to all friendly robots, consisting of three numbers stored in the variables: X1 X2 X3.
RECVMESSAGE Y1 Y2 Y3
REC
      Entering the content of last received radio message into the variables Y1 Y2 Y3. The message can also be read in system variables $KOM_B1, $KOM_B2, $KOM_B3.
AUTOREPAIR
ARP
50 5   Remowe one damage points.
GET_ENERGY X Y
GEN
50 -10 2 Negative energy usage means a rise of energy level, by energy received from another robot.
MINE
MI
50     Sets up a mine at coordinates (0 ,0) i.e. under the commanded robot. Possible only on EARTH (or in a bomb hole). The mine is armed when the robot, which has set it leaves the field. The mine does not identify friend or foe. Causes 20 damage points on the main field and 5 points on the neighboring fields. See: “damage points table”.

Arithmetic operations

Now, some words about the syntax of arithmetic operations. The arithmetic expressions interpreter WE is not a very advanced one (frankly speaking: it is ancient), it should be enough though, for a world with a maximum area of 128x128 units… Practice shows that such a “calculator” is more than enough for operations required on the “battlefield”. Calculations are executed in a traditional way: x = a + b, however, there are some major restrictions. Firstly – all components must be separated by space (including the parentheses) and have to fit into one line. E.g. expression x=(a+b)*c won’t be interpreted! The correct syntax is: ( a + b ) * c. Secondly – the interpreter does not identify the correct sequence of operations (!!!). It executes them in sequence from left to right only obeying parentheses. There can be several levels of parentheses, just bear in mind they also have to be separated by space. Apart from variables, functions can also be used in arithmetic expressions. You have to remember though, that unlike a simple arithmetic expression, which is executed in one cycle, the function called in an arithmetic expression is executed with its normal tempo. Thirdly – the only available numbers are integers with range +-32767. There are only four basic operations available. Overflow is not indicated in any way, the counter just goes through zero, creating a “strange” number. However, the maximum range is much higher then the values of executed operations, so the overflow should be no factor. Division skips the decimal part of a result – it does not round it up and just skips it instead. Additionally, the divisor can only be of type “shortint” (1 byte – i.e. range +-128). Similarly, the multiplied and the multiplier must be of 1 byte range (operations are executed by assembler commands: SUB, ADD, MUL, DIV – the interested should consult appropriate literature)

System variables

Read-only. They always start with a “$” sign, which is reserved for those variables. They can be used in the program like other global variables. However, they can’t be modified.

$MINE_Q Actual quantity of mines.
$BOMB_Q Actual quantity of bombs.
$SBOM_Q Actual quantity of superbombs.
$ENER_L Actual energy.
$DAMG_L Actual damage level.
$TEMP_L Actual temperature of the robot.
$X_GRID, $Y_GRID Map coordinates.
$DIRECT Direction the robot is facing: 0-1-2-3 means: N-E-S-W.
$ERROR Number of last error.
$INT_LV Actually executed interruption.
$REC_B1, $REC_B2, $REC_B3 First, second and third byte of a received radio message.
$STACK Stack depth - max 128 bytes.


Map legend

Earth- basic floor
Sand - slows the robot down - see: description of commands
Water - entering = 100% damage
Tree - you can hide under it
Building - you can't enter, but you can destrou it
Rock - indestructible
Mine - beware :)
Pod - replenishes the energy and equipment to max.!

Damage points table

The power of weapons and strength of static objects on the map. The table illustrates the interactions between robots and other map objects – shows which objects are destroyed by which weapon.

MAP OBJECTS PodMineTreeHoleBuilding
CRITICAL DAMAGE 5 15 25 33 66
DAMAGE POINTS
Laser 10 X - - - -
Laser x 2 20 X X - - -
Laser x 3 30 X X X - -
Laser x 4 40 X X X X -
Mine 20 - - - - -
Mine - neighboring field 5 X - - - -
Bomb 33 X X X X -
Bomb - neighboring field 11 X - - - -
SuperBomb 85 X X X X X
SuperBomb - neighboing field 25 X X X - -
Pod explosion - neighboring field 25 X X X - -
Robot explosion - neighboring field 10 X - - - -