Section 4 - Going Back and Going Vaguely
Understand "go back" as retreating. Understand "back" or "return" or "retreat" as retreating.
The former direction is a direction that varies.
Carry out going: change the former direction to the noun.
Retreating is an action applying to nothing.
Carry out retreating:
let new direction be the opposite of the former direction;
say "(heading [new direction])[line break]";
try going the new direction.
Understand "leave [any room]" or "go outside [any room]" as departing. Departing is an action applying to one thing.
Check departing: if the noun is not the location, say "You aren't in [the noun]." instead.
Carry out departing:
let chosen way be the logical exit;
if chosen way is a direction
say "(heading [chosen way], since that is the only direction available)[line break]";
try going chosen way;
say "Any particular direction? ";
carry out the listing exits activity;
To decide what direction is the logical exit:
let N be 0;
let chosen way be north;
repeat with way running through directions
let place be the room way from the location;
if place is a room
increase N by 1;
let chosen way be the way;
if N is 1, decide on the chosen way.