Random directions

From Wiki of ZZT
Revision as of 01:40, 7 February 2021 by KKairos (talk | contribs) (created page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are three random directions in ZZT-OOP: rndns, rndne, and rnd, and one random direction modifier: rndp. They are explained in detail below. rndns, rndne, and rnd are all valid directions usable with direction modifiers

rndns

rndns is a ZZT-OOP direction which causes the object to choose randomly from its north or south during play.

Example: /rndns will cause the object to randomly move north or south.

rndne

rndne is a ZZT-OOP direction which causes the object to choose randomly from its north or east during play.

Example: #if blocked ne #send label will cause the object to check whether it is blocked randomly to the north or to the east, and it will #send itself to the label :label if it is blocked.

rnd

rnd is a ZZT-OOP direction which causes the object to choose randomly from its north, south, east, or west during play.

Despite having all four directions in its possibility space, the possibilities are not even. East and west are chosen at 1/3 probability each, and north and south only occur at 1/6 probability each.

Example: #put rnd white boulder will cause the object to attempt to put a white boulder on the tile randomly north, south, east, or west of itself, with east and west being twice as likely as north and south.

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.

Examples:

#move rndp e causes the object to attempt to move one of two directions perpendicular to east, that is, randomly north or south. #move rndp rndne causes the object to attempt to move one of two directions perpendicular to a direction randomly chosen from north or east, that is, randomly north, south, east, or west, with equal probability of each direction being chosen.