The Reliques of Tolti-Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section E(i) - Exploring the labyrinth

Definition: A labyrinth room is acceptable if it is unplaced and its minimum level <= the current maze level.

Before going a direction (called this way) to Terra Incognita:
    if the location is unplaced or this way is not vectorial, say "Oops! You should only reach terra incognita from a placed room via a vectorial direction."; [1]
    if Terra Incognita is closed, say "The way is barred by some enchantment of the never-children." instead;
    let possibles be the number of acceptable labyrinth rooms;
    if possibles is 0
    begin;
        retrieve inaccessible labyrinth rooms;
        let possibles be the number of acceptable labyrinth rooms;
        if possibles is 0[2]
        begin;
            now Terra Incognita is closed;
            say "In your mind, you hear the scornful laughter of the never-children. 'Magic-uther has run out of labyrinth!' And certainly the way is blocked." instead;
        end if;
    end if;
    if possibles > 0
    begin;
        let the new room be a random acceptable labyrinth room;
        let the current position be the grid position of the location;
        let the new position be the vector sum of the current position and the vector of this way;
        position the new room at the new position;
    otherwise;
        change this way exit of the location to Solid Rock;
    end if;
    try going this way instead.

After going up to a labyrinth room from a non-ascending labyrinth room: say "You take the well-remembered secret staircase up."; continue the action.

After going down to a labyrinth room from a non-descending labyrinth room: say "You take the well-remembered secret staircase down."; continue the action.

Instead of going to Solid Rock:
    say "After a few strides, the way gives out into ";
    if the current maze level is 1, say "dense, impenetrable undergrowth";
    otherwise say "solid rock";
    say ". You step back again."

Notes

[1]. This never happens, of course: it was put in to test the game.

[2]. I.e., if even retrieving unvisited rooms didn't help: now the maze really is exhausted.