Section 7 - Go Back (the way we came)
The former direction is a direction that varies. The last location is a room that varies.
Carry out going a direction:
change the last location to the location;
change the former direction to the noun.
Understand "go back" as retreating. Understand "back" or "return" or "retreat" as retreating.
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 "You will have to be more specific about which direction you want to go[if novice mode is functioning]. [exit description][end if].";
Understand "exits" or "dirs" or "directions" or "dir" or "find exits" or "find exit" as asking for directions. Asking for directions is an action out of world. Carry out asking for directions: say exit description.
To decide what direction is the logical exit:
let counter 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 counter by 1;
let chosen way be the way;
if counter is 1, decide on the chosen way.