Before moving right into the CCL commands, several basic and fundamental concepts
must be covered.
The Cybertank Command Language (CCL) was designed by OSI language engineers
to facilitate the creation of cybertank artificial intelligence (Al). The Cybertank
Command Language was modeled after the English language for maximum comprehension
and utilization.
There is usually more than one command that can be used to perform a given function.
The CCL designers created simple commands for common functions normally executed
using traditional programming structure. Take, for example, the need to turn your
cybertank to face in the direction of a scanned enemy. The traditional command structure
requires the use of “System Variables” as follows:
Turn Tank To EnemyX EnemyY
Noting the frequency that cybertank engineers utilized the above command, OSI
designers added the following command to the CCL to perform the same function:
Turn Tank To Face Enemy Tank
Obviously, this command is easier to understand.
All commands require a period of time to execute. Command execution time is
measured in cycles. There are two fundamental types of commands in the CCL:
- Action Commands that require physical or mechanical actions by the
cybertank, such as turning to face a new direction, and
- Logic Commands that do not have the cybertank perform physical or
mechanical actions. Logic commands execute in 1 cycle, while action commands
vary in execution time. Rotating the scanner, for example, requires less time
than turning the entire cybertank.
Always keep cycle counts in mind when designing your cybertank’s Al. For example,
a cybertank using 10 cycles in its firing intelligence fires twice as fast as one
with 20 cycles. Reducing cycle counts usually improves performance, It should also
be noted that the cycle counts given in this handbook are base figures. For example,
the command ROTATE SCANNER LEFT 1 takes 10 cycles to execute, but the command
ROTATE SCANNER LEFT 4 takes 40 cycles to execute (10 cycles per angle of
rotation times 4 angles.)
CCL commands, operators, and System Variables are “reserved” for specific purposes
and cannot be incorporated in user-defined variables. See Appendix 1 for a list
of Reserved Words.
The following conventions are used throughout this section for descriptive purposes:
| Convention |
Description |
| "Tank" |
For the sake of brevity, all CCL commands refer to
cybertanks as tanks. |
| [] |
Optional words in CCL commands are enclosed in square
brackets. Commands will execute correctly with or without the bracketed
words |
| "User Variable" |
This designates where a User Variable name is to
be used. |
| "Any Variable" |
This designates where either a User Variable name
or a System Variable name is to be used. |
| "#" |
This designates where a User Variable name, a System
Variable name, or a numeric digit is to be used. |
| "Label" |
This designates where a label name is to be used. |
| : (colon) |
This designates an alternative. For example [Branch
To : Do] indicates that either Branch To or Do can be
used. |
| cyc |
This designates a command’s cycle count. All initial
command definitions include their cycle count. |
| "X" |
This designates that an X-coordinate on the map is
to be used. |
| "Y" |
This designates that a Y-coordinate is to be used
on the map. |
Labels used to designate the beginning of an Al segment can be executed with
either the Do (Gosub) or Branch To (Goto) commands. A label may be composed of any
alphanumeric character or symbol, with a. 10 character maximum length. A label may
contain a reserved word. If, during the Authorization process (discussed in Part
2, Section 2.61, you receive an “Out of label memory space” error message, try shortening
the length of your labels. For a description of all possible Authorization errors,
see Appendix 5
System Variables are used by the CCL for internal operations. They can be used
in computations, but cannot be altered. System Variables are very useful, and Often
necessary, in designing cybertank Al. See Appendix 2 for a list of all of the System
Variables.
A User Variable is defined by the employee. Unlike System Variables, User Variables
can be altered, can be composed of any alphanumeric character or symbol, and can
be up to 15 characters in length. A User Variable name can Contain a reserved word,
but cannot consist of a reserved word alone. For example, “Turn” is a reserved word
while “MyTurn” is a legal User Variable name.
CCL supports the operators:
| “+” |
(addition) |
| “-” |
(subtraction) |
| “<” |
(less than) |
| “>” |
(greater than) |
| “=” |
(equals) |
| “<=” |
(less than or equal) |
| “>=” |
(greater than or equal) |
| “<>” |
(not equal) |
The operators are used as shown below.
| 1 cyc |
“User Variable” = “#” |
| 1 cyc |
“User Variable” = “Any Variable” + “#” |
| 1 cyc |
“User Variable” = “Any Variable” - “#” |
The above commands are called Assignment statements because the left side of
the "=" is “assigned” the value of the right side.
| 1 cyc |
If “Any Variable” = "#" Then [Branch To : Do] “Label” |
| 1 cyc |
If “Any Variable” = “Any Variable” + “#” Then [Branch To : Do] “Label” |
| 1 cyc |
If “Any Variable” = “Any Variable” - "#" Then [Branch To : Do] “Label” |
The above commands are called Conditional statements (or IF/THEN statements.)
These statements help control the flow of AI by checking various settings or conditions.
Note that anywhere the "=" Is used in the above Conditional examples, any of the
operators (“<”, “>”, “<=”, “>=”, “<>”) can be substituted.
Now for a few examples:
MyTurn = TankDir + 1
This sets the User Variable “MyTurn” to the System Variable "TankDir" plus one.
So, if "TankDir" is currently equal to three, then “Myturn” would be assigned the
value of four.
If Myturn >= 2 Then Branch to Done
This example causes the Al to branch to the label “Done” if and only if the
User Variable “MyTurn” is greater than or equal to two. Based upon the first example,
“Myturn” was set to four; therefore, the Al would indeed branch to the label ‘“Done.”
If Myturn = TankDir + 1 Then Branch to Done
This line causes the Al to branch to the label ‘“Done” if and only if the User
Variable “MyTurn” is equal to the System Variable "TankDir" plus one. So, the cybertank
logic unit retrieves the value of "TankDir" and adds one to it. It then compares
this value to “MyTurn.” If they are equal, then the branch is taken.
NOTE: Adding one to “TankDir” is only for purposes of comparison. The value
of “TankDir” does NOT change until an instruction is encountered which directs the
cybertank to turn
|