Object OutsideMaze "Outside Maze"
has light
with
description [;
print "You are in a small room, with exits north and south. The
passage to the north has a small sign reading, ~Behavior Lab Maze~.
The room is filled with strange equipment, which you surmise is
connected in some way to the maze. ";
if (mazeequip has general) print "The equipment is buzzing loudly.
Standing near it makes you feel vaguely dizzy. ";
if (self hasnt visited) {
print "^^You sigh in exasperation as you realize that you have
reached the obligatory Adventure Game Maze, and ";
if (MazeView has visited) print "you wish that this were a graphical
adventure, so your trip to the maze viewing room had resulted in a
map you could refer to now. Fortunately, you do recall noting that
the passages in the maze all lead east-west or north-south. ";
else print "wonder what this maze's unique twist will be. Surely, it
won't just be a boring old labyrinth... ";
}
new_line;
rtrue;
],
before [;
Go:
if (noun == in_obj) <<Go n_obj>>;
],
s_to Tunnel13, n_to Maze1;
Object -> mazeequip "equipment"
has scenery general
with
article "some",
name 'equipment' 'coil' 'coils' 'pipe' 'pipes' 'wire' 'wires' 'electric'
'electrical' 'tangled' 'web',
description [;
print "The equipment resembles some of the particle accelerators that
you have seen. It has several huge electric coils, all arranged
around a series of foot-diameter pipes. A tangled web of enormous
wires connects various parts of the equipment together and other
wires feed it power. ";
if (self has general) "The equipment is buzzing loudly. Standing near
it makes you feel vaguely dizzy.";
new_line; rtrue;
],
react_before [;
Listen: if (noun == 0) <<Listen self>>;
],
before [;
SwitchOff:
print "There seems to be no way to do that. ";
if (self hasnt general) print "Besides, it doesn't even appear to be
on.";
new_line; rtrue;
SwitchOn:
print "There seems to be no way to do that. ";
if (self has general) print "Besides, it appears to be already on.";
new_line; rtrue;
SwitchVague:
"There seems to be no way to do that.";
Turn:
"There don't seem to be any dials.";
Push:
"There are no buttons visible in the tangled web of wires and pipes.";
Pull:
"There are no levers to pull.";
Attack:
"The equipment proves highly resilient.";
Listen:
if (self has general)
"The equipment is making a loud buzzing sound.";
],
;
Object maze_view "maze"
has static concealed enterable
with
parse_name [
wd adj_count noun_count;
wd=NextWord();
while (wd == 'behavior' or 'lab') { adj_count++; wd=NextWord(); }
while (wd == 'maze' or 'labyrinth') { noun_count++; wd=NextWord(); }
if (noun_count) return adj_count+noun_count;
else return 0;
],
description "You can't see much from here.",
before [;
Enter: <<GoIn>>;
Examine: rfalse;
default: "The view of the maze isn't important.";
],
found_in OutsideMaze BehaviorLab,
;
Property exits alias number;
Class MazeRoom
has light
with
short_name [;
if (mazeequip has general) print "Lost in the Maze";
else print "In the Maze";
rtrue;
],
each_turn [; if (mazeequip has general) give self ~visited; ],
description [
i exits_entry count total_exits;
if (mazeequip has general) "You can't quite seem to get your bearings.
There are some passages leading away, but you can't quite tell how
many or in which direction they lead.";
else {
print "You are in a room in the maze; they all look alike. You can go ";
exits_entry=self.&exits;
for (i=0: i <= 3: i++)
if (exits_entry-->i ~= 0) total_exits++;
for (i=0: i <= 3: i++ ) {
if (exits_entry-->i ~= 0) {
if (count > 0) {
if (total_exits == 2) print " and ";
else if (total_exits == (count + 1)) print ", and ";
else print ", ";
}
count++;
switch (i) {
0: print "north";
1: print "south";
2: print "east";
3: print "west";
}
}
}
".";
}
],
mazetravel [ index
i destination exits_entry rvalue;
exits_entry=self.&exits;
if (mazeequip has general) {
print "You can't figure out which direction is which; the more you
stumble about, the more the room seems to spin around. After a
few steps, you're not sure if you've actually gone anywhere,
since all these rooms look alike...^";
do {
i=random(6)-1;
destination=exits_entry-->i;
if (destination == 0) rvalue=0;
else if (i < 4) rvalue=destination;
else rvalue=self;
} until (rvalue ~= 0);
}
else {
if (index == -1) rvalue=0;
else rvalue=exits_entry-->index;
}
return rvalue;
],
before [;
Go:
if (noun == in_obj) "You are already in the maze.";
Exit: "If only it were that simple.";
],
n_to [; return self.mazetravel(0); ],
s_to [; return self.mazetravel(1); ],
e_to [; return self.mazetravel(2); ],
w_to [; return self.mazetravel(3); ],
u_to [; return self.mazetravel(-1); ],
d_to [; return self.mazetravel(-1); ],
ne_to [; return self.mazetravel(-1); ],
nw_to [; return self.mazetravel(-1); ],
se_to [; return self.mazetravel(-1); ],
sw_to [; return self.mazetravel(-1); ],
;
MazeRoom Maze1
with
before [;
Exit:
PlayerTo(OutsideMaze);
rtrue;
],
exits 0 OutsideMaze Maze2 0;
MazeRoom Maze2 with exits Maze9 0 Maze3 Maze1;
MazeRoom Maze3 with exits Maze8 0 Maze4 Maze2;
MazeRoom Maze4 with exits 0 0 Maze5 Maze3;
MazeRoom Maze5 with exits Maze6 0 0 Maze4;
MazeRoom Maze6 with exits 0 Maze5 0 Maze7;
MazeRoom Maze7 with exits Maze30 0 Maze9 Maze8;
MazeRoom Maze8 with exits Maze29 Maze3 Maze7 0;
MazeRoom Maze9 with exits 0 Maze2 0 Maze10;
MazeRoom Maze10 with exits 0 0 Maze9 Maze11;
MazeRoom Maze11 with exits 0 Maze35 Maze10 Maze12;
MazeRoom Maze12 with exits 0 0 Maze11 0;
MazeRoom Maze13 with exits Maze24 Maze18 0 0;
MazeRoom Maze14 with exits 0 Maze17 0 Maze15;
MazeRoom Maze15 with exits 0 Maze16 Maze14 0;
MazeRoom Maze16 with exits Maze15 Maze23 Maze17 0;
MazeRoom Maze17 with exits Maze14 Maze22 Maze18 Maze16;
MazeRoom Maze18 with exits Maze13 Maze21 0 Maze17;
MazeRoom Maze19 with exits 0 Maze20 Maze35 0;
MazeRoom Maze20 with exits Maze19 0 0 Maze21;
MazeRoom Maze21 with exits Maze18 0 Maze20 0;
MazeRoom Maze22 with exits Maze17 0 0 0;
MazeRoom Maze23 with exits Maze16 0 0 0;
MazeRoom Maze24 with exits 0 Maze13 Maze25 0;
MazeRoom Maze25 with exits Maze33 0 Maze26 Maze24;
MazeRoom Maze26 with exits Maze32 0 0 Maze25;
MazeRoom Maze27 with exits Maze31 0 0 0;
MazeRoom Maze28 with exits 0 0 Maze29 0;
MazeRoom Maze29 with exits 0 Maze8 Maze30 Maze28;
MazeRoom Maze30 with exits 0 Maze7 0 Maze29;
MazeRoom Maze31 with exits 0 Maze27 0 Maze32;
MazeRoom Maze32 with exits 0 Maze26 Maze31 0;
MazeRoom Maze33 with exits 0 Maze25 0 Maze34;
MazeRoom Maze34 with exits 0 0 Maze33 MazeStart;
MazeRoom Maze35 with exits Maze11 0 0 Maze19;
Object MazeStart "Start of Maze"
has light
with
description "You are at the start of the maze. A passage into the maze is
to the east, and a heavy one-way door marked ~Exit~ is to the south.",
before [;
Exit: <<Go s_obj>>;
],
e_to Maze34, s_to behavior_door_n,
;
Object behavior_door_n "door" MazeStart
has door openable scenery
with
name "door" "behavior",
description [;
print "The door is ";
if (self has open) "open.";
else "closed.";
],
time_left 0,
time_out [;
give self ~open;
"^The door swings shut.";
],
after [;
Open: StartTimer(self, 1);
],
door_dir s_to, door_to BehaviorLab,
;