What follows is an appendix of the command set available to the ghosts and Pacmen for the construction of their programs:
Commands that return direction values:
i = if, a conditional
"if" takes three arguments: a boolean and two directions. To evaluate an if, the parser first evaluates the boolean. If the boolean evaluates to true, the parser returns the value if the first of the direction arguments. Otherwise, the parser returns the value of the second direction argument.
The following are relative to the direction in which the ghost most recently moved:
F = Forward, the direction in which the ghost most recently moved
R = Right
L = Left
B = Backwards, the opposite of the direction in which the ghost most recently moved
The following four directions evaluate the same regardless of the direction the ghost last moved in:
N = North, up on the visual interface
S = South, down on the visual interface
E = East, right on the visual interface
W = West, left on the visual interface
o = drop pheromone, a ghost command that takes three arguments, the pheromone strength, which decreases by one every turn, the pheromone value, which remains constant, and the direction the ghost moves after dropping the pheromone.
Functions that return boolean values:
The ghosts and Pacmen possess the following mathematical comparison functions to utilize in their boolean statements:
=
<
>
{ (<=)
} (>=)
as well as the boolean modifiers:
! = not, takes one boolean arguments and reverses its value
| = or, takes two boolean arguments and returns true if either is true, otherwise returns false
& = and, takes two boolean arguments and returns true if both are true, otherwise returns false
Functions that return numbers:
Ghosts can use the following mathematical operations:
+
-
*
/
% = modular division of integers
In their strings they can use the following variables which are supplied by the environment:
C = consecutive moves in forward direction
S = the number of squares in the matrix
T = the number of game turns that have passed
Ghosts also have the following mathematical functions, which each take a single numerical argument:
s = sine
c = cosine
a = absolute value
r = round
The ghosts can call any of the following functions to return numerical values; many of them take a direction as an argument:
d = "dots-in-direction", the number of dots visible to the ghost in a given direction (takes an argument)
f = "squares-to-ghost", the number of squares between the ghost and the nearest other ghost in a given direction (takes an argument)
g = "ghosts-in-direction", the number of ghosts visible to the ghost in a given direction (takes an argument)
m = "squares-to-pacman", the number of squares between the ghost and the nearest pacman in a given direction (takes an argument)
p = "pacmen-in-direction", the number of pacmen visible to a ghost in a given direction (takes an argument)
P = "pheromone-strength", the strength of the pheromone on the square the ghost is on (doesn't take an argument, because ghosts cannot use pheromones unless they are on top of them)
t = "squares-to-dot", the number of squares between the ghost and the nearest dot in a given direction (takes an argument)
V = "pheromone-value", the value of the pheromone (doesn't take an argument, see P = pheromone strength)
w = "squares-to-wall", the number of squares between the ghost and the nearest wall in a given direction (takes an argument)
z = "squares-to-non-dot", the number of squares between the ghost and the nearest square that does not contain a dot (takes an argument)
The ghosts and Pacmen can also use floating point constants in their strings, which are always terminated by a semicolon (;).