Direction modifiers
In ZZT-OOP, a direction modifier is a word that prefixes a direction to create a new direction. If you like, you may think of them (in math terms) as relations which take a given "input" direction and produce an "output." They are explained in detail below.
cw and ccw
cw and ccw are ZZT-OOP direction modifiers which modify the direction clockwise and counter-clockwise, respectively. For example, cw n
evaluates to e
, but ccw n
evaluates to w
.
opp
opp is a ZZT-OOP direction modifier which evaluates to the exact opposite of the given direction. For example, opp n
evaluates to s
.
rndp
rndp is a ZZT-OOP direction modifier which causes the object to choose a random direction perpendicular to the succeeding direction, rather than simply use the succeeding direction. For example, #move rndp e
causes the object to attempt to move one of two directions perpendicular to east, that is, randomly north or south. For more information, see rndp.
Combining Direction Modifiers
Multiple direction modifiers can be combined in a single line. Lines written this way will cause the object to treat each modifier as "modifying" the rest of the written direction, so that it is "evaluated" in pairs from right-to-left. As a concrete example, the following combination opp cw n
evaluates like this:
opp cw n
= opp (cw n)
= opp e
= w
And opp ccw rndne
would evaluate thusly:
opp ccw rndne
= opp (cw (randomly n or e))
= opp (randomly e or s)
= randomly w or n
ZZT-OOP | |
---|---|
Prefixes |
|
Messages | |
Directions | |
Flags | |
Commands |