Van Helsing
Suppose we want to write a character who tries to be in the same room as the player. We will do this by testing every turn whether the character's location and the player's location are the same; if the answer is no, the character will look for a path to the player's location, then try to move along that path. (We will learn more about finding paths and giving characters instructions later.)
The result will be that if the player ever moves to another location, the character will automatically pursue him.
In the following condition, we could also have written "if the location of Count Dracula is not the location", because "location" by itself is always understood to be the player's location. But it seemed better for clarity to write it this way:
Test me with "z / z / n / w / e / u / z / d".
>(Testing.)
>[1] z
Time passes.
>[2] z
Time passes.
Count Dracula arrives from the north.
>[3] n
Immensely Enormous Entry Hall
Count Dracula arrives from the south.
>[4] w
Vast Dining Area
Count Dracula arrives from the east.
>[5] e
Immensely Enormous Entry Hall
Count Dracula arrives from the west.
>[6] u
Spooky Guano-filled Attic
Count Dracula arrives from below.
>[7] z
Time passes.
"Muhahaha," says Count Dracula.
>[8] d
Immensely Enormous Entry Hall
Count Dracula arrives from above.