Polarity
Example 103
★★★The main trick of this is always to record where the player has gone when he has just moved.
"Polarity"
The former location is a room that varies.
Here we record where the player has been before moving him; by calling this the "first carry out going rule", we make sure that this rule is followed during the going action before any other pieces of the movement occur. For more detail, see the chapters on advanced actions and on rules.
First carry out going rule:
now the former location is the location.
Understand "go back" as retreating. Understand "back" or "return" or "retreat" as retreating.
Retreating is an action applying to nothing.
Carry out retreating:
let way be the best route from the location to the former location, using doors;
if way is a direction, try going way;
otherwise say "You can't see an open way back."
And to deal with the case where the player has not yet moved:
When play begins: now the former location is the Dome.
Instead of retreating when the former location is the location: say "You haven't gone anywhere yet."
Dome is a room. North of Dome is North Chapel. South of the Dome is South Chapel. West of the Dome is Western End. Quiet Corner is northwest of the Dome, north of Western End, and west of North Chapel. Loud Corner is east of North Chapel, northeast of Dome, and north of Eastern End. Eastern End is north of Dim Corner and east of Dome. Dim Corner is southeast of Dome and east of South Chapel. Ruined Corner is southwest of Dome, west of South Chapel, and south of Western End.
The church door is east of Eastern End and west of the Courtyard. The church door is a door.
Test me with "back / n / go back / e / open door / go through door / go back".
Test me with "back / n / go back / e / open door / go through door / go back".
Dome
>(Testing.)
>[1] back
You haven't gone anywhere yet.
>[2] n
North Chapel
>[3] go back
Dome
>[4] e
Eastern End
You can see a church door here.
>[5] open door
You open the church door.
>[6] go through door
Courtyard
You can see a church door here.
>[7] go back
Eastern End
You can see a church door here.
>(Testing.)
>[1] back
You haven't gone anywhere yet.
>[2] n
North Chapel
>[3] go back
Dome
>[4] e
Eastern End
You can see a church door here.
>[5] open door
You open the church door.
>[6] go through door
Courtyard
You can see a church door here.
>[7] go back
Eastern End
You can see a church door here.