![]() |
The Reliques of Tolti-AphAn interactive fiction by Graham Nelson (2005) - the Inform 7 source text |
| Home page Contents Previous Next Complete text | 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 begin; 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; end repeat. To decide which room is the room at (grid ref - a spatial coordinate): if grid ref is <0,0,0> then decide on Solid Rock; repeat with R running through rooms begin; if the grid position of R is grid ref then decide on R; end repeat; decide on Solid Rock. |