The Reliques of Tolti-Aph — 36 of 57

Graham Nelson

Release 3

Section E(g) - Terra Incognita

[Like "Solid Rock", "Terra Incognita" is a room which is never visited. The rule is that a maze exit leads to TI if and only if it would take one to a grid position which is still inside the boundaries of the maze, but at which no room has yet been located. Except for the special case of the Hedge Archway joining the maze to the outside world, all exits in the maze lead either to Solid Rock (no way through), Terra Incognita (we try extending the maze if this exit is taken) or another room in the maze.

The "position ... at ..." phrase is crucial in establishing the game's mechanics, because it maintains these rules about exits, and checks to see whether adjacent rooms have exits which join up or not. Note that up and down staircases always work (the "vertical" directions), but are sometimes secret and invisible from the other side - a quirk of the original "Sorcerer's Cave" board game which lives on here.]

Terra Incognita is a room.

Egress relates a room (called the place) to a direction (called that way) when the room that way from the place is a room. The verb to exit (it exits) implies the egress relation.

To position (new room - a room) at (grid ref - a spatial coordinate):

now the grid position of the new room is the grid ref;

repeat with this way running through vectorial directions:

let the further position be the vector sum of the grid ref and the vector of this way;

[say "In direction [this way], the position would be [further position].";]

if the further position is not <0,0,0>:

let the further room be the room at the further position;

if the further room is Solid Rock:

if the new room exits this way:

change this way exit of the new room to Terra Incognita;

otherwise:

let the reverse way be the opposite of this way;

if this way is vertical or the new room exits this way:

if the further room exits the reverse way:

change this way exit of the new room to the further room;

change the reverse way exit of the further room to the new room;

otherwise:

change this way exit of the new room to Solid Rock;

otherwise:

if the further room exits the reverse way, change the reverse way exit of the further room to Solid Rock.