Offering the player a list of valid directions if he tries to go in a direction that leads nowhere.

"Bumping into Walls"

First we add an instruction to determine which ways lead to other rooms.

Definition: a direction (called thataway) is viable if the room thataway from the location is a room.

Now we build in the instruction for what Inform should say if the player tries to head in a direction that leads nowhere:

Instead of going nowhere:
   let count of exits be the number of viable directions;
   if the count of exits is 0, say "You appear to be trapped in here." instead;
   if the count of exits is 1, say "From here, the only way out is [list of viable directions].";
   otherwise say "From here, the viable exits are [list of viable directions]."

There is no theoretical reason why we have to define "count of exits" here: we could, if we wanted, just say "if the number of viable directions is 0", "if the number of viable directions is 1", and so on. However, each calculation of a "viable direction" takes a bit of computing power, so there is some slight savings in not requiring the game to count viable directions more than once in this routine.

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 Crypt is below the dome.
The church door is east of Eastern End and west of the Courtyard. The church door is a door.
Test me with "u / n / n / e / n / s / u / open door / e / n".
Test me with "u / n / n / e / n / s / u / open door / e / n".
Dome

>(Testing.)

>[1] u
From here, the viable exits are north, northeast, northwest, south, southeast, southwest, east, west and down.

>[2] n

North Chapel

>[3] n
From here, the viable exits are south, east and west.

>[4] e

Loud Corner

>[5] n
From here, the viable exits are south, southwest and west.

>[6] s

Eastern End
You can see a church door here.

>[7] u
From here, the viable exits are north, south, east and west.

>[8] open door
You open the church door.

>[9] e

Courtyard
You can see a church door here.

>[10] n
From here, the only way out is west.