The Reliques of Tolti-Aph — 35 of 57

Graham Nelson

Release 3

Section E(f) - Solid Rock and labyrinth boundaries

["Solid Rock" is a room which is never visited, but which is used to indicate blocked-off routes: an exit leading to Solid Rock is considered blocked. Initially, when none of the labyrinth rooms have been "played" into the maze, all exits are blocked in this way. Solid Rock is also used as a special value meaning that no room is at a given grid position: thus "the room at <1,4,12>" might evaluate to a room present in the maze, or it might evaluate to Solid Rock.]

Solid Rock is a room.

To make all labyrinth exits lead to Solid Rock:

repeat with blank room running through labyrinth rooms:

let Sh be the shape of the blank room;

if U part of Sh is 1, change the up exit of blank room to Solid Rock;

if D part of Sh is 1, change the down exit of blank room to Solid Rock;

if N part of Sh is 1, change the north exit of blank room to Solid Rock;

if E part of Sh is 1, change the east exit of blank room to Solid Rock;

if S part of Sh is 1, change the south exit of blank room to Solid Rock;

if W part of Sh is 1, change the west exit of blank room to Solid Rock.

To decide which room is the room at (grid ref - a spatial coordinate):

if grid ref is <0,0,0>:

decide on Solid Rock;

repeat with R running through rooms:

if the grid position of R is grid ref:

decide on R;

decide on Solid Rock.