print ("Welcome to Labyrinth by Russell Wallace.\n");
print ("Do you want instructions? (Y/N) : ");
if (yesno ())
{
print ("Labyrinth was originally written in Pascal on a PDP 11-73 \
minicomputer, converted to C and ported to the Amiga, and then in this version \
ported to MS-DOS.\n\
Labyrinth is a role-playing game in which \
you wander around a series of underground caves fighting the \
computer-controlled characters and amassing treasure. The ultimate \
object of the game is to kill all the other characters having \
collected as many as possible of the 300 or so coins lying around \
the caves. The other characters will be doing the same thing, and \
will usually attack anyone they see including you. If attacked, \
use your most effective weapon (your fist if nothing else is \
available). Blows will reduce your strength; if this falls to zero \
you die. As time passes it will gradually build up again but can \
never exceed your power. Everyone starts with a power of 300 and \
if you kill somebody, a quarter of their power is added to yours, \
and you can pick up anything they might have been carrying. When \
everyone else is dead your money will be added to your score which \
will be carried over to the next game.\n\
Labyrinth is a work of fiction and no similarity to any real \
places or events is intended or implied, however most of the \
computer-controlled characters are named after people from my \
class in St. Andrews College in order to make the game more \
interesting.\n\
The following commands are available:\n\
TAKE object - pick up something\n\
DROP object - put down something\n\
HIT person WITH object - commit an act of violence\n\
INVENTORY - list your possessions etc.\n\
VERBOSE - describe surrounding locations\n\
BRIEF - only describe current location\n\
NORTH,SOUTH,EAST,WEST - move around\n\
QUIT - terminate game\n\
LOCAL - narrate events only where you are\n\
GLOBAL - narrate combat elsewhere in brackets\n\
REDESCRIBE current location\n\
All commands can be abbreviated to the first letter, and the word \
WITH can be omitted entirely. Refer to people by first names only. \
Object names can also be abbreviated to one or two letters.\n\n\
Press any key to start ");
if (waitinput ()==-1000)
{
exit (0);
}
}
writechar ('\n');
do
{ /* This loop will execute as long as game not over */
for (i=0;i<=NUMCHAR;i++)
{
charpos[i]=rnd (NUMLOC-1)+1;
if (legal (charpos[i])==FALSE)
charpos[i]++;
power[i]=strength[i]=300;
}
for (i=1;i<=NUMTYPE-2;i++)
for (j=1;j<=NUMWEAP;j++)
weapos[i][j]=rnd (NUMLOC)+1;
for (i=1;i<=NUMCOIN;i++)
coinpos[i]=rnd (NUMLOC)+1;
see=TRUE; /* Describe location game starts in */
do
{ /* This loop will execute until game over or won */
if (see)
{
print ("You are in");
look (charpos[0]);
population (charpos[0]);
if (numpos (charpos[0]))
{
print ("You can also see:\n");
locdesc (charpos[0]);
}
if (verbose)
{
print ("To the north you can see");
look (charpos[0]-(MAXX+1));
print ("To the south you can see");
look (charpos[0]+MAXX+1);
print ("To the east you can see");
look (charpos[0]+1);
print ("To the west you can see");
look (charpos[0]-1);
}
see=FALSE;
}
print ("What now? :");
command=getstring ();
for (i=0;i<INLEN;i++)
command[i]=tolower (command[i]);
index=0;
if (command[0]=='l')
global=FALSE;
if (command[0]=='g')
global=TRUE;
if (command[0]=='b')
verbose=FALSE;
if (command[0]=='v')
verbose=TRUE;
if (command[0]=='i')
{
if (numpos (0)==0)
print ("You are emptyhanded.\n");
else
{
print ("You are carrying:\n");
locdesc (0);
}
print ("Your strength is ");
printnum (strength[0]);
print ("\nYour power is ");
printnum (power[0]);
print ("\nYour score is ");
printnum (score+numcoin (0));
writechar ('\n');
}
if (command[0]=='q')
{
print ("OK, so long.\n");
dead=TRUE;
goto FINISH;
}
if (command[0]=='t')
{
thing=getname (command);
if (thing==7)
print ("It seems to be attached to your arm.\n");
else
if (thing)
{
take (0,thing);
if (err)
print ("I see none here.\n");
else
print ("Taken.\n");
}
}
if (command[0]=='d')
{
thing=getname (command);
if (thing==7)
print ("Amputation is very unpleasant.\n");
else
if (thing)
{
drop (0,thing);
if (err)
print ("You have none to drop.\n");
else
print ("Dropped.\n");
}
}
if (command[0]=='r')
see=TRUE;
if (command[0]=='n')
walk (0,0);
if (command[0]=='s')
walk (0,1);
if (command[0]=='e')
walk (0,2);
if (command[0]=='w')
walk (0,3);
if (command[0]=='n' || command[0]=='s' || command[0]=='e' || command[0]=='w')
if (err)
print ("You bang your face off the wall as you attempt this.\n");
else
see=TRUE;
if (command[0]=='h')
{
getword (command);
tarnum=0;
for (i=1;i<=NUMCHAR;i++)
if (strcmp (inword,pername[i])==0 && charpos[i]==charpos[0])
tarnum=i;
if (tarnum==0)
print ("There is nobody here by that name.\n");
else
{
weapon=getname (command);
if (weapon)
if (numweap (0,weapon)==0)
print ("You have none to use.\n");
else
attack (0,tarnum,weapon);
}
}
for (i=1;i<=NUMCHAR;i++) /* Now handle computer characters */
{
otget (i); /* Grab everything in sight */
if (taken==0) { /* If nothing to take, then fight */
fought=FALSE;
j=-1;
do
{ /* look for someone to fight */
j++;
if (charpos[i]==charpos[j] && i!=j && charpos[i]!=NOWHERE)
{
fought=TRUE; /* found someone, now choose weapon */
atstre=22;
atweap=7; /* default weapon is fist */
for (z=1;z<=NUMTYPE-2;z++)
{
if (hitval[z]>atstre && numweap (-i,z))
{
atweap=z;
atstre=hitval[z];
}
}
}
}
while (fought==0 && j<NUMCHAR);
if (fought)
attack (i,j,atweap); }
if (taken==0 && fought==0)
walk (i,rnd (4)); /* if nothing else to do, wander around */
}
alldead=TRUE;
for (i=0;i<=NUMCHAR;i++)
{
if (i && charpos[i]>NOWHERE)
alldead=FALSE;
strength[i]+=6; /* gradual recovery */
if (strength[i]>power[i])
strength[i]=power[i];
}
}
while (dead==FALSE && alldead==FALSE);
score+=numcoin (0);
if (alldead)
print ("Congratulations ... you've killed everyone else in the game! A new game is now starting, with your money from the old added to your score.\n");
}
while (dead==FALSE);
FINISH:
score=0;
print ("Game over. Would you like to play again? (Y/N) : ");