Remove advent and ttt

This commit is contained in:
Arun Thomas 2011-07-26 11:37:18 +02:00
parent 8a8f27951b
commit 2a9322a117
26 changed files with 3 additions and 11834 deletions

View file

@ -2,7 +2,7 @@
.include <bsd.own.mk>
SUBDIR= aal add_route adduser advent arp ash at autil awk \
SUBDIR= aal add_route adduser arp ash at autil awk \
backup badblocks banner basename bigmake binpackage \
binpackages binsizes bzip2 bzip2recover cal calendar \
cat cawf cd cdprobe checkhier chmem \
@ -29,7 +29,7 @@ SUBDIR= aal add_route adduser advent arp ash at autil awk \
stty su sum svclog swapfs swifi sync synctree sysenv \
syslogd tail tar tcpd tcpdp tcpstat tee telnet \
telnetd term termcap tget time tinyhalt touch tr \
truncate tsort ttt tty udpstat umount uname unexpand \
truncate tsort tty udpstat umount uname unexpand \
unstack update uud uue version vol wc \
whereis which who write writeisofs fetch \
xargs yacc yes zdump zic zmodem pkgin_cd \

View file

@ -1,34 +0,0 @@
# Makefile for advent
PROG= advent
SRCS= advent.c database.c english.c initial.c itverb.c score.c \
travel.c turn.c utility.c verb.c vocab.c
# Where to put the adventure text files
# Need the trailing "/" on TEXTDIR
TEXTDIR= /usr/lib/advent/
FILESDIR= ${TEXTDIR}
DATFILES= advent1.dat advent2.dat advent3.dat advent4.dat
FILES= ${DATFILES}
MAN=
database.o: advtext.h
setup: setup.c advent.h
${CC} ${CPPFLAGS} ${LDFLAGS} -o $@ ${.CURDIR}/setup.c
advtext.h advent1.dat advent2.dat advent3.dat advent4.dat: \
setup advent1.txt advent2.txt advent3.txt advent4.txt
./setup ${.CURDIR}
database.d: touch-genfiles
touch-genfiles:
[ -e advtext.h ] || touch -t 197001010000.00 advtext.h
CPPFLAGS.advent.c= -DTEXTDIR='"${TEXTDIR}"'
CLEANFILES+= ${DATFILES} advtext.h setup
.include <bsd.prog.mk>

File diff suppressed because it is too large Load diff

View file

@ -1,71 +0,0 @@
/* header ADVDEC.H *
* WARNING: GLOBAL (EXTERNAL) declarations for adventure */
#ifndef EXTERN /* #define as '' to define the variables */
#define EXTERN extern
#endif
EXTERN boolean gaveup; /* TRUE if he quits early */
EXTERN FILE *fd1, *fd2, *fd3, *fd4;
/*
English variables
*/
EXTERN char *vtxt[MAXWORDS], *iotxt[MAXITEMS], *otxt[MAXITEMS];
EXTERN int verbs[MAXWORDS], objs[MAXITEMS], iobjs[MAXITEMS];
EXTERN int vrbx, objx, iobx;
EXTERN int verb, object, motion, iobj, prep;
EXTERN boolean newtravel, is_wiz;
/*
Play variables
*/
extern int plac[MAXOBJ]; /* initial location */
extern int fixd[MAXOBJ];
struct playinfo {
int turns;
int loc, oldloc, oldloc2, newloc; /* location variables */
long loc_attrib[MAXLOC+1]; /* location status */
int place[MAXOBJ]; /* object location */
int fixed[MAXOBJ]; /* second object loc */
int weight[MAXOBJ];
int atloc[MAXLOC+1];
int link[MAXOBJ * 2];
int holder[MAXOBJ];
int hlink[MAXOBJ];
int visited[MAXLOC+1]; /* >0 if has been here */
int prop[MAXOBJ]; /* status of object */
long obj_state[MAXOBJ];
long points[MAXOBJ];
int hinted[HNTMAX+1];
int hints[HNTMAX+1][5];
int hintlc[HNTMAX+1];
int tally, tally2; /* item counts */
int limit; /* time limit */
int lmwarn; /* lamp warning flag */
int wzdark, closing, closed; /* game state flags */
int holding; /* count of held items */
int detail; /* LOOK count */
int knfloc; /* knife location */
int clock, clock2, panic; /* timing variables */
int dloc[DWARFMAX+1]; /* dwarf locations */
int dflag; /* dwarf flag */
int dseen[DWARFMAX+1]; /* dwarf seen flag */
int odloc[DWARFMAX+1]; /* dwarf old locations */
int daltloc; /* alternate appearance */
int dkill; /* dwarves killed */
int chloc, chloc2; /* chest locations */
int bonus; /* to pass to end */
int numdie; /* number of deaths */
int foobar; /* fee fie foe foo... */
int combo; /* combination for safe */
boolean terse;
int abbnum;
int health;
int chase;
boolean flg239;
int lastglob; /* to get space req. */
};
extern struct playinfo g;

View file

@ -1,136 +0,0 @@
/** Adventure translated from Fortran to "C"
and ported to Minix by:
Robert R. Hall
San Diego, Calif 92115
hall@crash.cts.com
*/
/** program ADVENT.C *
* "advent.c" allocates GLOBAL storage space by *
* #defining EXTERN before #including "advdec.h". */
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include "advent.h" /* #define preprocessor equates */
#include "advdec.h"
#ifndef TEXTDIR
#define TEXTDIR ""
#endif
char textdir[] = TEXTDIR; /* directory where text files
live. */
_PROTOTYPE(int main, (int, char **));
_PROTOTYPE(static void opentxt, (void));
_PROTOTYPE(static void file_error, (char *));
int main(argc, argv)
int argc;
char **argv;
{
opentxt();
initialize();
rspeak(325);
if (argc == 2)
restore(argv[1]);
else {
g.hinted[3] = yes(65, 1, 0);
g.limit = (g.hinted[3] ? 800 : 550);
}
gaveup = FALSE;
srand((unsigned) time(NULL)); /* seed random */
while (!gaveup)
turn();
fclose(fd1);
fclose(fd2);
fclose(fd3);
fclose(fd4);
return (EXIT_SUCCESS); /* exit = ok */
} /* main */
/*
Open advent?.txt files
*/
static void opentxt()
{
static char filename[sizeof(textdir) + 16];
static FILE **fp[] = {0, &fd1, &fd2, &fd3, &fd4};
int i;
for (i = 1; i <= 4; i++) {
sprintf(filename, "%sadvent%d.dat", textdir, i);
*fp[i] = fopen(filename, "r");
if (!*fp[i])
file_error(filename);
}
}
/*
save adventure game
*/
void saveadv(username)
char *username;
{
int cnt;
FILE *savefd;
savefd = fopen(username, "wb");
if (savefd == NULL) {
perror(username);
return;
}
cnt = fwrite((void *) &g, 1, sizeof(struct playinfo), savefd);
if (cnt != sizeof(struct playinfo)) {
fprintf(stderr, "wrote %d of %u bytes\n",
cnt, (unsigned) sizeof(struct playinfo));
if (ferror(savefd)) {
fprintf(stderr, "errno is: 0x%.4x\n", errno);
perror(username);
}
}
if (fclose(savefd) == -1) {
perror(username);
}
printf("Saved in %s.\n", username);
return;
}
/*
restore saved game handler
*/
void restore(username)
char *username;
{
int cnt;
FILE *restfd;
restfd = fopen(username, "rb");
if (restfd == NULL)
file_error(username);
cnt = fread((void *) &g, 1, sizeof(struct playinfo), restfd);
if (cnt != sizeof(struct playinfo)) {
fprintf(stderr, "read %d bytes, expected %u\n",
cnt, (unsigned) sizeof(struct playinfo));
if (ferror(restfd)) {
fprintf(stderr, "errno is: 0x%.4x\n", errno);
perror(username);
}
}
if (fclose(restfd) == -1) {
perror(username);
}
printf("Restored from %s.\n", username);
return;
}
static void file_error(filename)
char *filename;
{
perror(filename);
exit(EXIT_FAILURE);
}

View file

@ -1,405 +0,0 @@
/* header ADVENT.H *
* WARNING: HEADER file for all adventure modules */
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#define EXIT_SUCCESS (!(EXIT_FAILURE))
#endif
#define INPUTBUFLEN 80 /* Max input line length */
typedef int boolean;
#define FALSE (0)
#define TRUE (!FALSE)
#define MAXOBJ 123 /* max # of objects in cave */
#define MAXLOC 248 /* max # of cave locations */
#define WORDSIZE 20 /* max # of chars in commands */
#define MAXMSG 408 /* max # of long location descr */
#define HNTMAX 18 /* max # of hints */
#define HNTMIN 7 /* hints starting count */
#define MAXWORDS 25
#define MAXITEMS 45
#define CLASS(word) ((word)<0 ? -((-(word)) / 1000) : (word) / 1000)
#define VAL(word) ((word)<0 ? -((-(word)) % 1000) : (word) % 1000)
#define MAXTRAV (23+1) /* max # of travel directions from loc */
/* +1 for terminator travel[x].tdest=-1 */
#define DWARFMAX 6 /* max # of nasty dwarves */
#define MAXDIE 3 /* max # of deaths before close */
#define MAXTRS 79 /* max # of */
#define Y2 33
/*
Object definitions
*/
#define ANVIL 91
#define AXE 28
#define BATTERIES 39
#define BEAR 35
#define BEES 87
#define BILLBD 116
#define BIRD 101
#define BOAT 48
#define BOOK 110
#define BOOK2 BOOK + 1
#define BOOTH 93
#define BOTTLE 20
#define BRUSH 114
#define CAGE 4
#define CAKES 107
#define CARVNG 115
#define CASK 71
#define CHAIN 64
#define CHASM 21
#define CHASM2 CHASM + 1
#define CHEST 55
#define CLAM 14
#define CLOAK 47
#define COINS 54
#define CROWN 66
#define DOG 98
#define DOOR 41 /* giant door */
#define DRAGON 31
#define DWARF 17
#define EGGS 56
#define EMERALD 59
#define FISSURE 12
#define FLOWER 46
#define FLY 69
#define FOOD 19
#define GNOME 105
#define GRAIL 70
#define GRATE 3
#define HIVE 97
#define HONEY 96
#define HORN 52
#define JEWELS 53
#define KEYS 102
#define KNIFE 18
#define LAMP 2
#define LYRE 68
#define MAGAZINE 16
#define MESSAGE 36
#define MIRROR 23
#define MUSHRM 106
#define NUGGET 50
#define OIL 83
#define OIL2 OIL + 1
#define OYSTER 15
#define PLAGUE 125
#define PEARL 61
#define PHONE 94
#define PILLOW 10
#define PLANT 24
#define PLANT2 PLANT + 1
#define POLE 9
#define POSTER 113
#define PYRAMID 60
#define RADIUM 119
#define RING 72
#define ROCKS 92
#define ROD 5
#define ROD2 ROD + 1
#define RUG 62
#define SAFE 112
#define SAPPHIRE 69
#define SHIELD 118
#define SHOES 67
#define SKEY 90
#define SLUGS 95
#define SNAKE 11
#define SPHERE 120
#define SPICES 63
#define SPIDER 121
#define STEPS 7
#define STICKS 49
#define SWORD 65
#define TABLET 13
#define TDOOR 42 /* tiny door */
#define TDOOR2 TDOOR + 1 /* wrought-iron door */
#define PDOOR TDOOR2 + 1 /* door to phone booth */
#define TRIDENT 57
#define TROLL 33
#define TROLL2 TROLL + 1
#define VASE 58
#define VEND 38
#define WALL 88
#define WALL2 WALL + 1
#define WATER 81 /* in bottle */
#define WATER2 WATER + 1 /* in cask */
#define WINE 85 /* in bottle */
#define WINE2 WINE + 1 /* in cask */
#define WUMPUS 99
/*
Verb definitions
*/
#define BACK 8
#define CAVE 67
#define DEPRESSION 63
#define ENTRANCE 64
#define EXIT 11
#define NULLX 21
/*
Action verb definitions
*/
#define TAKE 1
#define DROP 2
#define SAY 3
#define OPEN 4
#define NOTHING 5
#define CLOSE 6
#define ON 7
#define OFF 8
#define WAVE 9
#define CALM 10
#define WALK 11
#define KILL 12
#define POUR 13
#define EAT 14
#define DRINK 15
#define RUB 16
#define THROW 17
#define QUIT 18
#define FIND 19
#define INVENTORY 20
#define FEED 21
#define FILL 22
#define BLAST 23
#define SCORE 24
#define FOO 25
#define BRIEF 26
#define READ 27
#define BREAK 28
#define WAKE 29
#define SUSPEND 30
#define RESTORE 31
#define YANK 32
#define WEAR 33
#define HIT 34
#define ANSWER 35
#define BLOW 36
#define LEAVE 37
#define YELL 38
#define DIAL 39
#define PLAY 40
#define PICK 41
#define PUT 42
#define TURN 43
#define GET 44
#define INSRT 45
#define REMOVE 46
#define BURN 47
#define GRIPE 48
#define LOCK 49
#define UNLOCK 50
#define HEALTH 51
#define LOOK 52
#define COMBO 53
#define SWEEP 54
#define TERSE 55
#define WIZ 56
#define MAP 57
#define GATE 58
#define PIRLOC 59
#define GO 11
#define SHUT 6
#define LOG 33
#define MOTION 0 /* CLASSD */
#define NOUN 1 /* CLASSN */
#define ACTION 2 /* CLASSA */
#define MISC 3 /* CLASSM */
#define PREPOSITION 4 /* CLASSP */
#define ADJACTIVE 5 /* CLASSJ */
#define CONJUNCTION 6 /* CLASSC */
/*
and a few preposition. prefix PREP to distinguish them from
verbs or nouns
*/
#define PREPAT 9
#define PREPDN 8
#define PREPIN 1
#define PREPFR 5
#define PREPOF 6
#define PREPOFF 6
#define PREPON 2
/*
BIT mapping of "cond" array which indicates location status
*/
#define LIGHT 1
#define WATOIL 2
#define LIQUID 4
#define NOPIRAT 16
/* Object condition bit functions */
#define OPENBT 2
#define LOCKBT 4
#define BURNBT 6
#define DEADBT 10
#define WEARBT 12
/*
Structure definitions
*/
struct wac {
char *aword;
int acode;
};
struct trav {
int tdest;
int tverb;
int tcond;
};
/* Function prototypes.
"#if (__STDC__)" should have been be enough,
but some compilers are stupid, so allow Makefile to say -DHAS_STDC=whatever.
*/
#if defined(HAS_STDC) ? (HAS_STDC) : (__STDC__)
#undef HAS_STDC
#define HAS_STDC 1
#define _PROTOTYPE(function, params) function params
#define _CONST const
#else
#define _PROTOTYPE(function, params) function ()
#define _CONST
#endif
/* Advent.c */
_PROTOTYPE(void saveadv, (char *username));
_PROTOTYPE(void restore, (char *username));
/* Initialize.c */
_PROTOTYPE(void initialize, (void));
/* Database.c */
_PROTOTYPE(int yes, (int msg1, int msg2, int msg3));
_PROTOTYPE(void rspeak, (int msg));
_PROTOTYPE(void pspeak, (int item, int state));
_PROTOTYPE(void desclg, (int loc));
_PROTOTYPE(void descsh, (int loc));
/* English.c */
_PROTOTYPE(int english, (void));
_PROTOTYPE(int analyze, (char *word, int *type, int *value));
/* Itverb.c */
_PROTOTYPE(void itverb, (void));
_PROTOTYPE(void ivblast, (void));
_PROTOTYPE(void ivlook, (void));
/* Turn.c */
_PROTOTYPE(void turn, (void));
_PROTOTYPE(void describe, (void));
_PROTOTYPE(void descitem, (void));
_PROTOTYPE(void dwarfend, (void));
_PROTOTYPE(void normend, (void));
_PROTOTYPE(void score, (int));
_PROTOTYPE(void death, (void));
_PROTOTYPE(char *probj, (void));
_PROTOTYPE(void trobj, (void));
_PROTOTYPE(void dwarves, (void));
_PROTOTYPE(void dopirate, (void));
_PROTOTYPE(int stimer, (void));
/* Verb.c */
_PROTOTYPE(void trverb, (void));
_PROTOTYPE(void vtake, (void));
_PROTOTYPE(void vdrop, (void));
_PROTOTYPE(void vopen, (void));
_PROTOTYPE(void vsay, (void));
_PROTOTYPE(void von, (void));
_PROTOTYPE(void voff, (void));
_PROTOTYPE(void vwave, (void));
_PROTOTYPE(void vkill, (void));
_PROTOTYPE(void vpour, (void));
_PROTOTYPE(void veat, (void));
_PROTOTYPE(void vdrink, (void));
_PROTOTYPE(void vthrow, (void));
_PROTOTYPE(void vfind, (void));
_PROTOTYPE(void vfill, (void));
_PROTOTYPE(void vfeed, (void));
_PROTOTYPE(void vread, (void));
_PROTOTYPE(void vbreak, (void));
_PROTOTYPE(void vwake, (void));
_PROTOTYPE(void actspk, (int verb));
_PROTOTYPE(void vyank, (void));
_PROTOTYPE(void vwear, (void));
_PROTOTYPE(void vlock, (void));
_PROTOTYPE(void vunlock, (void));
_PROTOTYPE(void vclose, (void));
/* Utility.c */
_PROTOTYPE(boolean ajar, (int));
_PROTOTYPE(boolean at, (int item));
_PROTOTYPE(boolean athand, (int));
_PROTOTYPE(void bitoff, (int, int));
_PROTOTYPE(void biton, (int, int));
_PROTOTYPE(boolean bitset, (long, int));
_PROTOTYPE(boolean blind, (void));
_PROTOTYPE(int burden, (int));
_PROTOTYPE(void carry, (int obj, int where));
_PROTOTYPE(int confuz, (void));
_PROTOTYPE(boolean dark, (void));
_PROTOTYPE(boolean dcheck, (void));
_PROTOTYPE(boolean dead, (int));
_PROTOTYPE(void drop, (int obj, int where));
_PROTOTYPE(void destroy, (int obj));
_PROTOTYPE(boolean edible, (int));
_PROTOTYPE(boolean enclosed, (int));
_PROTOTYPE(void extract, (int));
_PROTOTYPE(boolean forced, (int atloc));
_PROTOTYPE(boolean here, (int item));
_PROTOTYPE(boolean hinged, (int));
_PROTOTYPE(boolean holding, (int));
_PROTOTYPE(void insert, (int, int));
_PROTOTYPE(boolean inside, (int));
_PROTOTYPE(void juggle, (int loc));
_PROTOTYPE(int liq, (int));
_PROTOTYPE(int liqloc, (int loc));
_PROTOTYPE(int liq2, (int pbottle));
_PROTOTYPE(boolean living, (int));
_PROTOTYPE(boolean locked, (int));
_PROTOTYPE(boolean locks, (int));
_PROTOTYPE(void lookin, (int));
_PROTOTYPE(void move, (int obj, int where));
_PROTOTYPE(int noway, (void));
_PROTOTYPE(boolean opaque, (int));
_PROTOTYPE(boolean outside, (int));
_PROTOTYPE(boolean pct, (int x));
_PROTOTYPE(boolean plural, (int));
_PROTOTYPE(boolean portal, (int));
_PROTOTYPE(boolean printed, (int));
_PROTOTYPE(int put, (int obj, int where, int pval));
_PROTOTYPE(int ranz, (int));
_PROTOTYPE(boolean small, (int));
_PROTOTYPE(boolean toting, (int item));
_PROTOTYPE(boolean treasr, (int));
_PROTOTYPE(boolean vessel, (int));
_PROTOTYPE(boolean wearng, (int));
_PROTOTYPE(boolean worn, (int));
_PROTOTYPE(void bug, (unsigned int n));
_PROTOTYPE(char *ask, (char *prompt, char *buf, int buflen));
_PROTOTYPE(void panic, (char *msg, boolean save));
/* travel.c */
_PROTOTYPE(void domove, (void));
_PROTOTYPE(void gettrav, (int loc, struct trav *travel));
/* vocab.c */
_PROTOTYPE(int vocab, (char *word, int val));

View file

@ -1,827 +0,0 @@
#1
You are standing at the end of a road before a small brick building.
Around you is a forest. A small stream flows out of the building and
down a gully.
#2
You have walked up a hill, still in the forest. The road slopes back
down the other side of the hill. There is a building in the distance.
#3
You are inside a building, a well house for a large spring. Off
to one side is a small pantry.
#4
You are in a valley in the forest beside a stream tumbling along a
rocky bed.
#5
You are in open forest, with a deep valley to one side. Not far
is a large billboard.
#6
You are in open forest near both a valley and a road.
#7
At your feet all the water of the stream splashes into a 2-inch slit
in the rock. Downstream the stream bed is bare rock.
#8
You are in a 20-foot depression floored with bare dirt. Set into the
dirt is a strong steel grate mounted in concrete. A dry stream bed
leads into the depression.
#9
You are in a small chamber beneath a 3x3 steel grate to the surface.
A low crawl over cobbles leads inward to the west.
#10
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
#11
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. A note on the wall
says "Magic Word XYZZY".
#12
You are in an awkward sloping east/west canyon.
#13
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
#14
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
#15
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
#16
The crack is far too small for you to follow.
#17
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
#18
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
#19
You are in the Hall of the Mountain King, with passages off in all
directions.
#20
You are at the bottom of the pit with a broken neck.
#21
You didn't make it.
#22
The dome is unclimbable.
#23
You are at the west end of the Twopit Room. There is a large hole in
the wall above the pit at this end of the room.
#24
You are at the bottom of the eastern pit in the Twopit Room. There is
a small pool of oil in one corner of the pit.
#25
You are at the bottom of the western pit in the Twopit Room. There is
a large hole in the wall about 25 feet above you.
#26
You clamber up the plant and scurry through the hole at the top.
#27
You are on the west side of the fissure in the Hall of Mists.
#28
You are in a low N/S passage at a hole in the floor. The hole goes
down to an E/W passage.
#29
You are in the South Side Chamber.
#30
You are in the West Side Chamber of the Hall of the Mountain King.
A passage continues west and up here.
#31
<$$<
#32
You can't get by the snake.
#33
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
#34
You are in a jumble of rock, with cracks everywhere.
#35
You're at a low window overlooking a huge pit, which extends up out of
sight. A floor is indistinctly visible over 50 feet below. Traces of
white mist cover the floor of the pit, becoming thicker to the right.
Marks in the dust around the window would seem to indicate that
someone has been here recently. Directly across the pit from you and
25 feet away there is a similar window looking into a lighted room. A
shadowy figure can be seen there peering back at you.
#36
You are in a dirty broken passage. To the east is a crawl. To the
west is a large passage. Above you is a hole to another passage.
#37
You are on the brink of a small clean climbable pit. A crawl leads
west.
#38
You are in the bottom of a small pit with a little stream, which
enters and exits through tiny slits.
#39
You are in a large room full of dusty rocks. There is a big hole in
the floor. There are cracks everywhere, and a passage leading east.
#40
You have crawled through a very low wide passage parallel to and north
of the Hall of Mists.
#41
You are at the west end of Hall of Mists. A low wide crawl continues
west and another goes north. To the south is a little passage 6 feet
off the floor.
#42
You are in a maze of twisty little passages, all alike.
#43
You are in a maze of twisty little passages, all alike.
#44
You are in a maze of twisty little passages, all alike.
#45
You are in a maze of twisty little passages, all alike.
#46
Dead end.
#47
Dead end.
#48
Dead end.
#49
You are in a maze of twisty little passages, all alike.
#50
You are in a maze of twisty little passages, all alike.
#51
You are in a maze of twisty little passages, all alike.
#52
You are in a maze of twisty little passages, all alike.
#53
You are in a maze of twisty little passages, all alike.
#54
Dead end.
#55
You are in a maze of twisty little passages, all alike.
#56
Dead end.
#57
You are on the brink of a thirty foot pit with a massive orange column
down one wall. You could climb down here but you could not get back
up. The maze continues at this level.
#58
Dead end.
#59
You have crawled through a very low wide passage parallel to and north
of the Hall of Mists.
#60
You are at the east end of a very long hall apparently without side
chambers. In the south wall are several wide cracks and a high
hole, but the hole is far above your head. To the east a wide
crawl slants up. To the north a round two foot hole slants down.
#61
You are at the west end of a very long featureless hall. The hall
joins up with a narrow north/south passage.
#62
You are at a crossover of a high N/S passage and a low E/W one.
#63
Dead end.
#64
You are at a complex junction. A low hands and knees passage from the
north joins a higher crawl from the east to make a walking passage
going west. There is also a large room above. The air is damp here.
#65
You are in Bedquilt, a long east/west passage with holes everywhere.
To explore at random select north, south, up, or down.
#66
You are in a room whose walls resemble swiss cheese. Obvious passages
go west, east, NE, and NW. Part of the room is occupied by a large
bedrock block.
#67
You are at the east end of the Twopit Room. The floor here is
littered with thin rock slabs, which make it easy to descend the pits.
There is a path here bypassing the pits to connect passages from east
and west. There are holes all over, but the only big one is on the
wall directly over the west pit where you can't get to it.
#68
You are in a large low circular chamber whose floor is an immense slab
fallen from the ceiling (Slab Room). East and west there once were
large passages, but they are now filled with boulders. Low small
passages go north and south, and the south one quickly bends west
around the boulders.
#69
You are in a secret N/S canyon above a large room.
#70
You are in a secret N/S canyon above a sizable passage.
#71
You are in a secret canyon at a junction of three canyons, bearing
north, south, and SE. The north one is as tall as the other two
combined.
#72
You are in a large low room. Crawls lead north, NE, and SW.
#73
Dead end crawl.
#74
You are in a secret canyon which here runs E/W. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able
to get back up.
#75
You are at a wide place in a very tight N/S canyon.
#76
The canyon here becomes too tight to go further south.
#77
You are in a tall E/W canyon. A low tight crawl goes 3 feet north and
seems to open up.
#78
The canyon runs into a mass of boulders -- dead end.
#79
The stream flows out through a pair of 1 foot diameter sewer pipes.
It would be advisable to use the exit.
#80
You are in a maze of twisty little passages, all alike.
#81
Dead end.
#82
Dead end.
#83
You are in a maze of twisty little passages, all alike.
#84
You are in a maze of twisty little passages, all alike.
#85
Dead end.
#86
Dead end.
#87
You are in a maze of twisty little passages, all alike.
#88
You are in a long, narrow corridor stretching out of sight to the
west. At the eastern end is a hole through which you can see a
profusion of leaves.
#89
There is nothing here to climb. Use "up" or "out" to leave the pit.
#90
You have climbed up the plant and out of the pit.
#91
You are at the top of a steep incline above a large room. You could
climb down here, but you would not be able to climb up. There is a
passage leading back to the north.
#92
You are in the Giant Room. The ceiling here is too high up for your
lamp to show it. Cavernous passages lead east, north, and south. On
the west wall is scrawled the inscription, "FEE FIE FOE FOO" [sic].
#93
The passage here is blocked by a recent cave-in.
#94
You are at one end of an immense north/south passage.
#95
You are in a magnificent cavern with a rushing stream, which cascades
over a sparkling waterfall into a roaring whirlpool which disappears
through a hole in the floor. Passages exit to the south and west.
#96
You are in the Soft Room. The walls are covered with heavy curtains,
the floor with a thick pile carpet. Moss covers the ceiling.
#97
This is the Oriental Room. Ancient oriental cave drawings cover the
walls. A gently sloping passage leads upward to the north, another
passage leads SE, and a hands and knees crawl leads east.
#98
You are following a wide path around the outer edge of a large cavern.
Far below, through a heavy white mist, strange splashing noises can be
heard. The mist rises up through a fissure in the ceiling. The path
hugs the cavern's rim to the NE and south, while another branch forks
west. A round chute with extremely smooth walls angles sharply up
to the southwest.
#99
You are in an alcove. A small NW path seems to widen after a short
distance. An extremely tight tunnel leads east. It looks like a very
tight squeeze. An eerie light can be seen at the other end.
#100
You're in a small chamber lit by an eerie green light. An extremely
narrow tunnel exits to the west, and a dark corridor leads NE.
#101
You're in the Dark-Room. A corridor leading south is the only exit.
#102
You are in an arched hall. A coral passage once continued up and east
from here, but is now blocked by debris. The air smells of sea water.
#103
You're in a large room carved out of sedimentary rock. The floor and
walls are littered with bits of shells imbedded in the stone. A
shallow passage proceeds downward, and a somewhat steeper one leads
up. A low hands and knees passage enters from the south.
#104
You are in a long sloping corridor with ragged sharp walls.
#105
You are in a cul-de-sac about eight feet across.
#106
You are in an anteroom leading to a large passage to the east. Small
passages go west and up. The remnants of recent digging are evident.
A sign in midair here says "Cave under construction beyond this point.
Proceed at own risk. [Witt Construction Company]".
#107
You are in a maze of twisty little passages, all different.
#108
You are at Witt's End. Passages lead off in *ALL* directions.
#109
You are in a north/south canyon about 25 feet across. The floor is
covered by white mist seeping in from the north. The walls extend
upward for well over 100 feet. Suspended from some unseen point far
above you, an enormous two-sided mirror is hanging parallel to and
midway between the canyon walls. (The mirror is obviously provided
for the use of the dwarves, who as you know, are extremely vain.) A
small window can be seen in either wall, some fifty feet up.
#110
You're at a low window overlooking a huge pit, which extends up out of
sight. A floor is indistinctly visible over 50 feet below. Traces of
white mist cover the floor of the pit, becoming thicker to the left.
Marks in the dust around the window would seem to indicate that
someone has been here recently. Directly across the pit from you and
25 feet away there is a similar window looking into a lighted room. A
shadowy figure can be seen there peering back at you.
#111
A large stalactite extends from the roof and almost reaches the floor
below. You could climb down it, and jump from it to the floor, but
having done so you would be unable to reach it to climb back up.
#112
You are in a little maze of twisting passages, all different.
#113
You are at the edge of a large underground reservoir. An opaque cloud
of white mist fills the room and rises rapidly upward. The lake is
fed by a stream, which tumbles out of a hole in the wall about 10 feet
overhead and splashes noisily into the water somewhere within the
mist. The indistinct shape of the opposite shore can be dimly seen
through the mist. The only passage goes back toward the south.
#114
Dead end.
#115
You are at the northeast end of an immense room, even larger than the
Giant Room. It appears to be a repository for the "ADVENTURE"
program. Massive torches far overhead bathe the room with smoky
yellow light. Scattered about you can be seen a pile of bottles (all
of them empty), a nursery of young beanstalks murmuring quietly, a bed
of oysters, a bundle of black rods with rusty stars on their ends, and
a collection of brass lanterns. Off to one side a great many dwarves
are sleeping on the floor, snoring loudly. A sign nearby reads: "Do
not disturb the dwarves!" An immense mirror is hanging against one
wall, and stretches to the other end of the room, where various other
sundry objects can be glimpsed dimly in the distance. An unoccupied
telephone booth stands against the north wall.
#116
You are at the southwest end of the repository. To one side is a pit
full of fierce green snakes. On the other side is a row of small
wicker cages, each of which contains a little sulking bird. In one
corner is a bundle of black rods with rusty marks on their ends. A
large number of velvet pillows are scattered about on the floor.
Beside one of the pillows is a large, dusty, leather-bound volume
with the title "History of Adventure" embossed in pure gold.
A vast mirror stretches off to the northeast, almost reaching the
phone booth. At your feet is a large steel grate, next to which is
a sign which reads, "Treasure Vault. Keys in Main Office."
#117
You are on one side of a large, deep chasm. A heavy white mist rising
up from below obscures all view of the far side. A SW path leads away
from the chasm into a winding corridor.
#118
You are in a long winding corridor sloping out of sight in both
directions.
#119
You are in a secret canyon which exits to the north and east.
#120
You are in a secret canyon which exits to the north and east.
#121
You are in a secret canyon which exits to the north and east.
#122
You are on the northeast side of a deep chasm. A NE path leads away
from the chasm on this side.
#123
You're in a long east/west corridor. A faint rumbling noise can be
heard in the distance.
#124
The path forks here. The left fork leads northeast. A dull rumbling
seems to get louder in that direction. The right fork leads southeast
down a gentle slope. The main corridor enters from the west.
#125
The walls are quite warm here. From the north can be heard a steady
roar, so loud that the entire cave seems to be trembling. Another
passage leads south, and a low crawl goes east.
#126
You are on the edge of a breathtaking view. Far below you is an
active volcano, from which great gouts of molten lava come surging
out, cascading back down into the depths. The glowing rock fills the
farthest reaches of the cavern with a blood-red glare, giving every-
thing an eerie, macabre appearance. The air is filled with flickering
sparks of ash and a heavy smell of brimstone. The walls are hot to
the touch, and the thundering of the volcano drowns out all other
sounds. Embedded in the jagged roof far overhead are myriad twisted
formations composed of pure white alabaster, which scatter the murky
light into sinister apparitions upon the walls. To one side is a deep
gorge, filled with a bizarre chaos of tortured rock which seems to
have been crafted by the devil himself. An immense river of fire
crashes out from the depths of the volcano, burns its way through the
gorge, and plummets into a bottomless pit far off to your left. To
the right, an immense geyser of blistering steam erupts continuously
from a barren island in the center of a sulfurous lake, which bubbles
ominously. The far right wall is aflame with an incandescence of its
own, which lends an additional infernal splendor to the already
hellish scene. A dark, foreboding passage exits to the south.
#127
You are in a small chamber filled with large boulders. The walls are
very warm, causing the air in the room to be almost stifling from the
heat. The only exit is a crawl heading west, through which is coming
a low rumbling.
#128
You are walking along a gently sloping north/south passage lined with
oddly shaped limestone formations.
#129
You are standing at the entrance to a large, barren room. A sign
posted above the entrance reads: "Caution! Bear in room!"
#130
You are inside a barren room. The center of the room is completely
empty except for some dust. Marks in the dust lead away toward the
far end of the room. The only exit is the way you came in.
#131
You are in a maze of twisting little passages, all different.
#132
You are in a little maze of twisty passages, all different.
#133
You are in a twisting maze of little passages, all different.
#134
You are in a twisting little maze of passages, all different.
#135
You are in a twisty little maze of passages, all different.
#136
You are in a twisty maze of little passages, all different.
#137
You are in a little twisty maze of passages, all different.
#138
You are in a maze of little twisting passages, all different.
#139
You are in a maze of little twisty passages, all different.
#140
Dead end.
#141
You are on a narrow promontory at the foot of a waterfall, which
spurts from an overhead hole in the rock wall and splashes into a
large reservoir, sending up clouds of mist and spray.
Through the thick white mist looms a polished marble slab, to
which is affixed an enormous rusty iron anvil. In golden letters
are written the words: "Whoso Pulleth Out This Sword of This
Stone and Anvil, is Right wise King-Born of All This Mountain."
There is a narrow chimney on the east side of the promontory.
#142
You are on a narrow shelf above and east of the top of a very steep
chimney. A long smooth granite slide curves down out of sight
to the east. If you go down the slide, you may not be able to
climb back up.
#143
You are in the private chamber of the Mountain King. Hewn into the
solid rock of the east wall of the chamber is an intricately-wrought
throne of elvish design. There is an exit to the west.
#144
You are on the east side of the throne room. On the arm of the throne
has been hung a sign which reads "Gone for the day: visiting
sick snake. --M.K."
#145
You are dragged down, down, into the depths of the whirlpool.
Just as you can no longer hold your breath, you are shot out over
a waterfall into the shallow end of a large reservoir. Gasping
and sputtering, you crawl weakly towards the shore....
#146
You are in dense forest, with a hill to one side. The trees appear
to thin out towards the north and east.
#147
You are at the high point of a wide grassy knoll, partially surrounded
by dense forest. The land rises to the south and east, and drops off
sharply to the north and west. The air smells of sea water.
#148
You are at the edge of a trackless salt marsh. Tall reeds obscure
the view.
#149
You're in salt marsh.
#150
You're in salty marsh.
#151
You are in salt marsh.
#152
Dead end.
#153
You're on a sandy beach at the edge of the open sea. The beach
ends a short distance south and the land rises to a point. To
the north, the beach ends cliffs and broken rocks.
#154
You are at a jumble of large broken rocks. A gentle path leads up
to the top of the nearby cliffs. A narrow treacherous path
disappears among the rocks at the foot of the cliff.
#155
You are on a high cliff overlooking the sea. Far below the
rolling breakers smash into a jumble of large broken rocks.
The thunder of the surf is deafening.
#156
You're at the bottom of the cliff, smashed to smithereens by the
pounding surf.
#157
You are at Thunder Hole, a funnel shaped cavern opening onto the sea.
The noise of the surf pounding against the outer rocks of the cave is
amplified by the peculiar shape of the cave, causing a thunder-like
booming sound to reverberate throughout the cave. Outside, a narrow
path leads south towards some large rocks.
#158
You are at the top of some arched steps. On one side is a blank wall
with a tiny door at the base and a shelf overhead. On the other side
a westward passage leads to the sea.
#159
You are in a low cramped chamber at the back of a small cave.
There is a shelf in the rock wall at about the height of your
shoulder.
#160
You are on a wide ledge, bounded on one side by a rock wall,
and on the other by a sheer cliff. The only way past is through
a large wrought-iron door.
#161
You feel dizzy...Everything around you is spinning, expanding,
growing larger.... Dear me! Is the cave bigger or are you smaller?
#162
You are again overcome by a sickening vertigo, but this time
everything around you is shrinking...Shrinking...
#163
You are again overcome by a sickening vertigo, but this time
everything is shrinking... I mean, you are growing. This is
terribly confusing!
#164
You feel dizzy...Everything around you is spinning, expanding,
growing larger....
#165
You're at the bottom of the cliff with a broken neck.
#166
You are at the western tip of the Blue Grotto. A large lake almost
covers the cavern floor, except for where you are standing. Small
holes high in the rock wall to the east admit a dim light. The
reflection of the light from the water suffuses the cavern with
a hazy bluish glow.
#167
You are on the shore of an underground sea. A high wooden
structure of vast proportions extends out into the water to the
east. The way west is through a wrought-iron door.
#168
You are on the eastern shore of the Blue Grotto. An ascending
tunnel disappears into the darkness to the SE.
#169
You are at a high rock on the NE side of a watery chamber at the mouth
of a small brook. An unknown gas bubbles up through the water from
the chamber floor. A bluish light can be seen to the southwest.
#170
You are in a windy tunnel between two large rooms.
#171
You are in the Bat Cave. The walls and ceiling are covered with
sleeping bats. The floor is buried by a mass of dry, foul-smelling
guano. The stench is overpowering. Exits to the NW and east.
#172
You are in a very tight N/S crack. The passage seems to widen to
the south.
#173
You are in a very tight N/S crack. The passage south is blocked
by a recent cave-in.
#174
You're in the Cloakroom. This is where the dreaded Wumpus repairs
to sleep off heavy meals. (Adventurers are his favorite dinner!)
Two very narrow passages exit NW and NE.
#175
You're in a room containing several small climbable pits. Passages
exit to the east and north.
#176
You are at the bottom of a small featureless pit.
#177
You are at a high hole in a rock wall.
#178
The NE passage is blocked by a recent cave-in.
#179
You are in a sloping muddy defile, next to a tumbling brook.
#180
You are in a level E/W passage partially blocked by an overhanging
tongue of rock. A steep scramble would take you up over the tongue,
whence continues an upward crawl.
#181
The dog won't let you pass.
#182
You're in the Upper Passage, a long level E/W tunnel.
#183
You are in a star-shaped chamber. Passages exit north, east, south,
and west.
#184
You are at an elbow in a winding E/W passage.
#185
Dead end.
#186
You're at the intersection of two long tunnels. One goes NW,
the other NE.
#187
You're in a long narrow east-west passage which curves out of sight
at both ends.
#188
You're in the Rotunda. Corridors radiate in all directions.
There is a telephone booth standing against the north wall.
#189
You are standing in a telephone booth at the side of a large chamber.
Hung on the wall is a banged-up pay telephone of ancient design.
#190
You're at the Devil's Chair, a large crystallization shaped like a
seat, at the edge of a black abyss. You can't see the bottom.
An upward path leads away from the abyss.
#191
You're in a dead-end crack.
#192
You're on a small gravel beach at the south wall of the Blue Grotto.
A gravelly path leads east.
#193
You are in the Flower Room. The walls are covered with colorful,
intricate, flowerlike patterns of crystallized gypsum. A hole leads
to the west.
#194
You are at the end of a short E/W corridor.
#195
You are looking west from the end of a short E/W corridor. At your
feet is a pile of loose rubble. On your left is a hole into another
chamber.
#196
You are in an arched hall. The remnants of a now-plugged coral
passage lie to the east. The north wall has partially crumbled,
exposing a large connecting hole to another room.
#197
You're in the Vestibule, a short east-west passage between two rooms.
#198
You are in the Fairy Grotto. All around you innumerable stalactites,
arranged in immense colonnades, form elegant arches. On every side
you hear the dripping of water, like the footsteps of a thousand
fairies. A small stream runs from the SW corner. A bright glow
emanates from the south side of the grotto, and a steep passage
descends to the east.
#199
You have approached the lower end of a steep passage, but it is
just too cold here to hang around, and you aren't properly equipped
to continue. With teeth chattering, you climb back up....
#200
You are in the Crystal Palace. An overhead vein of phosphorescent
quartz casts a luminous glow which is reflected by countless chips of
mica embedded in both walls, which consist of some sort of highly
reflective glass, apparently of volcanic origin. A winding path
of yellow sandstone leads west and rises steeply to the east.
#201
You are following a yellow sandstone path. There is a glow
to the west.
#202
You are in a very tall chamber whose walls are comprised of many
different rock strata. Layers of red and yellow sandstone
intertwine with bright bands of calcareous limestone in a rainbow-
like profusion of color. The rainbow effect is so real, you
are almost tempted to look for a pot of gold! Poised far over
your head, a gigantic slab, wedged tightly between the north and
south walls, forms a natural bridge across the roof of the chamber.
A trail leads east and west.
#203
You're in a steeply sloping passage. It is very cold here.
#204
You are in the Hall of Ice, in the deepest part of the caverns.
During winter, frigid outside air settles here, making this room
extremely cold all year round. The walls and ceilings are covered
with a thick coating of ice. An upward passage exits to the west.
#205
You are standing on a natural bridge far above the floor of a circular
chamber whose walls are a rainbow of multicolored rock. The bridge
was formed eons ago by a huge slab which fell from the ceiling and
is now jammed between the north and south walls of the chamber.
#206
You are in a low, wide room below another chamber. A small green
pond fills the center of the room. The lake is apparently spring
fed. A small stream exits through a narrow passage to the north.
A larger passage continues west.
#207
You are in a tight north/south crawl through a stratum of red
colored rock. The air is damp with mist.
#208
You are in a tall canyon on the south side of a swift, wide river.
Written in the mud in crude letters are the words: "You Have Found
Lost River." A wide path leads east and west along the bank. A tight
crawl way would take you south out of the canyon.
#209
You are standing on a large flat rock table at the western end of
Lost River Canyon. Beneath your feet, the river disappears amidst
foam and spray into a large sinkhole. A gentle path leads east
along the river's south shore. Another leads sharply upward along
the river's north side.
#210
You are at a niche in the canyon wall, far above a raging river.
The air is filled with mist and spray, making it difficult to see
ahead. A downward sloping ledge narrows to the east. The path
to the west is easier.
#211
The ledge is growing very narrow and treacherous, and falls off almost
vertically. You could go down, but you won't be able to climb back.
#212
You are standing in a telephone booth at the side of the Repository.
#213
You're at the east end of a level passage at a hole in the floor.
#214
You're at the north edge of a dark cove.
#215
You are in a dry granite basin, worn smooth eons ago by water
swirling down from a now-dry spillway.
#216
You're in a dry spillway east of and above a smooth rock basin.
#217
You are in the Winery, a cool dark room which extends some
distance off to the east.
#218
You are to the east of the Winery, where the room ends in a thicket
of high, sharp, pointed, climbable limestone pinnacles. There is a
narrow ledge just above the top of the spires. If you go up, it
might be difficult to get back down.
#219
You are in a high-vaulted cavern whose roof rises over fifty
meters to culminate in a series of pointed arches directly over
your head. There are also two low arches to either side, forming
side portals. The whole effect is that of a gothic cathedral.
You can proceed north, south, east, or west.
#220
You're at the east portal of the Gothic Cathedral. The path leads
east and west.
#221
You're at the west portal of the Gothic Cathedral.
#222
You are at the foot of the Altar, an immense, broad stalagmite.
An opening leads south.
#223
You're on top of an enormous, broad stalagmite. There is a hole
in the ceiling overhead.
#224
You are in a room the size and shape of a small crypt. A narrow
cut exits east. There is a hole in the floor.
#225
You are in the Gothic Chapel, a small chamber adjoining the Gothic
Cathedral. A path leads west.
#226
You are on the floor of the Rainbow Room. In fact, you are spread
*ALL OVER* the floor of the Rainbow Room.
#227
You are in a dimly lit passage behind Thunder Hole. Etched into
the rock wall are the ominous words:
* "You are approaching the River Styx. *
* Laciate Ogni Speranza Voi Ch'Entrate." *
#228
You are at the River Styx, a narrow little stream cutting directly
across the passageway. The edge of the stream is littered with sticks
and other debris washed in by a recent rainfall. On the far side
of the river, the passage continues east.
#229
You're on the east side of the river's sticks.
#230
You are on a ledge at the northern end of a long N/S crawl. The
ledge is above a large number of sharp vertical limestone spires.
An attempt to climb down could be dangerous, if you get my *point*!
#231
You are very neatly skewered on the point of a sharp rock.
#232
You have poled your boat across the calm water.
#233
You have poled your boat across the dark water.
#234
You have poled your boat across the Blue Grotto.
#235
You're at Dante's Rest, on the north side of a yawning dark chasm.
A passage continues west along the chasm's edge.
#236
You are at the east end of a river bank path in Lost River Canyon.
#237
The staircase is now unclimbable.
#238
You're in the caretaker's pantry.
#239
You are on a small rise overlooking a beautiful bay. In the center
of the bay is the castle of the elves.
#240
You are on the highest pinnacle of the castle in the bay.
Steps lead down into the garden.
#241
You are in the outer courtyard of the garden of the elves.
Steps lead up to the tower, and to the west, separating you
from the inner courtyard, is a maze of hedges, living things,
but almost crystalline in their multicolored splendor.
#242
From the inside the maze looks like a kaleidoscope, with
swatches of color dancing as you move. In this part the colors
are produced by shining red berries on the branches.
#243
You are surrounded by a tall hedge with sharp iridescent leaves
and metallic orange flowers.
#244
You are in the center of the living maze. The plants here are
dormant this season, but still carry brilliant yellow leaves.
#245
Unlike the other areas of the hedge system, this area seems to
have no metallic gleam; nevertheless it is still breathtaking.
The trees and bushes are all variegated shades of green, the
evergreens being a rich dark shade while the seasonal bushes
are a lighter yellowish green, making a startling contrast.
#246
You are near the edge of the maze. You sample the blueberries
on the bushes. They are delicious.
#247
You are at the western end of the living maze. Beside the
shrubs forming the walls are tastefully planted beds of
violets and brilliant purple pansies.
To the west is the inner garden.
#248
You are in the inner garden of the elves. In the center is
a living tree, with shimmering silvery bark, glistening metallic
green leaves, and flowers ripe with nectar. As the nectar falls
to the ground it forms droplets of silver. Around the tree is
a hedge of briars which cannot be crossed. Unfortunately for
adventurers such as you, most of the nectar falls inside the hedge.
The exit is to the east.

View file

@ -1,514 +0,0 @@
#1
You're at end of road again.
#2
You're at hill in road.
#3
You're inside building.
#4
You're in valley.
#5
You're in forest.
#6
You're in forest.
#7
You're at slit in streambed.
#8
You're outside grate.
#9
You're below the grate.
#10
You're in cobble crawl.
#11
You're in Debris Room.
#12
You are in an awkward sloping east/west canyon.
#13
You're in Bird Chamber.
#14
You're at top of small pit.
#15
You're in Hall of Mists.
#16
The crack is far too small for you to follow.
#17
You're on east bank of fissure.
#18
You're in Nugget of Gold Room.
#19
You're in Hall of Mt King.
#20
You are at the bottom of the pit with a broken neck.
#21
You didn't make it.
#22
The dome is unclimbable.
#23
You're at west end of Twopit Room.
#24
You're in east pit.
#25
You're in west pit.
#26
You clamber up the plant and scurry through the hole at the top.
#27
You are on the west side of the fissure in the Hall of Mists.
#28
You are in a low N/S passage at a hole in the floor. The hole goes
down to an E/W passage.
#29
You are in the South Side Chamber.
#30
You are in the West Side Chamber of the Hall of the Mountain King.
#31
<$$<
#32
You can't get by the snake.
#33
You're at "Y2".
#34
You are in a jumble of rock, with cracks everywhere.
#35
You're at window on pit.
#36
You're in dirty passage.
#37
You are on the brink of a small clean climbable pit.
#38
You are in the bottom of a small pit with a little stream.
#39
You're in dusty rock room.
#40
You have crawled through a very low wide passage parallel.
#41
You're at west end of Hall of Mists.
#42
You are in a maze of twisty little passages, all alike.
#43
You are in a maze of twisty little passages, all alike.
#44
You are in a maze of twisty little passages, all alike.
#45
You are in a maze of twisty little passages, all alike.
#46
Dead end.
#47
Dead end.
#48
Dead end.
#49
You are in a maze of twisty little passages, all alike.
#50
You are in a maze of twisty little passages, all alike.
#51
You are in a maze of twisty little passages, all alike.
#52
You are in a maze of twisty little passages, all alike.
#53
You are in a maze of twisty little passages, all alike.
#54
Dead end.
#55
You are in a maze of twisty little passages, all alike.
#56
Dead end.
#57
You're at brink of pit.
#58
Dead end.
#59
You have crawled through a very low wide passage.
#60
You're at east end of Long Hall.
#61
You're at west end of Long Hall.
#62
You are at a crossover of a high N/S passage and a low E/W one.
#63
Dead end.
#64
You're at Complex Junction.
#65
You are in Bedquilt.
#66
You're in Swiss Cheese Room.
#67
You're at east end of Twopit Room.
#68
You're in Slab Room.
#69
You are in a secret N/S canyon above a large room.
#70
You are in a secret N/S canyon above a sizable passage.
#71
You're at junction of three secret canyons.
#72
You are in a large low room. Crawls lead north, NE, and SW.
#73
Dead end crawl.
#74
You're in secret E/W canyon above tight canyon.
#75
You are at a wide place in a very tight N/S canyon.
#76
The canyon here becomes too tight to go further south.
#77
You are in a tall E/W canyon.
#78
The canyon runs into a mass of boulders -- dead end.
#79
The stream flows out through a pair of 1 foot diameter sewer pipes.
#80
You are in a maze of twisty little passages, all alike.
#81
Dead end.
#82
Dead end.
#83
You are in a maze of twisty little passages, all alike.
#84
You are in a maze of twisty little passages, all alike.
#85
Dead end.
#86
Dead end.
#87
You are in a maze of twisty little passages, all alike.
#88
You're in narrow corridor.
#89
There is nothing here to climb. Use "up" or "out" to leave the pit.
#90
You have climbed up the plant and out of the pit.
#91
You're at steep incline above large room.
#92
You're in Giant Room.
#93
The passage here is blocked by a recent cave-in.
#94
You are at one end of an immense north/south passage.
#95
You're in cavern with waterfall.
#96
You're in Soft Room.
#97
You're in Oriental Room.
#98
You're in Misty Cavern.
#99
You're in Alcove.
#100
You're in Plover Room.
#101
You're in Dark-Room.
#102
You're in Arched Hall.
#103
You're in Shell Room.
#104
You are in a long sloping corridor with ragged sharp walls.
#105
You are in a cul-de-sac about eight feet across.
#106
You're in Anteroom.
#107
You are in a maze of twisty little passages, all different.
#108
You're at Witt's End.
#109
You're in Mirror Canyon.
#110
You're at window on pit.
#111
You're at top of stalactite.
#112
You are in a little maze of twisting passages, all different.
#113
You're at Reservoir.
#114
Dead end.
#115
You're at NE end.
#116
You're at SW end.
#117
You're on SW side of chasm.
#118
You're in sloping corridor.
#119
You are in a secret canyon which exits to the north and east.
#120
You are in a secret canyon which exits to the north and east.
#121
You are in a secret canyon which exits to the north and east.
#122
You're on NE side of chasm.
#123
You're in corridor.
#124
You're at fork in path.
#125
You're at junction with warm walls.
#126
You're at breath-taking view.
#127
You're in Chamber of Boulders.
#128
You're in Limestone Passage.
#129
You're in front of Barren Room.
#130
You're in Barren Room.
#131
You are in a maze of twisting little passages, all different.
#132
You are in a little maze of twisty passages, all different.
#133
You are in a twisting maze of little passages, all different.
#134
You are in a twisting little maze of passages, all different.
#135
You are in a twisty little maze of passages, all different.
#136
You are in a twisty maze of little passages, all different.
#137
You are in a little twisty maze of passages, all different.
#138
You are in a maze of little twisting passages, all different.
#139
You are in a maze of little twisty passages, all different.
#140
Dead end.
#141
You're at Sword Point.
#142
You're at top of slide.
#143
You're at entrance to Throne Room.
#144
You're on east side of Throne Room.
#145
<$$<
#146
You're in forest.
#147
You're on grassy knoll.
#148
You are at the edge of a trackless salt marsh. Tall reeds obscure
the view.
#149
You're in salt marsh.
#150
You're in salty marsh.
#151
You are in salt marsh.
#152
Dead end.
#153
You're on sandy beach.
#154
You're at broken rocks.
#155
You're at Ocean Vista.
#156
You're at the bottom of the cliff.
#157
You're at Thunder Hole.
#158
You're at top of steps in back of Thunder Hole.
#159
You're in cramped chamber.
#160
You're at ledge by wrought-iron door.
#161
You feel dizzy...Everything around you is spinning, expanding,
growing larger.... Dear me! Is the cave bigger or are you smaller?
#162
You are again overcome by a sickening vertigo, but this time
everything around you is shrinking...Shrinking...
#163
You are again overcome by a sickening vertigo, but this time
everything is shrinking... I mean, you are growing. This is
terribly confusing!
#164
You feel dizzy...Everything around you is spinning, expanding,
growing larger....
#165
You're at the bottom of the cliff with a broken neck.
#166
You're at west wall of Blue Grotto.
#167
You're at underground sea.
#168
You're on east side of the Blue Grotto.
#169
You're in Bubble Chamber.
#170
You are in a windy tunnel between two large rooms.
#171
You're in Bat Cave.
#172
You are in a very tight N/S crack.
#173
You are in a very tight N/S crack.
#174
You're in the Cloakroom.
#175
You're in a room containing several small climbable pits.
#176
You are at the bottom of a small featureless pit.
#177
You are at a high hole in a rock wall.
#178
The NE passage is blocked by a recent cave-in.
#179
You are in a sloping muddy defile, next to a tumbling brook.
#180
You're at Tongue of Rock.
#181
The dog won't let you pass.
#182
You're in the Upper Passage, a long level E/W tunnel.
#183
You're in Star Chamber.
#184
You are at an elbow in a winding E/W passage.
#185
Dead end.
#186
You're at the intersection of two long tunnels.
#187
You're in a long narrow east-west passage.
#188
You're in Rotunda.
#189
You're in phone booth.
#190
You're at Devil's Chair.
#191
You're in a dead-end crack.
#192
You're on gravel beach.
#193
You're in Flower Room.
#194
You are at east end of short E/W corridor.
#195
You are at east end of short E/W corridor.
#196
You're in Arched Hall.
#197
You're in the Vestibule, a short east-west passage between two rooms.
#198
You're in the Fairy Grotto.
#199
You have approached the lower end of a steep passage.
#200
You're in the Crystal Palace.
#201
You are following a yellow sandstone path.
#202
You're in the Rainbow Room.
#203
You're in a steeply sloping passage. It is very cold here.
#204
You're in the Hall of Ice.
#205
You are over the Rainbow (Room).
#206
You're in Green Lake Room.
#207
You're in red rock crawl.
#208
You're on south side of Lost River Canyon.
#209
You're at end of Lost River Canyon.
#210
You're at niche in ledge above Lost River.
#211
A very narrow and treacherous ledge.
#212
You're in phone booth.
#213
You're at the east end of a level passage at a hole in the floor.
#214
You're in dark cove.
#215
You're in dry basin.
#216
You're in old spillway.
#217
You're in the Winery.
#218
You're at limestone pinnacles.
#219
You're in Gothic Cathedral.
#220
You're at the east portal of the Gothic Cathedral.
#221
You're at the west portal of the Gothic Cathedral.
#222
You are at the foot of the Altar, an immense, broad stalagmite.
#223
You're on top of stalagmite.
#224
You're in the Crypt.
#225
You're in Gothic Chapel.
#226
You are on the floor of the Rainbow Room.
#227
You are at approach to River Styx.
#228
You're at the River Styx.
#229
You're on the east side of the river's sticks.
#230
You're on ledge above limestone pinnacles.
#231
You are very neatly skewered on the point of a sharp rock.
#232
You have poled your boat across the calm water.
#233
You have poled your boat across the dark water.
#234
You have poled your boat across the Blue Grotto.
#235
You're at Dante's Rest.
#236
You're at east end of Lost River Canyon.
#237
The staircase is now unclimbable.
#238
You're in the caretaker's pantry.
#239
You're on a small rise over the bay.
#240
You are on the highest pinnacle of the castle in the bay.
Steps lead down into the garden.
#241
You are in the outer courtyard of the elves.
#242
You are in the living maze. There are red berries here.
#243
You are surrounded by a tall hedge with sharp iridescent leaves
and metallic orange flowers.
#244
You are in the center of the living maze. The plants here are
dormant this season, but still carry brilliant yellow leaves.
#245
Unlike the other areas of the hedge system, this area seems to
have no metallic gleam; nevertheless it is still breathtaking.
The trees and bushes are all variegated shades of green, the
evergreens being a rich dark shade while the seasonal bushes
are a lighter yellowish green, making a startling contrast.
#246
You are near the edge of the maze. You sample the blueberries
on the bushes. They are delicious.
#247
You are at the western end of the living maze. Beside the
shrubs forming the walls are tastefully planted beds of
violets and brilliant purple pansies.
To the west is the inner garden.
#248
You're in the inner courtyard of the elves.

View file

@ -1,539 +0,0 @@
#1
#2
/Brass lantern
/There is a shiny brass lamp nearby.
/There is a lamp shining nearby.
/
#3
/*Grate
/The grate is locked.
/The grate is open.
/
#4
/Wicker cage
/There is a small wicker cage discarded nearby.
/
#5
/Black rod
/A three foot black rod with a rusty star on an end lies nearby.
/
#6
/Black rod
/A three foot black rod with a rusty mark on an end lies nearby.
/
#7
/*Steps
/Rough stone steps lead down the pit.
/Rough stone steps lead up the dome.
/
#8
#9
/Wooden pole
/A wooden pole is lying nearby.
/A wooden pole has been stuck in the mud here.
/
#10
/Velvet pillow
/A small velvet pillow lies on the floor.
/
#11
/*Snake
/A huge green fierce snake bars the way!
/<$$< (Chased away)
/
#12
/*Fissure
/<$$<
/A crystal bridge now spans the fissure.
/The crystal bridge has vanished!
/
#13
/*Stone tablet
/A massive stone tablet imbedded in the wall reads:
"Congratulations on bringing light into the Dark-Room!"
/
#14
/Giant clam >grunt!<
/There is an enormous clam here with its shell tightly closed.
/
#15
/Giant oyster >groan!<
/There is an enormous oyster here with its shell tightly closed.
/Interesting. There seems to be something written on the underside of
the oyster.
/
#16
/"Spelunker Today"
/There are a few recent issues of "Spelunker Today" magazine here.
/
#17
#18
#19
/Tasty food
/There is food here.
/
#20
/Small bottle
/There is a small bottle here.
/There is an empty bottle here.
/There is a small bottle here.
/There is a broken bottle here.
/There is a small bottle here.
/
#21
/*Chasm - troll bridge
/A rickety wooden bridge extends across the chasm, vanishing into the
mist. A sign posted on the bridge reads, "Stop! Pay troll!"
/The wreckage of a bridge (and a dead bear) can be seen at the bottom
of the chasm.
/
#22
/*Chasm2 & decrepit natural bridge
/A decrepit natural bridge spans the chasm. A message scrawled into
the rock wall reads: "Bridge out of repair. Maximum load: 35 Foonts."
/The remnants of a natural bridge partially overhang the chasm.
/
#23
/*Mirror
/<$$<
/
#24
/*plant
/There is a tiny little plant in the pit, murmuring "Water, water, ..."
/The plant spurts into furious growth for a few seconds.
/There is a 12-foot-tall beanstalk stretching up out of the pit,
bellowing "Water!! Water!!"
/The plant grows explosively, almost filling the bottom of the pit.
/There is a gigantic beanstalk stretching all the way up to the hole.
/You've over-watered the plant! It's shriveling up! It's, it's...
/
#25
/*Phony plant (seen in twopit room only when tall enough)
/<$$<
/The top of a 12-foot-tall beanstalk is poking out of the west pit.
/There is a huge beanstalk growing out of the west pit up to the hole.
/
#26
/*Stalactite
/<$$<
/
#27
/*shadowy figure
/The shadowy figure seems to be trying to attract your attention.
/
#28
/Dwarf's axe
/There is a little axe here.
/There is a little axe lying beside the bear.
/There is a little axe lying beside the Wumpus.
/There is a little axe lying beside the dog.
/
#29
/*Cave drawings
/<$$<
/
#30
/*pirate
/<$$<
/
#31
/*dragon
/A huge green fierce dragon bars the way!
/Congratulations! You have just vanquished a dragon with your bare
hands! (Unbelievable, isn't it?)
/The body of a huge green dead dragon is lying off to one side.
/
#32
#33
/*Troll
/A burly troll stands by the bridge and insists you throw him a
treasure before you may cross.
/The troll steps out from beneath the bridge and blocks your way.
/<$$< (Chased away)
/
#34
/*phony troll
/The troll is nowhere to be seen.
/
#35
/<$$< (Bear uses rtext 141)
/There is a ferocious cave bear eying you from the far end of the room!
/There is a gentle cave bear sitting placidly in one corner.
/There is a contented-looking bear wandering about nearby.
/<$$< (Dead)
/
#36
/*Message in second maze
/There is a message scrawled in the dust in a flowery script, reading:
"This is not the maze where the pirate leaves his treasure chest."
/
#37
/*Volcano and/or geyser
/<$$<
/
#38
/*Vending machine
/There is a massive vending machine here. The instructions on it
read: "Insert coins to receive fresh batteries."
/There is a massive vending machine here.
/
#39
/Batteries
/There are fresh batteries here.
/Some worn-out batteries have been discarded nearby.
/Some worn-out batteries have been discarded nearby.
/
#40
/*Carpet and/or moss
/<$$<
/
#41
/*Rusty door
/The way north is barred by a massive, rusty, iron door.
/The way north leads through a massive, rusty, iron door.
/
#42
/*Tiny door
/The only way past the wall is through a tiny locked door.
/The only way past the wall is through a tiny open door.
/
#43
/*Tiny door-2
/The door is locked.
/The door is open.
/
#44
/*Phone booth door
/<$$<
/
#45
#46
/Beautiful flowers
/There are some beautiful flowers here!
/On the other side of the room a swarm of bees eagerly buzzes over
a bunch of fresh flowers.
/
#47
/Silken cloak
/There is a silken cloak here!
/<$$< (wearing cloak)
/A lovely silken cloak lies partially buried under a pile of
loose rocks.
/
#48
/Wooden boat
/There is a small wooden boat here.
/You are in a wooden boat.
/
#49
/*Sticks at Styx
/<$$<
/
#50
/Large gold nugget
/There is a large sparkling nugget of gold here!
/
#51
/Several diamonds
/There are diamonds here!
/
#52
/Silver horn
/There is a silver horn here!
/
#53
/Precious jewelry
/There is precious jewelry here!
/<$$< (wearing jewelry)
/
#54
/Rare coins
/There are many coins here!
/
#55
/Treasure chest
/The pirate's treasure chest is here!
/
#56
/Golden eggs
/There is a large nest here, full of golden eggs!
/The nest of golden eggs has vanished!
/Done!
/
#57
/Jeweled trident
/There is a jewel-encrusted trident here!
/
#58
/Ming vase
/There is a delicate, precious, ming vase here!
/The vase is now resting, delicately, on a velvet pillow.
/The floor is littered with worthless shards of pottery.
/The ming vase drops with a delicate crash.
/
#59
/Egg-sized emerald
/There is an emerald here the size of a plover's egg!
/
#60
/Platinum pyramid
/There is a platinum pyramid here, 8 inches on a side!
/
#61
/Glistening pearl
/Off to one side lies a glistening pearl!
/
#62
/Persian rug
/There is a persian rug spread out on the floor!
/The dragon is sprawled out on a persian rug!!
/
#63
/Rare spices
/There are rare spices here!
/
#64
/Golden chain
/There is a golden chain lying in a heap on the floor!
/The bear is locked to the wall with a golden chain!
/There is a golden chain locked to the wall!
/
#65
/Gleaming sword
/There is a gleaming sword here!
/A gleaming sword is stuck into the anvil!
/You grasp the sword's handle and give a mighty heave, but with a
loud clang the sword blade shatters into several fragments.
/Rusty shards of a elven sword lie scattered about.
/A very clean sword is stuck into the anvil!
/An oily sword is stuck into the anvil.
/
#66
/Elfin crown
/An ancient crown of elfin kings lies here!
/<$$< (wearing crown)
/
#67
/Ruby slippers
/There is a pair of ruby slippers here.
/<$$< (wearing slippers)
/There is a pair of ruby slippers here.
/
#68
/Delicate lyre
/There is a delicate lyre here!
/
#69
/Star sapphire
/There is a star sapphire here!
/
#70
/Holy Grail
/There is an ornate silver chalice here!
/
#71
/Oaken cask
/There is an oaken cask here.
/There is an empty oaken cask here.
/There is an oaken cask here.
/<$$< (Unused)
/There is an oaken cask here.
/
#72
/Golden ring
/There is a small gold ring here.
/<$$< (wearing ring)
/On the Wumpus' finger is a small gold ring.
/
#73
/Four-leafed clover
/There is a four-leafed clover here!
/<$$< (wearing clover)
/
#74
/Gold tree
/There is a gold statue of a tree here.
/
#75
/Silver droplet
/There is a single droplet of silver on the ground here.
/
#76
#77
#78
#79
#80
#81
/Clear water
/
#82
/Cool water
/
#83
/Thick, black oil
/
#84
/Thick, black oil
/
#85
/Vintage wine
/
#86
/Vintage wine
/
#87
/*Bumblebees
/<$$<
/Some bumblebees are swarming around a bunch of fresh flowers.
/
#88
/*Hollow wall
/Your footsteps echo hollowly throughout the chamber.
/<$$<
/
#89
/*Wall with safe
/A steel safe is embedded in the wall.
/
#90
/Tiny brass key
/There is a tiny brass key here.
/There is a tiny brass key on the shelf.
/
#91
/*Anvil
/<$$<
/
#92
/*rocks on cloak
/<$$< (ON CLOAK)
/<$$< (AFTER ROCK SLIDE)
/
#93
/*telephone booth
/The telephone booth is empty.
The phone is ringing.
/The phone booth is occupied by a gnome. He is talking excitedly
to someone at the other end.
/The telephone booth is empty.
/<$$<
/
#94
/*Telephone
/The phone is ringing.
/The telephone is out of order.
/The telephone is out of order. It is badly dented.
/<$$<
/
#95
/Lead slugs
/There are some lead slugs here!
/
#96
/Sweet honeycomb
/There is a sweet honeycomb here!
/
#97
/*Beehive
/There is an active beehive nearby. The bees hum protectively
around the hive.
/There is an empty beehive nearby.
/
#98
/*Black dog
/A hideous black dog bares his teeth and growls at your approach.
/Nearby, a large black dog is in a deep slumber.
/
#99
/*Dreaded Wumpus
/In the corner, a Wumpus is sleeping peacefully.
/A sleepy Wumpus is ambling towards you. He wants to invite you to
dinner. He wants you to *be* the dinner!
/The Wumpus is still on your trail! And he's getting closer!!
/The Wumpus is only a few steps behind you! All this exercise is
making him veerrrrry hungry!
/The Wumpus almost has you in his grasp! You can feel his hot breath
on your neck!
/"Chomp, chomp." Crunch! Chew! Slurp! Smack! Yum!!!
/Nearby is the smashed body of a defunct Wumpus.
/
#100
#101
/Little bird in cage
/A cheerful little bird is sitting here singing.
/There is a little bird in the cage.
/
#102
/Set of keys
/There are some keys on the ground here.
/
#103
/*Fountain
/There is a fountain of sparkling vintage wine here!
/
#104
/*Bats & guano in bat-cave
/<$$<
/
#105
/*gnome in phone booth
/<$$<
/
#106
/Colored mushrooms
/There are some oddly-colored mushrooms here.
/
#107
/Tiny cakes
/There are some tiny cakes on the shelf.
/
#108
/Leather Sack
/There is a leather sack here.
/
#109
#110
/Rare book
/There is a dusty, leather-bound volume here.
/
#111
/Rare book
/There is a dusty, leather-bound volume here.
/
#112
/Steel wall-safe
/The safe door is locked.
/The safe door is open.
/
#113
/Faded poster
/Taped to the wall is a faded poster.
/There is a faded poster here.
/
#114
/Whiskbroom
/There is a small whiskbroom here.
/
#115
/*Carving on dusty rocks
/<$$<
/<$$<
/
#116
/*Billboard
/
/
#117
#118
/Small metal canister
/There is a heavy, grey, metal canister here.
/
#119
/Glowing stone
/Nearby, a strange, greenish stone is glowing brightly.
/
#120
/Quartz sphere
/There is a polished sphere of pure quartz here!
/

File diff suppressed because it is too large Load diff

View file

@ -1,141 +0,0 @@
/* program DATABASE.C */
#include <string.h>
#include <stdio.h>
#include "advent.h"
#include "advdec.h"
#include "advtext.h"
static char oline[256];
_PROTOTYPE(void rdupto, (FILE *, int, int, char *));
_PROTOTYPE(void rdskip, (FILE *, int, int));
/*
Function to scan a file up to a specified
point and either print or return a string.
*/
void rdupto(fdi, uptoc, print, string)
FILE *fdi;
int uptoc, print;
char *string;
{
int c, i;
static _CONST unsigned char key[4] = {'c' | 0x80, 'L' | 0x80,
'y' | 0x80, 'D' | 0x80};
i = 1;
while ((c = getc(fdi)) != uptoc && c != EOF) {
if (c == '\n')
i = 1;
if (c >= 0x80)
c ^= key[i++ & 3];
if (c == '\r')
continue;
if (print)
putchar(c);
else
*string++ = (char) c;
}
if (!print)
*string = '\0';
return;
}
/*
Function to read a file skipping
a given character a specified number
of times, with or without repositioning
the file.
*/
void rdskip(fdi, skipc, n)
FILE *fdi;
int skipc, n;
{
int c;
while (n--)
while ((c = getc(fdi)) != skipc)
if (c == EOF)
bug(32);
return;
}
/*
Routine to request a yes or no answer to a question.
*/
boolean yes(msg1, msg2, msg3)
int msg1, msg2, msg3;
{
char answer[INPUTBUFLEN];
if (msg1)
rspeak(msg1);
do {
switch (*ask("\n> ", answer, sizeof(answer))) {
case 'n':
case 'N':
if (msg3)
rspeak(msg3);
return (FALSE);
case 'y':
case 'Y':
if (msg2)
rspeak(msg2);
return (TRUE);
default:
fputs("Please answer Y (yes) or N (no).", stdout);
}
} while (TRUE);
}
/*
Print a location description from "advent4.txt"
*/
void rspeak(msg)
int msg;
{
if (msg == 54)
printf("ok.\n");
else {
fseek(fd4, idx4[msg - 1], 0);
rdupto(fd4, '#', 1, 0);
}
return;
}
/*
Print an item message for a given state from "advent3.txt"
*/
void pspeak(item, state)
int item, state;
{
fseek(fd3, idx3[item - 1], 0);
rdskip(fd3, '/', state + 2);
rdupto(fd3, '/', FALSE, oline);
if (strncmp(oline, "<$$<", 4) != 0)
printf("%s", oline);
return;
}
/*
Print a long location description from "advent1.txt"
*/
void desclg(loc)
int loc;
{
fseek(fd1, idx1[loc - 1], 0);
rdupto(fd1, '#', 1, 0);
return;
}
/*
Print a short location description from "advent2.txt"
*/
void descsh(loc)
int loc;
{
fseek(fd2, idx2[loc - 1], 0);
rdupto(fd2, '#', 1, 0);
return;
}

View file

@ -1,676 +0,0 @@
/* program ENGLISH.C */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "advent.h"
#include "advdec.h"
#define ALL 109
#define ENTER 3
#define CRAWL 17
#define JUMP 39
#define CLIMB 56
#define XYZZY 62
#define PLUGH 65
#define PLOVER 71
#define PHUCE 82
_PROTOTYPE(static void getwords, (void));
_PROTOTYPE(static void clrlin, (void));
_PROTOTYPE(static void doobj, (int *));
_PROTOTYPE(static boolean doiobj, (void));
_PROTOTYPE(static boolean do_scoop_up, (void));
_PROTOTYPE(static boolean check_next, (void));
static char buffer[INPUTBUFLEN] = {'\0', '\0', '\0', '\0'};
static char *txt[MAXWORDS] = {buffer, buffer, buffer, buffer};
static char *cindex = buffer;
static boolean pflag;
static int vrbkey, words[MAXWORDS] = {0, 0, 0, 0}, word, wdx = 0;
static int takdir[20] = {2, 6, 9, 10, 11, 13, 14, 17, 23, 25,
33, 34, 36, 37, 39, 78, 79, 80, 89, -1};
static int vkey[60] = {
0, 199, 9, 0, 130, 0, 197, 0, 0, 243,
0, 0, 89, 140, 0, 5, 0, 227, 0, 0,
0, 31, 42, 0, 0, 0, 0, 172, 1, 0,
0, 0, 254, 0, 69, 0, 0, 92, 0, 0,
138, 137, 149, 239, 45, 74, 183, 0, 0, 112,
241, 0, 114, 0, 30, 0, 0, 0, 0, 0
};
static int ptab[260] = {
0, 3028, 3065, 3009, -3005, 5071, 5070, 5058, -5020, 19055,
19108, 19038, 19020, 19071, 19070, 19058, 19004, 19048, 19091, 19094,
19112, 19002, 19118, 2062, 2066, 2047, 2067, 2053, 2065, -2010,
-3114, 4034, 4011, 4101, 4035, 4099, 4098, 4017, 4104, 4014,
4015, -4087, 3083, 3085, -3081, 5055, 5108, 5020, 5071, 5070,
5058, 5004, 5048, 5091, 5112, 5099, 5118, 19055, 19108, 19020,
19071, 19070, 19058, 19004, 19048, 19091, 19112, 19099,-19118, 3028,
3065, 3009, 3005, -3018, 19055, 19108, 19038, 19020, 19071, 19070,
19058, 19004, 19004, 19048, 19091, 19094, 19112, 19002,-19118, 3028,
3065, -3018, 19055, 19108, 19038, 19020, 19071, 19070, 19058, 19004,
19048, 19091, 19094, 19112, 19118, 2062, 2066, 2047, 2067, 2053,
2065, -2010, 3102, -3090, 19055, 19108, 19020, 19071, 19070, 19058,
19004, 19048, 19091, 19014, 19015, 19112, 19118, 19120, 19120, -9999,
3090, 3102, 3028, 3057, 3065, 3009, -3005,-29999, 2052, -2068,
2024, 2065, 2091, 2042, 2073, 5071, 5070, 5058, -5020, 30999,
2062, 2066, 2047, 2067, 2053, 2065, 2010, 2073, 19055, 19108,
19038, 19020, 19071, 19070, 19058, 19004, 19048, 19091, 19094, 19112,
19002,-19118, 2014, 2015, 2013, 2999, 5014, 5015, 5013, 5999,
5110, 5113, -5999, 5055, 5108, 5020, 5071, 5070, 5058, 5004,
5048, 5091, 5014, 5015, 5112, 5099, -5118, 3102, -3090, 6066,
6047, 6067, 6053, 6072, 6073, 5055, 5108, 5020, 5071, 5070,
5004, 5004, 5048, 5091, 5112, 5099, 5118, 19055, 19108, 19020,
19071, 19070, 19058, 19004, 19048, 19091,-19118, 4034, 4011, 4101,
4035, 4099, 4098, 4017, 4104, 4027, 4087, 9999,-30999, 2002,
-6002, 3102, -3090, 9999, 4034, 4011, 4101, 4035, 4099, 4087,
4098, 4017, 4104, -4027, -5999, 0, 0, 0, 0, 0,
};
static int adjkey[40] = {
0, 15, 38, 64, 4, 63, 1, 61, 62, 67,
9, 27, 53, 46, 47, 60, 31, 39, 40, 6,
43, 26, 32, 28, 34, 50, 49, 45, 44, 10,
20, 25, 21, 36, 37, 30, 33, 0, 0, 0
};
static int adjtab[70] = {
0, 5, 98, -83, 2, -90, 66, 41, -90, -39,
41, 14, 15, 50, -11, 50, 64, 56, 72, -74,
-19, 119, 59, 73, -118, -119, -70, -41, 95, -118,
-118, -58, -71, -120, 110, -108, -120, -73, -62, -60,
110, 54, -63, -67, -41, -27, -47, 52, -75, -69,
65, 112, -3, 41, 72, 90, 20, 101, 107, -118,
-55, -10, -38, -4, 48, 9, -71, -39, 0, 0
};
/*
Analyze a two word sentence
*/
int english()
{
char *ch_ptr, *word1, *word2;
int type, val, type2, val2, adj, k, kk;
static int iwest = 0;
if (!(words[++wdx])) {
getwords();
wdx = 0;
}
pflag = FALSE;
word = words[wdx];
if (word < 0) { /* check first word */
printf("I didn't understand the word \"%s\"\n", txt[wdx]);
words[wdx+1] = 0;
return (FALSE); /* didn't know it */
}
type2 = val2 = -1;
type = CLASS(word);
clrlin();
val = VAL(word);
if (words[wdx + 1] && CLASS(words[wdx + 1]) != CONJUNCTION) {
/* 'SAY' or 'CALL'. If no next word, pass on to higher powers. */
if (type == ACTION && (val == SAY || val == YELL)) {
word = words[++wdx];
if (!(word == XYZZY || word == PLUGH
|| word == PLOVER || word == PHUCE)) {
if (val == SAY)
printf("Okay, \"%s\".\n", txt[wdx]);
else {
for (ch_ptr = txt[wdx]; *ch_ptr; ch_ptr++)
if (islower(*ch_ptr))
*ch_ptr = toupper(*ch_ptr);
printf("Okay, \"%s\"!!!!!\n", txt[wdx]);
}
return (FALSE);
}
} else {
word1 = txt[wdx];
word2 = txt[wdx + 1];
/* Special stuff for 'ENTER'. Can't go into water. 'ENTER
BOAT' means 'TAKE BOAT' */
if (word == ENTER) {
if (CLASS(words[wdx + 1]) == NOUN && VAL(words[wdx + 1]) == BOAT)
word = TAKE + 2000;
else if ((strcmp(word2, "stream") == 0)
|| (strcmp(word2, "water") == 0)
|| (strcmp(word2, "reservoir") == 0)
|| (strcmp(word2, "ocean") == 0)
|| (strcmp(word2, "sea") == 0)
|| (strcmp(word2, "pool") == 0)) {
rspeak(liqloc(g.loc) == WATER ? 70 : 43);
wdx++;
return (FALSE);
}
} else {
type2 = CLASS(words[wdx + 1]);
val2 = VAL(words[wdx + 1]);
/* 'LEAVE' is motion verb, unsless leaving an object.
E.G., 'LEAVE BOAT' or 'LEAVE BOTTLE'. BUt make sure
to leave ('DROP') only totable objects. */
if (strcmp(word1, "leave") == 0 && type2 == NOUN) {
if (!hinged(val2) || g.fixed[val2])
word = LEAVE + 2000;
/* IF 'LIGHT LAMP', Light must be taken as an
action verb, not a noun. */
} else if (strcmp(word1, "light") == 0
&& VAL(words[wdx + 1]) == LAMP) {
word = ON + 2000;
/* 'WATER PLANT' becomes 'POUR WATER', If we are at
plant. 'OIL DOOR' becomes 'POUR OIL', etc., etc. */
} else if ((strcmp(word1, "water") == 0 || strcmp(word1, "oil") == 0)
&& (strcmp(word2, "plant") == 0 || strcmp(word2, "door") == 0
|| strcmp(word2, "sword") == 0 || strcmp(word2, "anvil") == 0)
&& at(val2)) {
words[wdx + 1] = word;
txt[wdx + 1] = txt[wdx];
word = POUR + 2000;
}
}
}
}
/* This is the 'inner' loop. Dispatching of all word in a clause
after the first comes through here. */
do {
switch (CLASS(word)) {
case MOTION:
{
boolean do_part2;
int i;
do_part2 = FALSE;
type = CLASS(verbs[vrbx]);
val = VAL(verbs[vrbx]);
if (!vrbx)
do_part2 = TRUE;
else {
if (type > ACTION) {
rspeak(confuz());
return (FALSE);
}
}
if (type == ACTION) {
if (val == GO)
do_part2 = TRUE;
else {
if (val == TAKE) {
for (i = 0; i < 20; i++)
if (takdir[i] == val)
do_part2 = TRUE;
}
if (!do_part2) {
word = vocab(txt[wdx], 1);
if (word)
words[wdx--] = word;
}
}
} else if (type != CRAWL && type != JUMP
&& type != CLIMB)
do_part2 = TRUE;
if (do_part2) {
verbs[1] = word;
vrbx = 1;
if (strcmp(txt[wdx], "west") == 0) {
iwest++;
if (iwest == 10)
rspeak(17);
}
}
break;
}
case NOUN:
if (pflag) {
if (!doiobj())
return (FALSE);
} else {
word = VAL(word);
if (word == ALL) {
if (!do_scoop_up())
return (FALSE);
} else {
doobj(&word);
if (word > 0) {
objs[++objx] = word;
otxt[objx] = txt[wdx];
} else {
clrlin();
pflag = FALSE;
wdx++;
while (words[wdx]) {
if (CLASS(words[wdx]) == CONJUNCTION)
break;
wdx++;
}
if (words[wdx] == 0)
return (FALSE);
}
}
}
break;
case ACTION:
if (vrbx == 0)
vrbx++;
else {
if (VAL(verbs[vrbx]) == TAKE) {
val = VAL(word);
if (val == DRINK || val == INVENTORY
|| val == SCORE || val == NOTHING
|| val == LOOK);
else if (val == GO && (
strcmp(txt[wdx], "walk") == 0
|| strcmp(txt[wdx], "run") == 0
|| strcmp(txt[wdx], "hike") == 0));
else {
rspeak(confuz());
return (FALSE);
}
} else if (objx || CLASS(words[wdx - 1]) == CONJUNCTION) {
rspeak(confuz());
return (FALSE);
}
}
verbs[vrbx] = word;
vtxt[vrbx] = txt[wdx];
break;
case MISC:
if (vrbx) {
rspeak(confuz());
return (FALSE);
}
verbs[1] = word;
vrbx = 1;
break;
case PREPOSITION:
if (CLASS(verbs[vrbx]) != ACTION || iobx) {
rspeak(confuz());
return (FALSE);
}
vrbkey = vkey[VAL(verbs[vrbx])];
if (!vrbkey) {
rspeak(confuz());
return (FALSE);
}
prep = VAL(word);
pflag = TRUE;
break;
case ADJACTIVE:
/* Adjective handler. Scarf the next word, make sure it is
a valid object for this object. Then call getobj to see
if it is really there, Then link into object code. */
adj = VAL(word);
if (!check_next())
return (FALSE);
else if (CLASS(word) == CONJUNCTION) {
printf("%s what?\n", txt[wdx - 1]);
return (FALSE);
} else {
if (CLASS(word) != NOUN)
word = vocab(txt[wdx], NOUN);
if (word == -1 || CLASS(word) != NOUN || VAL(word) == ALL) {
rspeak(confuz());
return (FALSE);
}
words[wdx] = word;
kk = VAL(word);
for (k = adjkey[adj]; adjtab[k] >= 0; k++) {
if (kk == abs(adjtab[k]))
break;
}
if (adjtab[k] < 0) {
rspeak(confuz());
return (FALSE);
}
}
break;
case CONJUNCTION:
if (!check_next())
return (FALSE);
switch (CLASS(word)) {
case MOTION:
case ACTION:
case MISC:
words[wdx--] = 0;
break;
case NOUN:
case ADJACTIVE:
break;
case PREPOSITION:
case CONJUNCTION:
rspeak(confuz());
return (FALSE);
default:
bug(33);
}
break;
default:
bug(33);
}
word = words[++wdx];
if (word < 0) {
if (pct(50))
printf("I don't understand the word %s?\n", txt[wdx]);
else
printf("Mumble ? %s\n", txt[wdx]);
words[wdx+1] = 0;
return (FALSE);
}
type = CLASS(word);
if (type == NOUN) {
/* It's not the first: Make sure he included a comma or
'and'. Differenctiate between direct & indirect objects.
Check for special case of multiple ofjects: 'feed bear
honey' or 'throw troll nugget'. */
if ((pflag ? iobx : objx)
&& CLASS(words[wdx - 1]) != CONJUNCTION) {
val = VAL(verbs[vrbx]);
if (!living(objs[objx]) || (val != THROW && val != FEED)) {
rspeak(confuz());
return (FALSE);
}
iobx++;
iobjs[iobx] = objs[objx];
objs[objx] = 0;
objx++;
}
}
} while (word);
if (verbs[1] == 0) {
if (objs[1] == 0) {
rspeak(confuz());
clrlin();
} else if (objs[2])
printf("What do you want to do with them?\n");
else
printf("What do you want to do with %s?\n", otxt[1]);
return (FALSE);
} else if (objx > 1 && iobx > 1) {
rspeak(confuz());
return (FALSE);
}
return (TRUE);
}
/*
retrieve input line (max INPUTBUFLEN chars), convert to lower case
& rescan for first two words (max. WORDSIZE-1 chars).
*/
static void getwords()
{
static int wdx = 0;
int i, term_loc;
char terminator;
if (*cindex == '\0') {
while (!*ask("\n> ", buffer, sizeof(buffer))) ;
for (cindex = buffer; *cindex; cindex++)
if (isupper(*cindex))
*cindex = tolower(*cindex);
cindex = buffer;
}
wdx = 0;
buffer[sizeof(buffer)-1] = '\0';
for (i = 0; i < MAXWORDS; i++) {
txt[i] = &buffer[sizeof(buffer)-1];
words[i] = 0;
}
do {
while (*cindex == ' ')
cindex++;
txt[wdx] = cindex;
term_loc = strcspn(cindex, " ,.;\n");
cindex += term_loc;
terminator = *cindex;
*cindex++ = '\0';
if ((strcmp(txt[wdx], "a") != 0)
&& (strcmp(txt[wdx], "the") != 0)
&& (strcmp(txt[wdx], "an") != 0)) {
words[wdx] = vocab(txt[wdx], 0);
wdx++;
}
if (terminator == ',') {
txt[wdx] = "and";
words[wdx] = vocab(txt[wdx], 0);
wdx++;
}
}
while ((terminator != ';') && (terminator != '.')
&& (terminator != '\0') && (terminator != '\n'));
if (terminator == '\0')
cindex--;
return;
}
/* CLRIN, clears out all surrent syntax args in preparation for
* new input line
*/
static void clrlin()
{
int i;
for (i = 0; i < MAXWORDS; i++) {
verbs[i] = 0;
vtxt[i] = &buffer[sizeof(buffer)-1];
}
for (i = 0; i < MAXITEMS; i++) {
objs[i] = 0;
otxt[i] = &buffer[sizeof(buffer)-1];
iobjs[i] = 0;
iotxt[i] = &buffer[sizeof(buffer)-1];
}
vrbx = 0;
objx = 0;
iobx = 0;
prep = 0;
}
/*
Routine to process an object.
*/
static void doobj(object)
int *object;
{
int msg;
if (holding(*object))
return;
if (blind()) {
printf("I see no %s here.\n", txt[wdx]);
*object = 0;
return;
}
/* Is object here? if so, transitive */
if (g.fixed[*object] == g.loc || athand(*object))
return;
else if (here(*object)) {
msg = plural(*object) ? 373 : 335;
*object = 0;
rspeak(msg);
}
/* Did he give grate as destination? */
else if (*object == GRATE) {
if (g.loc == 1 || g.loc == 4 || g.loc == 7) {
verbs[1] = DEPRESSION;
vrbx = 1;
return;
} else if (g.loc > 9 && g.loc < 15) {
verbs[1] = ENTRANCE;
vrbx = 1;
return;
}
}
/* Is it a dwarf he is after? */
else if (dcheck() && g.dflag >= 2) {
*object = DWARF;
}
/* Is he trying to get/use a liquid? */
else if (liqloc(g.loc) == *object
|| (liq(BOTTLE) == *object && athand(BOTTLE))
|| (liq(CASK) == *object && athand(CASK)));
else if (*object == PLANT && at(PLANT2) &&
g.prop[PLANT2] == 0) {
*object = PLANT2;
} else if (*object == ROCKS && at(CARVNG)) {
*object = CARVNG;
}
/* Is he trying to grab a knife? */
else if (*object == KNIFE && g.knfloc == g.loc) {
rspeak(116);
g.knfloc = -1;
}
/* Is he trying to get at dynamite? */
else if (*object == ROD && athand(ROD2)) {
*object = ROD2;
} else if (*object == DOOR && (at(SAFE) || at(TDOOR)
|| at(TDOOR2) || at(PDOOR))) {
if (at(TDOOR2))
*object = TDOOR2;
else if (at(PDOOR))
*object = PDOOR;
else if (at(SAFE))
*object = SAFE;
else
*object = TDOOR;
} else if (*object == BOOK && athand(BOOK2)) {
*object = BOOK2;
} else if (!(verbs[vrbx] == FIND || verbs[vrbx] == INVENTORY)) {
*object = 0;
printf("I see no %s here.\n", txt[wdx]);
}
return;
}
static boolean doiobj()
{
char dk[INPUTBUFLEN], dkk[INPUTBUFLEN];
int kk;
boolean ok;
/* checks object is valid for this preposition */
ok = TRUE;
word = VAL(word);
if (word != ALL) {
doobj(&word);
if (word > 0) {
iobjs[++iobx] = word;
iotxt[iobx] = txt[wdx];
} else
ok = FALSE;
}
kk = abs(ptab[vrbkey]) / 1000;
if (kk == prep) {
/* preprosition is valid with this verb now check object of
preprosition */
if (word == 0 || CLASS(word) == CONJUNCTION) {
/* no object following prepresition: check special cases */
pflag = FALSE;
strcpy(dk, txt[--wdx]);
strcpy(dkk, vtxt[vrbx]);
ok = FALSE;
if ((strcmp(dk, "on") == 0
|| strcmp(dk, "off") == 0)
&& (strcmp(dkk, "turn") == 0
|| objs[objx] == LAMP))
ok = TRUE;
if (strcmp(dkk, "take") == 0
|| strcmp(dkk, "put") == 0)
ok = TRUE;
if (strcmp(dk, "up") == 0
&& strcmp(dkk, "pick") == 0)
ok = TRUE;
if (strcmp(dk, "down") == 0
&& (strcmp(dkk, "put") == 0 || verbs[vrbx] == THROW) )
ok = TRUE;
} else {
/* object follows preposition See if it's plausible. */
kk = abs(ptab[vrbkey]) % 1000;
if (kk == word && kk == ALL) {
if (!do_scoop_up())
return (FALSE);
} else if (!(kk == word || kk == 999)) {
vrbkey++;
ok = ptab[vrbkey - 1] < 0 ? FALSE : TRUE;
}
}
}
return (ok);
}
static boolean do_scoop_up()
{
int i, val;
val = VAL(verbs[vrbx]);
if (val == DROP || val == PUT || val == LEAVE) {
for (i = 1; i < MAXOBJ; i++) {
if (!athand(i) || g.fixed[i])
continue;
if (i > WATER && i <= WINE + 1)
continue;
if (toting(i)) {
objs[++objx] = i;
otxt[objx] = "BUG???";
if (objx >= 44)
break;
}
}
}
if (val == TAKE || val == PICK || val == GET) {
if (blind()) {
rspeak(357);
return (FALSE);
} else {
for (i = 1; i < MAXOBJ; i++) {
if (!athand(i) || g.fixed[i])
continue;
if (i > WATER && i <= WINE + 1)
continue;
if (!toting(i)) {
objs[++objx] = i;
otxt[objx] = "BUG???";
if (objx >= 44)
break;
}
}
}
}
return (TRUE);
}
static boolean check_next()
{
word = words[wdx + 1];
if (word > 0)
return (TRUE);
else if (word == 0)
rspeak(confuz());
else {
if (pct(50))
printf("I don't understand the word %s?\n", txt[wdx]);
else
printf("Mumble ? %s\n", txt[wdx]);
words[wdx+1] = 0;
}
return (FALSE);
}

View file

@ -1,264 +0,0 @@
/*
Initialization of adventure play variables
*/
#include <string.h>
#include <stdio.h>
#include "advent.h" /* #define preprocessor equates */
#define EXTERN /* define, not declare, in advdec.h */
#include "advdec.h"
int plac[MAXOBJ] = {
0, 0, 3, 8, 10, 11, 0, 14, 0, 148, /* 0 - 9 */
96, 19, 17, 101, 103, 0, 106, 0, 0, 238, /* 10 - 19 */
238, 117, 190, 109, 25, 23, 111, 35, 0, 97, /* 20 - 29 */
0, 119, 0, 117, 0, 130, 0, 126, 140, 0, /* 30 - 39 */
96, 94, 158, 160, 188, 0, 155, 174, 166, 228, /* 40 - 49 */
18, 204, 27, 29, 30, 0, 92, 168, 97, 100, /* 50 - 59 */
101, 0, 119, 127, 130, 141, 144, 205, 28, 182, /* 60 - 69 */
225, 230, 0, 147, 241, 248, 0, 0, 0, 0, /* 70 - 79 */
0, 0, 0, 0, 0, 0, 0, 193, 102, 0, /* 80 - 89 */
159, 141, 172, 188, 189, 0, 0, 193, 227, 174, /* 90 - 99 */
0, 13, 238, 217, 171, 0, 146, 159, 3, 0, /* 100 - 109 */
0, 0, 0, 3, 180, 39, 5, 0, 110, 169, /* 110 - 119 */
200
};
int fixd[MAXOBJ] = {
0, 0, 0, 9, 0, 0, 0, 15, 0, 0, /* 0 - 9 */
0, -1, 27, -1, 0, 0, 0, -1, 0, 0, /* 10 - 19 */
0, 122, 235, -1, -1, 67, -1, 110, 0, -1, /* 20 - 29 */
-1, 121, 0, 122, 0, -1, -1, -1, -1, 0, /* 30 - 39 */
-1, -1, 166, 167, 189, 0, 0, -1, 0, 229, /* 40 - 49 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50 - 59 */
0, 0, 121, 0, -1, 0, 0, 0, 0, 0, /* 60 - 69 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */
0, 0, 0, 0, 0, 0, 0, -1, 194, -1, /* 80 - 89 */
0, -1, 174, -1, -1, 0, 0, -1, -1, -1, /* 90 - 99 */
0, 0, 0, -1, -1, -1, 0, 0, 0, 0, /* 100 - 109 */
0, 0, -1, 0, 0, -1, -1, 0, 0, 0, /* 110 - 119 */
0
};
struct playinfo g = {
0, /* turns */
1, /* loc */
1, /* oldloc */
1, /* oldloc2 */
1, /* newloc */
{ /* loc_attrib[MAXLOC] */
0, 73, 65, 73, 73, /* 0 - 4 */
65, 65, 73, 1601, 33, /* 5 - 9 */
32, 32, 32, 1824, 32, /* 10 - 14 */
0, 2, 0, 0, 2816, /* 15 - 19 */
2, 2, 2, 0, 10, /* 20 - 24 */
0, 2, 0, 0, 0, /* 25 - 29 */
0, 2, 2, 8, 0, /* 30 - 34 */
0, 0, 0, 8, 0, /* 35 - 39 */
2, 0, 256, 256, 256, /* 40 - 44 */
256, 272, 272, 272, 256, /* 45 - 49 */
256, 0, 256, 256, 272, /* 50 - 54 */
256, 272, 0, 16, 2, /* 55 - 59 */
0, 0, 0, 0, 0, /* 60 - 64 */
0, 0, 0, 0, 0, /* 65 - 69 */
0, 0, 0, 0, 0, /* 70 - 74 */
0, 0, 0, 0, 2, /* 75 - 79 */
256, 256, 272, 0, 0, /* 80 - 84 */
16, 272, 0, 0, 2, /* 85 - 89 */
2, 0, 0, 0, 0, /* 90 - 94 */
8, 0, 0, 1280, 513, /* 95 - 99 */
513, 512, 0, 0, 0, /* 00 - 04 */
0, 0, 0, 768, 0, /* 105 - 109 */
0, 0, 0, 8, 0, /* 110 - 114 */
1, 1, 0, 0, 0, /* 115 - 119 */
0, 0, 16, 16, 16, /* 120 - 124 */
16, 17, 16, 16, 16, /* 125 - 129 */
16, 0, 0, 0, 0, /* 130 - 134 */
0, 0, 0, 0, 0, /* 135 - 139 */
0, 1040, 16, 0, 0, /* 140 - 144 */
2, 65, 65, 65, 65, /* 145 - 149 */
65, 65, 65, 65, 65, /* 150 - 154 */
65, 3, 2625, 2113, 65, /* 155 - 159 */
65, 3, 3, 3, 3, /* 160 - 164 */
3, 41, 41, 9, 9, /* 165 - 169 */
0, 0, 0, 0, 0, /* 170 - 174 */
0, 0, 0, 2, 0, /* 175 - 179 */
0, 2, 0, 0, 0, /* 180 - 184 */
0, 0, 0, 0, 16, /* 185 - 189 */
0, 0, 9, 0, 0, /* 190 - 194 */
0, 0, 0, 9, 2, /* 195 - 199 */
1, 1, 2304, 0, 0, /* 200 - 204 */
0, 8, 8, 8, 0, /* 205 - 209 */
0, 0, 1, 0, 9, /* 210 - 214 */
0, 0, 12, 0, 0, /* 215 - 219 */
0, 0, 0, 0, 0, /* 220 - 224 */
0, 2, 2625, 73, 73, /* 225 - 229 */
0, 2, 2, 2, 2, /* 230 - 234 */
0, 0, 2, 65, 3137, /* 235 - 239 */
65, 65, 65, 65, 65, /* 240 - 244 */
65, 65, 65, 65 /* 245 - 249 */
}, /* loc_attrib[MAXLOC] */
{0 }, /* place[MAXOBJ] */
{0 }, /* fixed[MAXOBJ] */
{ /* weight[MAXOBJ] */
0, 0, 1, 0, 1, 2, 2, 0, 0, 2, /* 0 - 9 */
1, 0, 0, 0, 7, 7, 1, 0, 0, 2, /* 10 - 19 */
1, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* 20 - 29 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 3, /* 30 - 39 */
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, /* 40 - 49 */
6, 1, 2, 2, 3, 5, 4, 3, 2, 3, /* 50 - 59 */
4, 1, 3, 1, 3, 2, 1, 1, 2, 2, /* 60 - 69 */
2, 3, 1, 1, 3, 1, 0, 0, 0, 0, /* 70 - 79 */
0, 2, 2, 2, 2, 2, 2, 0, 0, 0, /* 70 - 79 */
1, 0, 0, 0, 0, 3, 2, 0, 0, 0, /* 80 - 89 */
0, 2, 1, 0, 0, 0, 1, 1, 2, 0, /* 100 - 109 */
3, 3, 0, 1, 1, 0, 0, 0, 3, 1, /* 110 - 119 */
2, 0, 0 /* 120 - 129 */
}, /* weight[MAXOBJ] */
{0 }, /* atloc[MAXLOC] */
{0 }, /* link[MAXOBJ * 2] */
{0 }, /* holder[MAXOBJ] */
{0 }, /* hlink[MAXOBJ] */
{0 }, /* visited[MAXLOC] */
{0 }, /* prop[MAXOBJ] */
{ /* obj_state[MAXOBJ] */
0, 0, 32800, 26, 32770, /* 0 - 4 */
32, 32, 8192, 0, 0, /* 5 - 9 */
32, 512, 0, 256, 770, /* 10 - 14 */
770, 288, 512, 0, 160, /* 15 - 19 */
32802, 0, 0, 0, 128, /* 20 - 24 */
0, 0, 0, 32, 8192, /* 25 - 29 */
512, 512, 0, 512, 0, /* 30 - 34 */
512, 256, 0, 32768, 8224, /* 35 - 39 */
0, 18, 26, 26, 2, /* 40 - 44 */
0, 8320, 18464, 32768, 0, /* 45 - 49 */
16384, 16416, 16416, 26656, 24608, /* 50 - 54 */
49240, 24608, 16384, 49184, 16416, /* 55 - 59 */
16416, 16416, 16384, 16544, 16442, /* 60 - 64 */
16416, 18464, 26656, 16416, 16416, /* 65 - 69 */
49184, 49154, 18464, 18464, 16416, /* 70 - 74 */
16416, 0, 0, 0, 0, /* 75 - 79 */
0, 0, 0, 0, 0, /* 80 - 84 */
0, 0, 8704, 0, 0, /* 85 - 89 */
0, 0, 0, 0, 32768, /* 90 - 94 */
0, 128, 0, 0, 0, /* 95 - 99 */
0, 160, 8224, 0, 0, /* 100 - 104 */
0, 8352, 8352, 32870, 0, /* 105 - 109 */
16674, 258, 32858, 288, 32, /* 110 - 114 */
256, 0, 0, 32866, 16416, /* 115 - 119 */
16416, 0, 0 /* 120 - 123 */
}, /* obj_state[MAXOBJ] */
{ /* points[MAXOBJ] */
0, 0, 0, 0, 0, /* 0 - 4 */
0, 0, 0, 0, 0, /* 5 - 9 */
0, 0, 0, 0, 0, /* 10 - 14 */
0, 1000108, 0, 0, 0, /* 15 - 19 */
0, 0, 0, 0, 0, /* 20 - 24 */
0, 0, 0, 0, 0, /* 25 - 29 */
0, 0, 0, 0, 0, /* 30 - 34 */
0, 0, 0, 0, 0, /* 35 - 39 */
0, 0, 0, 0, 0, /* 40 - 44 */
0, 0, -3000112, 0, 0, /* 45 - 49 */
-2000055, -2000112, -2000112, -1000112, -5000112, /* 50 - 54 */
5000003, -3000112, -2000055, 2000003, -3000112, /* 55 - 59 */
-4000112, -4000112, 3000003, -1000112, -4000112, /* 60 - 64 */
-4000112, -2000112, -3000112, -1000112, -1000112, /* 65 - 69 */
-2000112, -3012055, -4000112, -1000112, -5000112, /* 70 - 74 */
-5000112, 0, 0, 0, 0, /* 75 - 79 */
0, 0, 0, 0, 0, /* 80 - 84 */
0, 0, 0, 0, 0, /* 85 - 89 */
0, 0, 0, 0, 0, /* 90 - 94 */
0, 0, 0, 0, 0, /* 95 - 99 */
0, 0, 0, 0, 0, /* 100 - 104 */
0, 0, 0, 0, 0, /* 105 - 109 */
-2000112, 0, 0, 0, 0, /* 110 - 114 */
0, 0, 0, 0, -4000118, /* 115 - 119 */
-2000112, 0 /* 120 - 122 */
}, /* points[MAXOBJ] */
{0 }, /* hinted[HNTMAX+1] */
{ /* hints[HNTMAX+1][5] */
{ 0, 0, 0, 0, 0 }, /* 0 */
{ 0, 9999, 4, 0, 0 }, /* 1 */
{ 0, 9999, 10, 0, 0 }, /* 2 */
{ 0, 9999, 5, 0, 0 }, /* 3 */
{ 0, 0, 0, 0, 0 }, /* 4 */
{ 0, 0, 0, 0, 0 }, /* 5 */
{ 0, 0, 0, 0, 0 }, /* 6 */
{ 0, 15, 4, 176, 177 }, /* 7 */
{ 0, 8, 5, 178, 179 }, /* 8 */
{ 0, 13, 3, 180, 181 }, /* 9 */
{ 0, 6, 10, 211, 212 }, /* 10 */
{ 0, 6, 5, 213, 214 }, /* 11 */
{ 0, 4, 2, 62, 63 }, /* 12 */
{ 0, 5, 2, 18, 19 }, /* 13 */
{ 0, 4, 2, 62, 233 }, /* 14 */
{ 0, 6, 5, 274, 275 }, /* 15 */
{ 0, 10, 5, 289, 290 }, /* 16 */
{ 0, 8, 2, 20, 21 }, /* 17 */
{ 0, 5, 2, 404, 405 } /* 18 */
}, /* hints[HNTMAX+1][5] */
{0 }, /* hintlc[HNTMAX+1] */
0, /* tally */
0, /* tally2 */
0, /* limit */
0, /* lmwarn */
0, /* wzdark */
0, /* closing */
0, /* closed */
0, /* holding */
0, /* detail */
0, /* knfloc */
30, /* clock */
50, /* clock2 */
0, /* panic */
{ 0, 19, 27, 33, 44, 64, 114 }, /* dloc[DWARFMAX+1] */
0, /* dflag */
{ 0, 0, 0, 0, 0, 0, 0 }, /* dseen[DWARFMAX+1] */
{ 0, 0, 0, 0, 0, 0, 0 }, /* odloc[DWARFMAX+1] */
18, /* daltloc */
0, /* dkill */
114, /* chloc */
140, /* chloc2 */
0, /* bonus */
0, /* numdie */
0, /* foobar */
0, /* combo */
0, /* terse */
5, /* abbnum */
100, /* health */
0, /* chase */
FALSE, /* flg239 */
0 /* lastglob */
};
/*
Initialization of adventure play variables
*/
void initialize()
{
int i;
for (i = MAXOBJ; i > 0; i--) {
g.fixed[i] = fixd[i];
if (fixd[i] > 0) {
drop(i + MAXOBJ, fixd[i]);
drop(i, plac[i]);
}
if ((plac[i] != 0) && (fixd[i] <= 0))
drop(i, plac[i]);
}
for (i = 1; i <= MAXOBJ; i++) {
if (treasr(i)) {
g.prop[i] = -1;
g.tally++;
}
}
newtravel = TRUE;
g.place[BOOK] = -1;
insert(BOOK, SAFE);
g.place[WATER] = -1;
insert(WATER, BOTTLE);
g.prop[BOTTLE] = 8;
return;
}

View file

@ -1,597 +0,0 @@
/* program ITVERB.C */
#include <stdio.h>
#include "advent.h"
#include "advdec.h"
_PROTOTYPE(void needobj, (void));
_PROTOTYPE(void ivtake, (void));
_PROTOTYPE(void ivopen, (void));
_PROTOTYPE(void ivkill, (void));
_PROTOTYPE(void ivdrink, (void));
_PROTOTYPE(void ivquit, (void));
_PROTOTYPE(void ivfoo, (void));
_PROTOTYPE(void inventory, (void));
_PROTOTYPE(void addobj, (int obj));
_PROTOTYPE(void ivpour, (void));
_PROTOTYPE(void ivfill, (void));
_PROTOTYPE(void ivbrief, (void));
_PROTOTYPE(void ivread, (void));
_PROTOTYPE(void ivcombo, (void));
_PROTOTYPE(void iveat, (void));
/*
Routines to process intransitive verbs
*/
void itverb()
{
int i;
newtravel = FALSE;
switch (verb) {
case DROP:
case SAY:
case WAVE:
case CALM:
case RUB:
case THROW:
case FIND:
case FEED:
case BREAK:
case WAKE:
case WEAR:
case HIT:
case DIAL:
case PLAY:
case PICK:
case PUT:
case TURN: needobj(); break;
case TAKE:
case YANK:
case GET:
case INSRT:
case REMOVE:
case BURN: ivtake(); break;
case OPEN:
case CLOSE:
case LOCK:
case UNLOCK: ivopen(); break;
case NOTHING: rspeak(54); break;
case ON:
case OFF: trverb(); break;
case WALK: actspk(verb); break;
case KILL: ivkill(); break;
case POUR: ivpour(); break;
case EAT: iveat(); break;
case DRINK: ivdrink(); break;
case QUIT: ivquit(); break;
case INVENTORY: inventory(); break;
case FILL: ivfill(); break;
case BLAST: ivblast(); break;
case SCORE: score(TRUE); break;
case FOO: ivfoo(); break;
case BRIEF: ivbrief(); break;
case READ: ivread(); break;
case SUSPEND:
if (g.closing)
rspeak(378);
else
saveadv("advent.sav");
break;
case RESTORE: restore("advent.sav"); break;
case ANSWER:
if ((g.loc != 189) || (g.prop[PHONE] != 0))
needobj();
else {
object = PHONE;
itverb();
}
break;
case BLOW: rspeak(268); break;
/* Action verb 'LEAVE' has no object */
case LEAVE: bug(29); break;
/* Call if no phone is handy, yell. */
case YELL:
if (!here(PHONE))
needobj();
else if (!g.closed)
rspeak(271);
else {
rspeak(283);
normend();
}
break;
/* Health. give him a diagnosis. */
case HEALTH:
if (g.numdie)
fprintf(stdout, "You have been killed %d times otherwise\n",
g.numdie);
if (g.health >= 95) {
if (pct(50))
rspeak(348);
else
rspeak(349);
} else {
fprintf(stdout,
"Your health rating is %2d out of a possible 100.\n",
g.health);
rspeak(381 + (100 - g.health) / 20);
}
break;
case LOOK: ivlook(); break;
case COMBO:
if (at(SAFE))
ivcombo();
break;
case SWEEP:
/* Dust/sweep */
if (!at(CARVNG) || !athand(BRUSH) || (g.prop[CARVNG] == 1))
rspeak(342);
else {
g.prop[CARVNG] = 1;
rspeak(363);
rspeak(372);
}
break;
case TERSE:
/* Terse/unterse. supress all long_form descriptions. */
g.terse = !g.terse;
g.detail = 3;
rspeak(54);
break;
case WIZ:
is_wiz = !is_wiz;
case MAP:
rspeak(54);
break;
case GATE:
if (is_wiz) {
static char buf[INPUTBUFLEN];
sscanf(ask("Location ? ", buf, sizeof(buf)), "%d", &g.loc);
}
rspeak(54);
break;
case PIRLOC:
if (is_wiz) {
fprintf(stdout, "The dwarfs are at locations:\n");
for (i = 1; i < DWARFMAX; i++)
fprintf(stdout, " %4d", g.dloc[i]);
fprintf(stdout, "\nThe pirate is at location %4d\n",
g.dloc[DWARFMAX]);
}
rspeak(54);
break;
default:
printf("This intransitive not implemented yet\n");
}
return;
}
/*
Routine to indicate no reasonable
object for verb found. Used mostly by
intransitive verbs.
*/
void needobj()
{
printf("%s what?\n", vtxt[vrbx]);
return;
}
/*
CARRY, TAKE etc.
*/
void ivtake()
{
int anobj, item;
anobj = 0;
for (item = 1; item < MAXOBJ; ++item)
if (g.place[item] == g.loc)
if (anobj == 0)
anobj = item;
else {
needobj();
return;
}
if (anobj == 0 || (dcheck() && g.dflag >= 2) || blind())
needobj();
else {
object = anobj;
if (verb == YANK)
vyank();
else if (verb == WEAR)
vwear();
else
vtake();
}
return;
}
/*
OPEN, LOCK, UNLOCK
*/
void ivopen()
{
int obj_cnt, item;
for (item = 1, obj_cnt = 0; item < MAXOBJ; item++) {
if ((g.place[item] == g.loc) && (hinged(item))) {
object = item;
obj_cnt++;
}
}
if (obj_cnt != 1)
needobj();
else if (verb == LOCK)
vlock();
else if (verb == UNLOCK)
vunlock();
else if (verb == SHUT)
vclose();
else
vopen();
}
/*
ATTACK, KILL etc
*/
boolean previous_obj;
void ivkill()
{
previous_obj = FALSE;
if (dcheck() && g.dflag >= 2)
object = DWARF;
if (here(SNAKE))
addobj(SNAKE);
if (at(DRAGON) && g.prop[DRAGON] == 0)
addobj(DRAGON);
if (at(TROLL))
addobj(TROLL);
if (here(GNOME))
addobj(GNOME);
if (here(BEAR) && g.prop[BEAR] == 0)
addobj(BEAR);
if (here(WUMPUS) && g.prop[WUMPUS] == 0)
addobj(WUMPUS);
/* Can't attack bird by throwing axe */
if (here(BIRD) && verb != THROW)
addobj(BIRD);
/* Clam and oyster both treated as clam for intransitive case; no
harm done. */
if (here(CLAM) || here(OYSTER))
addobj(CLAM);
if ((previous_obj) || (object == 0))
rspeak(44);
else
vkill();
return;
}
/*
POUR if no object, assume liq in container, if holding one.
*/
void ivpour()
{
if ((holding(BOTTLE)) && (liq(BOTTLE) != 0) && !holding(CASK))
object = BOTTLE;
if ((holding(CASK)) && (liq(CASK) != 0) && !holding(BOTTLE))
object = CASK;
if (object == 0)
needobj();
else
trverb();
}
/*
EAT. intransitive: assume edible if present, else ask what.
If he as more than one edible, or none, 'EAT' is ambiguous
without an explicit object.
*/
void iveat()
{
int i;
previous_obj = FALSE;
for (i = 1; i < MAXOBJ; i++) {
if ((here(i)) && (edible(i)))
addobj(i);
}
if ((previous_obj) || (object == 0))
needobj();
else
trverb();
}
/*
DRINK. If no object, assume water or wine and look for them here.
If potable is in bottle or cask, drink that. If not, see if there
is something drinkable nearby (stream, lake, wine fountain, etc.),
and drink that. If he has stuff in both containers, ask which.
*/
void ivdrink()
{
int ll;
previous_obj = FALSE;
ll = liqloc(g.loc);
if ((ll == WATER) || (ll == WINE)) {
object = ll;
iobj = -1;
}
ll = liq(BOTTLE);
if ((athand(BOTTLE)) && ((ll == WATER) || (ll == WINE))) {
object = ll;
iobj = BOTTLE;
}
ll = liq(CASK);
if ((athand(CASK)) && ((ll == WATER) || (ll == WINE))
&& iobj != BOTTLE) {
object = ll;
iobj = CASK;
} else
object = 0;
if (object == 0)
needobj();
else
trverb();
}
/*
QUIT intransitive only. Verify intent and exit if that's what he wants
*/
void ivquit()
{
gaveup = yes(22, 54, 54);
if (gaveup)
normend();
return;
}
/*
INVENTORY
*/
void inventory()
{
int i, msg;
boolean init_msg;
init_msg = TRUE;
msg = 98;
for (i = 1; i < MAXOBJ; i++) {
if (!holding(i) || wearng(i) || i == BEAR || i == BOAT)
continue;
if (init_msg)
rspeak(99);
pspeak(i, -1);
init_msg = FALSE;
msg = 0;
lookin(i);
}
/* Tell him what he is wearing */
init_msg = TRUE;
for (i = 1; i < MAXOBJ; i++) {
if (wearng(i)) {
if (init_msg)
fprintf(stdout, "\nYou are wearing:\n");
fprintf(stdout, " ");
pspeak(i, -1);
msg = 0;
init_msg = FALSE;
}
}
if (holding(BOAT)) {
rspeak(221);
lookin(BOAT);
}
if (holding(BEAR))
msg = 141;
if (msg)
rspeak(msg);
return;
}
/*
FILL bottle or cask must be empty, and some liquid avaible
*/
void ivfill()
{
if ((g.prop[CASK] == 1) && !here(CASK))
object = CASK;
if ((g.prop[BOTTLE] == 1) && !here(BOTTLE))
object = BOTTLE;
if ((here(BOTTLE) && here(CASK)) || (object == 0))
needobj();
else
trverb();
}
/*
BLAST etc.
*/
void ivblast()
{
if (!g.closed)
actspk(verb);
else {
g.bonus = 135;
if (g.place[ROD2] == 212 && g.loc == 116)
g.bonus = 133;
if (g.place[ROD2] == 116 && g.loc != 116)
g.bonus = 134;
rspeak(g.bonus);
normend();
}
return;
}
/*
Handle fee fie foe foo...
*/
void ivfoo()
{
int k;
int msg;
k = VAL(vocab(vtxt[vrbx], MISC));
if (g.foobar != 1 - k) {
if (g.foobar == 0)
msg = 42;
else
msg = 151;
rspeak(msg);
return;
}
g.foobar = k;
if (k != 4)
return;
g.foobar = 0;
if (g.place[EGGS] == plac[EGGS] ||
(toting(EGGS) && g.loc == plac[EGGS])) {
rspeak(42);
return;
}
/* Bring back troll if we steal the eggs back from him before
crossing */
if (g.place[EGGS] == 0 && g.place[TROLL] == 0 && g.prop[TROLL] == 0)
g.prop[TROLL] = 1;
if (here(EGGS))
k = 1;
else if (g.loc == plac[EGGS])
k = 0;
else
k = 2;
move(EGGS, plac[EGGS]);
pspeak(EGGS, k);
return;
}
/*
brief/unbrief. intransitive only.
suppress long descriptions after first time.
*/
void ivbrief()
{
int msg;
g.detail = 3;
g.terse = FALSE;
if (g.abbnum != 10000) {
msg = 156;
g.abbnum = 10000;
} else {
msg = 374;
g.abbnum = 5;
}
rspeak(msg);
}
/*
read etc...
*/
void ivread()
{
previous_obj = FALSE;
if (here(BOOK))
object = BOOK;
if (here(BOOK2))
addobj(BOOK2);
if (here(BILLBD))
addobj(BILLBD);
if (here(CARVNG))
addobj(CARVNG);
if (here(MAGAZINE))
addobj(MAGAZINE);
if (here(MESSAGE))
addobj(MESSAGE);
if (here(OYSTER))
addobj(OYSTER);
if (here(POSTER))
addobj(POSTER);
if (here(TABLET))
addobj(TABLET);
if (previous_obj || object == 0 || dark())
needobj();
else
vread();
return;
}
/*
LOOK. can't give more detail. Pretend it wasn't dark (though it may "now"
be dark) so he won't fall into a pit staring into the gloom.
*/
void ivlook()
{
if (g.detail++ < 3)
rspeak(15);
g.wzdark = FALSE;
g.visited[g.loc] = 0;
g.newloc = g.loc;
newtravel = TRUE;
return;
}
/*
COMBO: trying to open safe. (see comments for fee fie foe foo)
*/
void ivcombo()
{
int k, msg;
k = VAL(vocab(vtxt[vrbx], MISC)) - 10;
msg = 42;
if (g.combo != 1 - k) {
if (g.combo != 0)
msg = 366;
rspeak(msg);
return;
}
g.combo = k;
if (k != 3)
rspeak(371);
else {
g.combo = 0;
bitoff(SAFE, LOCKBT);
biton(SAFE, OPENBT);
g.prop[SAFE] = 1;
if (g.prop[BOOK] < 0) {
g.tally--;
g.prop[BOOK] = 0;
/* If remaining treasures too elusive, zap his lamp. this
duplicates some code, must be done here since book is
contained ins safe & tally stuff only works for thing
deposited at a location. */
if ((g.tally == g.tally2) && (g.tally != 0))
g.limit = (g.limit < 35) ? g.limit : 35;
}
rspeak(365);
}
}
/*
ensure uniqueness as objects are searched
out for an intransitive verb
*/
void addobj(obj)
int obj;
{
if (!previous_obj) {
if (object != 0)
previous_obj = TRUE;
else
object = obj;
}
return;
}

View file

@ -1,199 +0,0 @@
/**
SCORE
Calculate what the player's score would be if he quit now.
This may be the end of the game, or he may just be wondering
how he is doing.
The present scoring algorithm is as follows:
(treasure points are explained in a following comment)
objective: points: present total possible:
getting well into cave 25 25
total possible for treasures (+mag) 426
reaching "closing" 20 20
"closed": quit/killed 10
klutzed 20
wrong way 25
success 30 30
total: 501
(points can also be deducted for using hints or deaths.)
*/
#include <stdio.h>
#include "advent.h"
#include "advdec.h"
void score(scorng)
boolean scorng;
{
int cur_score, max_score, qk[3];
int obj, num_treas, k, i;
long t;
char *kk2c;
cur_score = 0;
max_score = 0;
num_treas = 0;
/** First tally up the treasures. Must be in building and not broken.
give the poor guy partial score just for finding each treasure.
Gets full score, qk[3], for obj if:
obj is at loc qk[1], and
obj has prop value of qk[2]
weight total possible
magazine 1 (absolute) 1
all the following are multiplied by 5 (range 5-25):
book 2
cask 3 (with wine only)
chain 4 (must enter via styx)
chest 5
cloak 3
clover 1
coins 5
crown 2
crystal-ball 2
diamonds 2
eggs 3
emerald 3
grail 2
horn 2
jewels 1
lyre 1
nugget 2
pearl 4
pyramid 4
radium 4
ring 4
rug 3
sapphire 1
shoes 3
spices 1
sword 4
trident 2
vase 2
droplet 5
tree 5
total: 85 * 5 = 425 + 1 ==> 426
*/
for (obj = 1; obj < MAXOBJ; obj++) {
if (g.points[obj] == 0)
continue;
t = g.points[obj];
qk[0] = (int) (t < 0L ? -((t = -t) % 1000) : (t % 1000));
t /= 1000;
qk[1] = (int) (t % 1000);
qk[2] = (int) (t / 1000);
k = 0;
if (treasr(obj)) {
num_treas++;
k = qk[2] * 2;
if (g.prop[obj] >= 0)
cur_score += k;
qk[2] *= 5;
}
if ((g.place[obj] == qk[0]) && (g.prop[obj] == qk[1])
&& ((g.place[obj] != -CHEST) || (g.place[CHEST] == 3))
&& ((g.place[obj] != -SHIELD) || (g.place[SHIELD] == -SAFE))
)
cur_score += qk[2] - k;
max_score += qk[2];
}
/**
Now look at how he finished and how far he got. Maxdie and numdie tell us
how well he survived. Gaveup says whether he exited via quit. Dflag will
tell us if he ever got suitably deep into the cave. Closing still indicates
whether he reached the endgame. And if he got as far as "cave closed"
(indicated by "closed"), then bonus is zero for mundane exits or 133, 134,
135 if he blew it (so to speak).
*/
if (g.dflag)
cur_score += 25;
max_score += 25;
if (g.closing)
cur_score += 20;
max_score += 20;
if (g.closed) {
if (g.bonus == 0)
cur_score += 10;
else if (g.bonus == 135)
cur_score += 20;
else if (g.bonus == 134)
cur_score += 25;
else if (g.bonus == 133)
cur_score += 30;
}
max_score += 30;
/* Deduct points for hints, deaths and quiting.
hints < hntmin are special; see database description
*/
for (i = 1; i <= HNTMAX; i++)
if (g.hinted[i])
cur_score -= g.hints[i][2];
cur_score -= g.numdie * 10;
if (gaveup)
cur_score -= 4;
fprintf(stdout, "You have found %3d out of %3d Treasures,",
num_treas - g.tally, num_treas);
fprintf(stdout, " using %4d turns\n", g.turns);
fprintf(stdout, "For a score of: %4d", cur_score);
fprintf(stdout, " out of a possible %4d\n", max_score);
if (cur_score < 110) {
fprintf(stdout, "You are obviously a rank amateur.");
if (!scorng)
fprintf(stdout, " Better luck next time.");
fputc('\n', stdout);
k = 110 - cur_score;
} else if (cur_score < 152) {
fprintf(stdout,
"Your score qualifies you as a Novice Class Adventurer.\n");
k = 152 - cur_score;
} else if (cur_score < 200) {
fprintf(stdout,
"You have achieved the rating: \"Experienced Adventurer\".\n");
k = 200 - cur_score;
} else if (cur_score < 277) {
fprintf(stdout,
"You may now consider yourself a \"Seasoned Adventurer\".\n");
k = 277 - cur_score;
} else if (cur_score < 345) {
fprintf(stdout,
"You have reached \"Junior Master\" status.\n");
k = 345 - cur_score;
} else if (cur_score < 451) {
fprintf(stdout,
"Your score puts you in Master Adventurer Class C.\n");
k = 451 - cur_score;
} else if (cur_score < 471) {
fprintf(stdout,
"Your score puts you in Master Adventurer Class B.\n");
k = 471 - cur_score;
} else if (cur_score < 501) {
fprintf(stdout,
"Your score puts you in Master Adventurer Class A.\n");
k = 501 - cur_score;
} else {
fprintf(stdout,
"All of Adventuredom gives tribute to you, Adventurer Grandmaster!\n");
k = 0;
}
if (!scorng) {
kk2c = (k == 1) ? "." : "s.";
printf("\nTo acheive the next higher rating,");
if (cur_score == 501)
printf(" would be a neat trick!\n\n CONGRATULATIONS!!\n");
else
printf(" you need %3d more point%s\n", k, kk2c);
}
return;
}

View file

@ -1,105 +0,0 @@
/** program SETUP.C *
* execution will read the four adventure text files *
* files; "advent1.txt", "advent2.txt", "advent3.txt" & *
* "advent4.txt". it will create the file "advtext.h" *
* which is an Index Sequential Access Method (ISAM) *
* header to be #included into "advent.c" before the *
* header "advdec.h" is #included. */
#include <stdio.h>
#include <stdlib.h>
#include "advent.h"
_PROTOTYPE(void file_error, (char *));
_PROTOTYPE(void encode, (unsigned char *));
int main(int argc, char *argv[])
{
FILE *isam, *src, *dest;
char itxt[255];
int cnt, i;
long llen;
char filename[100];
char *inputprefix = ".";
static char *headername[] = {
"idx1[MAXLOC]", "idx2[MAXLOC]", "idx3[MAXOBJ]", "idx4[MAXMSG]",
};
long x29 = (1L << 29), x30 = (1L << 30);
if(argc > 1) {
inputprefix=argv[1];
}
if (!(x30 / 2 == x29 && 0L < x30 && x29 < x30)) {
fprintf(stderr, "Sorry, advent needs 32-bit `long int's.\n");
exit(EXIT_FAILURE);
}
sprintf(filename, "%s/advtext.h", inputprefix);
isam = fopen(filename, "w");
if (!isam) {
fprintf(stderr, "Sorry, I can't open advtext.h...\n");
exit(EXIT_FAILURE);
}
fprintf(isam, "\n/*\theader: ADVTEXT.H\t\t\t\t\t*/\n\n\n");
for (i = 1; i <= 4; i++) {
cnt = -1;
llen = 0L;
sprintf(filename, "%s/advent%d.txt", inputprefix, i);
src = fopen(filename, "r");
if (!src)
file_error(filename);
sprintf(filename, "advent%d.dat", i);
dest = fopen(filename, "w");
if (!dest)
file_error(filename);
fprintf(isam, "long\t%s = {\n\t", headername[i - 1]);
while (fgets(itxt, 255, src)) {
encode((unsigned char *) itxt);
if (fprintf(dest, "%s\n", itxt) == EOF)
file_error(filename);
if (itxt[0] == '#') {
if (llen)
fprintf(isam, "%ld,%s\t", llen,
&"\0\0\0\0\0\0\0\n"[++cnt & 7]);
llen = ftell(dest);
if (llen <= 0) {
fprintf(stderr, "ftell err in %s\n", filename);
exit(EXIT_FAILURE);
} /* if (!llen) */
} /* if (itxt[0]) */
} /* while fgets */
if (fprintf(isam, "%ld\n\t};\n\n", llen) == EOF)
file_error("advtext.h");
fclose(src);
if (fclose(dest) == EOF)
file_error(filename);
}
if (fclose(isam) == EOF)
file_error("advtext.h");
return EXIT_SUCCESS;
} /* main */
void file_error(filename)
char *filename;
{
perror(filename);
exit(EXIT_FAILURE);
}
_CONST unsigned char key[4] = {'c' | 0x80, 'L' | 0x80, 'y' | 0x80, 'D' | 0x80};
void encode(msg)
unsigned char *msg;
{
register int i;
for (i = 1; msg[i]; i++)
msg[i] ^= key[i & 3];
msg[--i] = '\0';
return;
}

View file

@ -1,336 +0,0 @@
/* module TRAVEL.C *
* Routine to handle motion requests */
#include <stdio.h>
#include <stdlib.h>
#include "advent.h"
#include "advdec.h"
#include "advcave.h"
struct trav travel[MAXTRAV];
static int kalflg;
static int bcrossing = 0;
static int phuce[2][4] = {158, 160, 167, 166,
160, 158, 166, 167};
_PROTOTYPE(static void goback, (void));
_PROTOTYPE(static void ck_kal, (void));
_PROTOTYPE(static void dotrav, (void));
_PROTOTYPE(static void badmove, (void));
_PROTOTYPE(static void spcmove, (int rdest));
void domove()
{
gettrav(g.loc, travel);
switch (motion) {
case NULLX:
break;
case BACK:
goback();
break;
case CAVE:
if (outside(g.loc))
rspeak(57);
else
rspeak(58);
break;
default:
g.oldloc2 = g.oldloc;
g.oldloc = g.loc;
dotrav();
}
newtravel = TRUE;
return;
}
/*
Routine to handle request to return
from whence we came!
*/
static void goback()
{
int kk, k2, want, temp;
struct trav strav[MAXTRAV];
want = forced(g.oldloc) ? g.oldloc2 : g.oldloc;
g.oldloc2 = g.oldloc;
g.oldloc = g.loc;
k2 = 0;
if (want == g.loc) {
rspeak(91);
ck_kal();
return;
}
for (kk = 0; travel[kk].tdest != -1; ++kk) {
if (!travel[kk].tcond && travel[kk].tdest == want) {
motion = travel[kk].tverb;
dotrav();
return;
}
if (!travel[kk].tcond) {
temp = travel[kk].tdest;
gettrav(temp, strav);
if (forced(temp) && strav[0].tdest == want)
k2 = temp;
}
}
if (k2) {
motion = travel[k2].tverb;
dotrav();
} else
rspeak(140);
ck_kal();
return;
}
static void ck_kal()
{
if (g.newloc >= 242 && g.newloc <= 247) {
if (g.newloc == 242)
kalflg = 0;
else if (g.newloc == (g.oldloc + 1))
kalflg++;
else
kalflg = -10;
}
}
/*
Routine to figure out a new location
given current location and a motion.
*/
static void dotrav()
{
unsigned char mvflag, hitflag, kk;
int rdest, rverb, rcond, robject;
int pctt;
g.newloc = g.loc;
mvflag = hitflag = 0;
pctt = ranz(100);
for (kk = 0; travel[kk].tdest >= 0 && !mvflag; ++kk) {
rdest = travel[kk].tdest;
rverb = travel[kk].tverb;
rcond = travel[kk].tcond;
robject = rcond % 100;
if ((rverb != 1) && (rverb != motion) && !hitflag)
continue;
++hitflag;
switch (rcond / 100) {
case 0:
if ((rcond == 0) || (pctt < rcond))
++mvflag;
break;
case 1:
if (robject == 0)
++mvflag;
else if (toting(robject))
++mvflag;
break;
case 2:
if (toting(robject) || at(robject))
++mvflag;
break;
case 3:
case 4:
case 5:
case 7:
if (g.prop[robject] != (rcond / 100) - 3)
++mvflag;
break;
default:
bug(37);
}
}
if (!mvflag)
badmove();
else if (rdest > 500)
rspeak(rdest - 500);
else if (rdest > 300)
spcmove(rdest);
else {
g.newloc = rdest;
ck_kal();
}
newtravel = TRUE;
return;
}
/*
The player tried a poor move option.
*/
static void badmove()
{
int msg;
msg = 12;
if (motion >= 43 && motion <= 50)
msg = 9;
if (motion == 29 || motion == 30)
msg = 9;
if (motion == 7 || motion == 36 || motion == 37)
msg = 10;
if (motion == 11 || motion == 19)
msg = 11;
if (motion == 62 || motion == 65 || motion == 82)
msg = 42;
if (motion == 17)
msg = 80;
rspeak(msg);
return;
}
/*
Routine to handle very special movement.
*/
static void spcmove(rdest)
int rdest;
{
int load, obj, k;
switch (rdest - 300) {
case 1: /* plover movement via alcove */
load = burden(0);
if (!load || (load == burden(EMERALD) && holding(EMERALD)))
g.newloc = (99 + 100) - g.loc;
else
rspeak(117);
break;
case 2: /* trying to remove plover, bad
route */
if (enclosed(EMERALD))
extract(EMERALD);
drop(EMERALD, g.loc);
g.newloc = 33;
break;
case 3: /* troll bridge */
if (g.prop[TROLL] == 1) {
pspeak(TROLL, 1);
g.prop[TROLL] = 0;
move(TROLL2, 0);
move((TROLL2 + MAXOBJ), 0);
move(TROLL, plac[TROLL]);
move((TROLL + MAXOBJ), fixd[TROLL]);
juggle(CHASM);
g.newloc = g.loc;
} else {
g.newloc = plac[TROLL] + fixd[TROLL] - g.loc;
if (g.prop[TROLL] == 0)
g.prop[TROLL] = 1;
if (toting(BEAR)) {
rspeak(162);
g.prop[CHASM] = 1;
g.prop[TROLL] = 2;
drop(BEAR, g.newloc);
g.fixed[BEAR] = -1;
g.prop[BEAR] = 3;
if (g.prop[SPICES] < 0)
++g.tally2;
g.oldloc2 = g.newloc;
death();
}
}
break;
case 4:
/* Growing or shrinking in area of tiny door. Each time he
does this, everything must be moved to the new loc.
Presumably, all his possesions are shrunk or streched along
with him. Phuce[2][4] is an array containg four pairs of
"here" (K) and "there" (KK) locations. */
k = phuce[0][g.loc - 161];
g.newloc = phuce[1][g.loc - 161];
for (obj = 1; obj < MAXOBJ; obj++) {
if (obj == BOAT)
continue;
if (g.place[obj] == k && (g.fixed[obj] == 0 || g.fixed[obj] == -1))
move(obj, g.newloc);
}
break;
case 5:
/* Phone booth in rotunda. Trying to shove past gnome, to get
into phone booth. */
if ((g.prop[BOOTH] == 0 && pct(35)) || g.visited[g.loc] == 1) {
rspeak(263);
g.prop[BOOTH] = 1;
move(GNOME, 188);
} else {
if (g.prop[BOOTH] == 1)
rspeak(253);
else
g.newloc = 189;
}
break;
case 6:
/* Collapsing clay bridge. He can cross with three (or fewer)
thing. If more, of if carrying obviously heavy things, he
may end up in the drink. */
g.newloc = g.loc == 235 ? 190 : 235;
bcrossing++;
load = burden(0);
if (load > 4) {
k = (load + bcrossing) * 6 - 10;
if (!pct(k))
rspeak(318);
else {
rspeak(319);
g.newloc = 236;
if (holding(LAMP))
move(LAMP, 236);
if (toting(AXE) && enclosed(AXE))
extract(AXE);
if (holding(AXE))
move(AXE, 208);
for (obj = 1; obj < MAXOBJ; obj++)
if (toting(obj))
destroy(obj);
g.prop[CHASM2] = 1;
}
}
break;
case 7:
/* Kaleidoscope code is here. */
if (kalflg == 5) {
g.newloc = 248;
g.oldloc = 247;
} else {
g.newloc = 242 + ranz(5);
g.oldloc = g.newloc - 1;
kalflg = g.newloc == 242 ? 0 : -10;
}
break;
default:
bug(38);
}
return;
}
/*
Routine to fill travel array for a given location
*/
void gettrav(loc, travel)
int loc;
struct trav *travel;
{
int i;
long t, *lptr;
lptr = cave[loc - 1];
for (i = 0; i < MAXTRAV; i++) {
t = *lptr++;
if (!(t)) {
travel->tdest = -1; /* end of array */
return; /* terminate for loop */
}
travel->tverb = (int) (t % 1000);
t /= 1000;
travel->tdest = (int) (t % 1000);
t /= 1000;
travel->tcond = (int) (t % 1000);
travel++;
}
bug(25);
return;
}

View file

@ -1,729 +0,0 @@
/* program TURN.C */
#include <stdio.h>
#include <stdlib.h>
#include "advent.h"
#include "advdec.h"
_PROTOTYPE(void descitem, (void));
_PROTOTYPE(void domove, (void));
_PROTOTYPE(void goback, (void));
_PROTOTYPE(void copytrv, (struct trav *, struct trav *));
_PROTOTYPE(void dotrav, (void));
_PROTOTYPE(void badmove, (void));
_PROTOTYPE(void spcmove, (int));
_PROTOTYPE(void death, (void));
_PROTOTYPE(void dwarves, (void));
_PROTOTYPE(void dopirate, (void));
_PROTOTYPE(int stimer, (void));
_PROTOTYPE(void do_hint, (int));
/*
Routine to take 1 turn
*/
void turn()
{
int i, hint;
static int waste = 0;
if (newtravel) {
/* If closing, then he can't leave except via the main office. */
if (outside(g.newloc) && g.newloc != 0 && g.closing) {
rspeak(130);
g.newloc = g.loc;
if (!g.panic)
g.clock2 = 15;
g.panic = TRUE;
}
/* See if a dwarf has seen him and has come from where he wants
to go. */
if (g.newloc != g.loc && !forced(g.loc) && g.loc_attrib[g.loc] & NOPIRAT == 0)
for (i = 1; i < (DWARFMAX - 1); ++i)
if (g.odloc[i] == g.newloc && g.dseen[i]) {
g.newloc = g.loc;
rspeak(2);
break;
}
g.loc = g.newloc;
dwarves(); /* & special dwarf(pirate who
steals) */
/* Check for death */
if (g.loc == 0) {
death();
return;
}
/* Check for forced move */
if (forced(g.loc)) {
desclg(g.loc);
++g.visited[g.loc];
domove();
return;
}
/* Check for wandering in dark */
if (g.wzdark && dark() && pct(35)) {
rspeak(23);
g.oldloc2 = g.loc;
death();
return;
}
/* see if he is wasting his batteies out in the open */
if (outside(g.loc) && g.prop[LAMP]) {
waste++;
if (waste > 11) {
rspeak(324);
waste = 0;
}
} else
waste = 0;
/* If wumpus is chasing stooge, see if wumpus gets him */
if (g.chase) {
g.chase++;
g.prop[WUMPUS] = g.chase / 2;
move(WUMPUS, g.loc);
if (g.chase >= 10) {
if (dark())
rspeak(270);
pspeak(WUMPUS, 5);
death();
return;
}
}
/* check for radiation poisoning. */
g.health += (outside(g.loc)) ? 3 : 1;
if (g.health > 100)
g.health = 100;
if (here(RADIUM) && (g.place[RADIUM] != -SHIELD || ajar(SHIELD)))
g.health -= 7;
if (g.health < 60) {
rspeak(391 + (60 - g.health) / 10);
if (g.health < 0) {
death();
return;
}
}
if ((g.oldloc == 188) && (g.loc != 188 && g.loc != 189)
&& (g.prop[BOOTH] == 1)) {
move(GNOME, 0);
g.prop[BOOTH] = 0;
}
/* Describe his situation */
describe();
if (!blind()) {
++g.visited[g.loc];
descitem();
}
} /* end of newtravel start for
second entry point */
/* Check if this location is eligible for any hints. If been here
long enough, branch to help section. Ignore "hints" < HNTMIN
(special stuff, see database notes. */
for (hint = HNTMIN; hint <= HNTMAX; hint++) {
if (g.hinted[hint])
continue;
if (g.loc_attrib[g.loc] / 256 != hint - 6)
g.hintlc[hint] = -1;
g.hintlc[hint]++;
if (g.hintlc[hint] >= g.hints[hint][1])
do_hint(hint);
}
if (g.closed) {
if (g.prop[OYSTER] < 0 && toting(OYSTER))
pspeak(OYSTER, 1);
for (i = 1; i < MAXOBJ; ++i)
if (toting(i) && g.prop[i] < 0)
g.prop[i] = -1 - g.prop[i];
}
g.wzdark = dark();
if (g.knfloc > 0 && g.knfloc != g.loc)
g.knfloc = 0;
++g.turns;
i = rand();
if (stimer()) /* as the grains of sand slip
by */
return;
while (!english()) /* retrieve player instructions */
;
vrbx = 1;
objx = objs[1] ? 1 : 0;
iobx = iobjs[1] ? 1 : 0;
verb = VAL(verbs[vrbx]);
do {
object = objx ? objs[objx] : 0;
iobj = iobx ? iobjs[iobx] : 0;
if (object && (objs[2] || iobjs[2])) {
pspeak(object, -1);
printf(" ");
}
switch (CLASS(verbs[vrbx])) {
case MOTION:
motion = verb;
domove();
break;
case NOUN:
bug(22);
case ACTION:
if (object || iobj)
trverb();
else
itverb();
break;
case MISC:
rspeak(verb);
if (verb == 51)
g.hinted[1] = TRUE;
break;
default:
bug(22);
}
if (objx) {
objx++;
if (objs[objx] == 0)
objx = 0;
}
if ((!objx || !objs[objx]) && iobx) {
iobx++;
if (iobjs[iobx] == 0)
iobx = 0;
if (iobx && iobjs[1])
objx = 1;
}
} while (objx || iobx);
return;
}
/*
Routine to describe current location
*/
void describe()
{
if (toting(BEAR))
rspeak(141);
if (dark())
rspeak(16);
else if ((g.terse && verb != LOOK) || g.visited[g.loc] % g.abbnum)
descsh(g.loc);
else
desclg(g.loc);
if (g.loc == 33 && pct(25) && !g.closing)
rspeak(8);
if (g.loc == 147 && !g.visited[g.loc])
rspeak(216);
return;
}
/*
Routine to describe visible items
*/
void descitem()
{
int i, state;
for (i = 1; i < MAXOBJ; ++i) {
if (at(i)) {
if (i == STEPS && toting(NUGGET))
continue;
if (g.prop[i] < 0) {
if (g.closed)
continue;
else {
g.prop[i] = 0;
if (i == RUG || i == CHAIN
|| i == SWORD || i == CASK)
g.prop[i] = 1;
if (i == CLOAK || i == RING)
g.prop[i] = 2;
--g.tally;
}
}
if (i == STEPS && g.loc == g.fixed[STEPS])
state = 1;
else
state = g.prop[i] % 8;
pspeak(i, state);
lookin(i);
}
}
/* If remaining treasures too elusive, zap his lamp */
if (g.tally == g.tally2 && g.tally != 0 && g.limit > 35)
g.limit = 35;
return;
}
/*
Routine to handle player's demise via
waking up the dwarves...
*/
void dwarfend()
{
rspeak(136);
normend();
return;
}
/*
normal end of game
*/
void normend()
{
score(FALSE);
gaveup = TRUE;
return;
}
/*
Routine to handle the passing on of one
of the player's incarnations...
*/
void death()
{
int yea, j;
if (!g.closing) {
if (g.limit < 0) {
rspeak(185);
normend();
return;
}
yea = yes(81 + g.numdie * 2, 82 + g.numdie * 2, 54);
if (++g.numdie >= MAXDIE || !yea)
normend();
if (g.chase) {
g.chase = FALSE;
g.prop[WUMPUS] = 0;
move(WUMPUS, 174);
}
if (toting(LAMP))
g.prop[LAMP] = 0;
for (j = 1; j < MAXOBJ; ++j) {
if (toting(j))
drop(j, j == LAMP ? 1 : g.oldloc2);
if (wearng(j)) {
g.prop[j] = 0;
bitoff(j, WEARBT);
}
}
g.newloc = 3;
g.oldloc = g.loc;
g.health = 100;
return;
}
/* Closing -- no resurrection... */
rspeak(131);
++g.numdie;
normend();
return;
}
/*
dwarf stuff.
*/
void dwarves()
{
int i, j, k, attack, stick, dtotal;
/* See if dwarves allowed here */
if (g.newloc == 0 || forced(g.newloc) || g.loc_attrib[g.newloc] & NOPIRAT)
return;
/* See if dwarves are active. */
if (!g.dflag) {
if (inside(g.newloc))
++g.dflag;
return;
}
/* If first close encounter (of 3rd kind) */
if (g.dflag == 1) {
if (!inside(g.newloc) || pct(85))
return;
++g.dflag;
/* kill 0, 1 or 2 of the dwarfs */
for (i = 1; i < 3; ++i)
if (pct(50))
g.dloc[(ranz(DWARFMAX - 1)) + 1] = 0;
/* If any of the survivors is at location, use alternate choise */
for (i = 1; i <= DWARFMAX; ++i) {
if (g.dloc[i] == g.newloc)
g.dloc[i] = g.daltloc;
g.odloc[i] = g.dloc[i];
}
rspeak(3);
drop(AXE, g.newloc);
return;
}
/* Things are in full swing. Move each dwarf at random, except if
he's seen us then he sticks with us. Dwarfs never go to
locations outside or meet the bear or following him into dead
end in maze. And of couse, dead dwarves don't do much of
anything. */
dtotal = attack = stick = 0;
for (i = 1; i <= DWARFMAX; ++i) {
if (g.dloc[i] == 0)
continue;
/* Move a dwarf at random. we don't have a matrix around to do
it as in the original version... */
do
j = ranz(106) + 15;
/* allowed area */
while (j == g.odloc[i] || j == g.dloc[i]
|| g.loc_attrib[j] & NOPIRAT);
if (j == 0)
bug(36);
g.odloc[i] = g.dloc[i];
g.dloc[i] = j;
g.dseen[i] = ((g.dseen[i] && inside(g.newloc))
|| g.dloc[i] == g.newloc
|| g.odloc[i] == g.newloc);
if (g.dseen[i]) {
g.dloc[i] = g.newloc;
if (i == DWARFMAX)
dopirate();
else {
++dtotal;
if (g.odloc[i] == g.dloc[i]) {
++attack;
if (g.knfloc >= 0)
g.knfloc = g.newloc;
if (ranz(1000) < (45 * (g.dflag - 2)))
++stick;
}
}
}
}
/* Now we know shat's happing, let's tell the poor sucker about it */
if (dtotal == 0)
return;
if (dtotal > 1)
printf("There are %d threatening little dwarves in the room with you!\n", dtotal);
else
rspeak(4);
if (attack == 0)
return;
if (g.dflag == 2)
++g.dflag;
if (attack > 1) {
printf("%d of them throw knives at you!!\n", attack);
k = 6;
} else {
rspeak(5);
k = 52;
}
if (stick <= 1) {
rspeak(stick + k);
if (stick == 0)
return;
} else
printf("%d of them get you !!!\n", stick);
g.oldloc2 = g.newloc;
death();
return;
}
/*
pirate stuff
*/
void dopirate()
{
int j;
boolean k;
if (g.newloc == g.chloc || g.prop[CHEST] >= 0)
return;
k = FALSE;
/* Pirate won't take pyramid from plover room or dark room (too
easy! ) */
for (j = 1; j < MAXOBJ; ++j)
if (treasr(j) && !(j == CASK && liq(CASK) == WINE)
&& !(j == PYRAMID && (g.newloc == g.place[PYRAMID]
|| g.newloc == g.place[EMERALD]))) {
if (toting(j) && athand(j))
goto stealit;
if (here(j))
k = TRUE;
}
if (g.tally == g.tally2 + 1 && k == FALSE && g.place[CHEST] == 0 &&
athand(LAMP) && g.prop[LAMP] == 1) {
rspeak(186);
move(CHEST, g.chloc);
move(MESSAGE, g.chloc2);
g.dloc[DWARFMAX] = g.chloc;
g.odloc[DWARFMAX] = g.chloc;
g.dseen[DWARFMAX] = 0;
return;
}
if (g.odloc[DWARFMAX] != g.dloc[DWARFMAX] && pct(30))
rspeak(127);
return;
stealit:
rspeak(128);
/* don't steal chest back from troll! */
if (g.place[MESSAGE] == 0)
move(CHEST, g.chloc);
move(MESSAGE, g.chloc2);
for (j = 1; j < MAXOBJ; ++j) {
if (!treasr(j) || !athand(j)
|| (j == PYRAMID &&
(g.newloc == plac[PYRAMID] || g.newloc == plac[EMERALD]))
|| (j == CASK && (liq(CASK) != WINE)))
continue;
if (enclosed(j))
extract(j);
if (wearng(j)) {
g.prop[j] = 0;
bitoff(j, WEARBT);
}
insert(j, CHEST);
}
g.dloc[DWARFMAX] = g.chloc;
g.odloc[DWARFMAX] = g.chloc;
g.dseen[DWARFMAX] = FALSE;
return;
}
/*
special time limit stuff...
*/
int stimer()
{
int i, spk;
static int clock3;
g.foobar = g.foobar > 0 ? -g.foobar : 0;
g.combo = g.combo > 0 ? -g.combo : 0;
if (g.turns > 310 && g.abbnum != 10000 && !g.terse)
rspeak(273);
/* Bump all the right clocks for reconning battery life and closing */
if (g.closed) {
clock3--;
if (clock3 == 0) {
g.prop[PHONE] = 0;
g.prop[BOOTH] = 0;
rspeak(284);
} else if (clock3 < -7) {
rspeak(254);
normend();
return (TRUE);
}
}
if (g.tally == 0 && inside(g.loc) && g.loc != Y2)
--g.clock;
if (g.clock == 0) {
/* Start closing the cave */
g.prop[GRATE] = 0;
biton(GRATE, LOCKBT);
bitoff(GRATE, OPENBT);
g.prop[FISSURE] = 0;
g.prop[TDOOR] = 0;
biton(TDOOR, LOCKBT);
bitoff(TDOOR, OPENBT);
g.prop[TDOOR2] = 0;
biton(TDOOR2, LOCKBT);
bitoff(TDOOR2, OPENBT);
for (i = 1; i <= DWARFMAX; ++i) {
g.dseen[i] = FALSE;
g.dloc[i] = 0;
}
move(TROLL, 0);
move((TROLL + MAXOBJ), 0);
move(TROLL2, plac[TROLL]);
move((TROLL2 + MAXOBJ), fixd[TROLL]);
juggle(CHASM);
if (g.prop[BEAR] != 3)
destroy(BEAR);
g.prop[CHAIN] = 0;
g.fixed[CHAIN] = 0;
g.prop[AXE] = 0;
g.fixed[AXE] = 0;
rspeak(129);
g.clock = -1;
g.closing = TRUE;
return (FALSE);
}
if (g.clock < 0)
--g.clock2;
if (g.clock2 == 0) {
/* Set up storage room... and close the cave... */
g.prop[BOTTLE] = put(BOTTLE, 115, 8);
g.holder[BOTTLE] = WATER;
g.place[WATER] = -BOTTLE;
g.hlink[WATER] = 0;
bitoff(BOTTLE, OPENBT);
g.prop[PLANT] = put(PLANT, 115, 0);
g.prop[OYSTER] = put(OYSTER, 115, 0);
g.prop[LAMP] = put(LAMP, 115, 0);
g.prop[ROD] = put(ROD, 115, 0);
g.prop[DWARF] = put(DWARF, 115, 0);
g.loc = 115;
g.oldloc = 115;
g.newloc = 115;
/* Leave the grate with normal (non-negative property). */
put(GRATE, 116, 0);
biton(GRATE, LOCKBT);
bitoff(GRATE, OPENBT);
g.prop[SNAKE] = put(SNAKE, 116, 1);
g.prop[BIRD] = put(BIRD, 116, 1);
g.prop[CAGE] = put(CAGE, 116, 0);
g.prop[ROD2] = put(ROD2, 116, 0);
g.prop[PILLOW] = put(PILLOW, 116, 0);
g.prop[BOOTH] = put(BOOTH, 116, -3);
g.fixed[BOOTH] = 115;
g.prop[PHONE] = put(PHONE, 212, -4);
g.prop[MIRROR] = put(MIRROR, 115, 0);
g.fixed[MIRROR] = 116;
g.prop[BOOK2] = put(BOOK2, 115, 0);
for (i = 1; i < MAXOBJ; ++i) {
if (toting(i) && enclosed(i))
extract(i);
if (toting(i))
destroy(i);
}
rspeak(132);
g.closed = TRUE;
clock3 = 20 + ranz(20);
newtravel = TRUE;
return (TRUE);
}
if (g.prop[LAMP] == 1)
--g.limit;
if (g.limit == 0) {
--g.limit;
g.prop[LAMP] = 0;
if (here(LAMP))
rspeak(184);
return (FALSE);
}
if (g.limit < 0 && outside(g.loc)) {
rspeak(185);
normend();
return (TRUE);
}
if (g.limit <= 40) {
if (g.lmwarn || !here(LAMP))
return (FALSE);
g.lmwarn = TRUE;
spk = 187;
if (g.prop[BATTERIES] == 1)
spk = 323;
if (g.place[BATTERIES] == 0)
spk = 183;
if (g.prop[VEND] == 1)
spk = 189;
rspeak(spk);
return (FALSE);
}
return (FALSE);
}
/* HINTS
come here if he's been long enough at required location(s)
for some unused hint, hint number is in variable "hint".
Branch to quick test for additional conditions, then
do neet stuff. If conditions are met and we want to offer
hint. Clear hintlc if no action is taken.
*/
#define MASE 1
#define DARK 2
#define WITT 3
#define H_SWORD 4
#define SLIDE 5
#define H_GRATE 6
#define H_BIRD 7
#define H_ELFIN 8
#define RNBOW 9
#define STYX 10
#define H_SNAKE 11
#define CASTLE 12
void do_hint(hint)
int hint;
{
g.hintlc[hint] = 0;
switch (hint + 1 - HNTMIN) {
case MASE:
if (!at(g.loc) && !at(g.oldloc)
&& !at(g.loc) && burden(0) > 1)
break;
else
return;
case DARK:
if (g.prop[EMERALD] != -1 && g.prop[PYRAMID] == -1)
break;
else
return;
case WITT:
break;
case H_SWORD:
if ((g.prop[SWORD] == 1 || g.prop[SWORD] == 5)
&& !toting(CROWN))
break;
else
return;
case SLIDE:
break;
case H_GRATE:
if (g.prop[GRATE] == 0 && !athand(KEYS))
break;
else
return;
case H_BIRD:
if (here(BIRD) && athand(ROD) && object == BIRD)
break;
else
return;
case H_ELFIN:
if (!g.visited[159])
break;
else
return;
case RNBOW:
if (!toting(SHOES) || g.visited[205])
break;
else
return;
case STYX:
if (!athand(LYRE) && g.prop[DOG] != 1)
break;
else
return;
case H_SNAKE:
if (here(SNAKE) && !here(BIRD))
break;
else
return;
case CASTLE:
break;
default:
printf(" TRYING TO PRINT HINT # %d\n", hint);
bug(27);
}
if (!yes(g.hints[hint][3], 0, 54))
return;
printf("\nI am prepared to give you a hint,");
printf(" but it will cost you %2d points\n", g.hints[hint][2]);
g.hinted[hint] = yes(175, g.hints[hint][4], 54);
if (g.hinted[hint] && g.limit > 30)
g.limit += 30 * g.hints[hint][2];
return;
}

View file

@ -1,749 +0,0 @@
/*
Utility Routines
the next logical funtions describe attributes of objects.
(ajar, hinged, opaque, printd, treasr, vessel, wearng)
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "advent.h"
#include "advdec.h"
/*
ajar .TRUE. if item is container and is open or unhinged
*/
boolean ajar(item)
int item;
{
return ((bitset(g.obj_state[item], OPENBT))
|| (vessel(item) && !hinged(item)));
}
/*
at .TRUE. To tell if player is on either side of a two sided object.
*/
boolean at(item)
int item;
{
if (item < 1 || item > MAXOBJ)
return (FALSE);
else
return (g.place[item] == g.loc || g.fixed[item] == g.loc);
}
/*
athand .TRUE. if item readily reachable
it can be lying here, in hand or in open container.
*/
boolean athand(item)
int item;
{
int contnr;
boolean aaa;
contnr = -g.place[item];
aaa = enclosed(item) && ajar(contnr);
return ((g.place[item] == g.loc) || holding(item)
|| (aaa && ((g.place[contnr] == g.loc)
|| (toting(item) && holding(contnr)))));
}
/*
bitoff turns off (sets to 0) a bit in obj_state word
*/
void bitoff(obj, bit)
int obj, bit;
{
long val;
val = 1L << bit;
g.obj_state[obj] &= ~val;
}
/*
biton turns on (sets to 1) a bit in obj_state word
*/
void biton(obj, bit)
int obj, bit;
{
long val;
val = 1L << bit;
g.obj_state[obj] |= val;
}
/*
bitset .TRUE. if object_state has bit N set
*/
boolean bitset(state, bit)
long state;
int bit;
{
return (((state >> bit) & 1) == 1);
}
/*
blind .TRUE. if you can't see at this loc, (darkness of glare)
*/
boolean blind()
{
return (dark() || (g.loc == 200
&& athand(LAMP) && (g.prop[LAMP] == 1)));
}
/*
burden .. returns weight of items being carried
if obj=0, burden calculates the total weight of the adventurer's burden
including everything in all containers (except the boat) that he is
carring.
if object is a container, calculate the weight of everything inside
the container (including the container itself). Since donkey FORTRAN
isn't recursive, we will only calculate weight of contained containers
one level down. The only serious contained container would be the sack
The only thing we'll miss will be filled VS empty bottle or cage.
If object isn't a container, return its weight.
*/
int burden(obj)
int obj;
{
int i, sum, temp;
sum = 0;
if (obj == 0) {
for (i = 1; i < MAXOBJ; i++) {
if (toting(i) && (g.place[i] != -BOAT))
sum += g.weight[i];
}
} else {
if (obj != BOAT) {
sum = g.weight[obj];
temp = g.holder[obj];
while (temp != 0) {
sum += g.weight[temp];
temp = g.hlink[temp];
}
}
}
return (sum);
}
/*
Routine to carry an object
start toting an object, removing it from the list of things
at its former location. If object > MAXOBJ ( moving "FIXED"
or second loc), then don't change place.
*/
void carry(obj, where)
int obj, where;
{
int temp;
if (obj < MAXOBJ) {
if (g.place[obj] == -1)
return;
g.place[obj] = -1;
}
if (g.atloc[where] == obj)
g.atloc[where] = g.link[obj];
else {
temp = g.atloc[where];
while (g.link[temp] != obj) {
temp = g.link[temp];
if (temp == 0)
bug(35);
}
g.link[temp] = g.link[obj];
}
return;
}
/*
confuz generates some variant of "Don't understand that" message.
*/
int confuz()
{
int msg;
msg = 60;
if (pct(50))
msg = 61;
if (pct(33))
msg = 13;
if (pct(25))
msg = 347;
if (pct(20))
msg = 195;
return (msg);
}
/*
dark .TRUE. if there is no light here
*/
boolean dark()
{
return (!(g.loc_attrib[g.loc] & LIGHT) &&
(!g.prop[LAMP] || !athand(LAMP)));
}
/*
Routine to check for presence
of dwarves..
*/
int dcheck()
{
int i;
for (i = 1; i < (DWARFMAX); ++i)
if (g.dloc[i] == g.loc)
return (i);
return (0);
}
/*
dead .TRUE. if object is now dead
*/
boolean dead(obj)
int obj;
{
return (bitset(g.obj_state[obj], 10));
}
/*
drop Place an object at a given loc, prefixing it onto the atloc list.
*/
void drop(obj, where)
int obj, where;
{
if (obj > MAXOBJ)
g.fixed[obj - MAXOBJ] = where;
else
g.place[obj] = where;
if (where > 0) {
g.link[obj] = g.atloc[where];
g.atloc[where] = obj;
}
return;
}
/*
destroy Permanently eliminate "object" by moving it to
a non-existent location.
*/
void destroy(obj)
int obj;
{
move(obj, 0);
return;
}
/*
edible .TRUE. if obj can be eaten.
*/
boolean edible(obj)
int obj;
{
return (bitset(g.obj_state[obj], 7));
}
/*
enclosed .TRUE. If object is inside a container.
*/
boolean enclosed(item)
int item;
{
if (item < 1 || item > MAXOBJ)
return (FALSE);
else
return (g.place[item] < -1);
}
/*
extract remove "object" from a container.
origionally name "remove" but rename to avoid conflict with stdio.h
*/
void extract(obj)
int obj;
{
int contnr, temp;
contnr = -g.place[obj];
g.place[obj] = -1;
if (g.holder[contnr] == obj)
g.holder[contnr] = g.hlink[obj];
else {
temp = g.holder[contnr];
while (g.hlink[temp] != obj) {
temp = g.hlink[temp];
if (temp == 0)
bug(35);
}
g.hlink[temp] = g.hlink[obj];
}
return;
}
/*
forced To tell if a location will causes a forced move.
A forced location is one from which he is immediately bounced
to another. Normal use is for death (forced to location zero)
and for description of journey from on place to another.
*/
int forced(at_loc)
int at_loc;
{
return ((g.loc_attrib[at_loc] & 10) == 2);
}
/*
here .TRUE. If an item is at location or is being carried.
*/
boolean here(item)
int item;
{
return (g.place[item] == g.loc || toting(item));
}
/*
hinged .TRUE. If object can be opened or shut.
*/
boolean hinged(object)
int object;
{
return (bitset(g.obj_state[object], 1));
}
/*
holding .TRUE. If the object is being carried in hand.
*/
boolean holding(item)
int item;
{
if (item < 1 || item > MAXOBJ)
return (FALSE);
else
return (g.place[item] == -1);
}
/*
insert
*/
void insert(obj, contnr)
int obj, contnr;
{
int temp;
if (contnr == obj)
bug(32);
carry(obj, g.loc);
temp = g.holder[contnr];
g.holder[contnr] = obj;
g.hlink[obj] = temp;
g.place[obj] = -contnr;
}
/*
inside = .TRUE. If location is well within cave
*/
boolean inside(loc)
int loc;
{
return (!outside(loc) && !portal(loc));
}
/*
Juggle an object by picking it up and putting it down again,
The purpose being to get the object to the front of the chain
at its loc.
*/
void juggle(obj)
int obj;
{
int i, j;
i = g.place[obj];
j = g.fixed[obj];
move(obj, i);
move(obj + MAXOBJ, j);
return;
}
/*
Determine liquid in the vessel
*/
int liq(item)
int item;
{
int liquid;
if ((item == BOTTLE) || (item == CASK))
liquid = liq2(((int) g.prop[item] >> 1) & 7);
else
liquid = 0;
return (liquid);
}
/*
Determine type of liquid in vessel
*/
int liq2(liquid)
int liquid;
{
switch (liquid) {
case 4:
return (WATER);
case 5:
return (OIL);
case 6:
return (WINE);
default:
return (0); /* empty */
}
}
/*
Determine liquid at a location
*/
int liqloc(loc)
int loc;
{
return (liq2((int) ((g.loc_attrib[loc] >> 1) & 7)));
}
/*
living .TRUE. If object is living, bear for example
*/
boolean living(obj)
int obj;
{
return (bitset(g.obj_state[obj], 9));
}
/*
locked .TRUE. if lockable object is locked
*/
boolean locked(item)
int item;
{
return (bitset(g.obj_state[item], 4));
}
/*
locks .TRUE. if you can lock this object
*/
boolean locks(item)
int item;
{
return (bitset(g.obj_state[item], 3));
}
/*
LOOKIN list contents if obj is a container and is open or transparent.
*/
void lookin(contnr)
int contnr;
{
int temp;
boolean first_time;
if (vessel(contnr) && (ajar(contnr) || !opaque(contnr))) {
temp = g.holder[contnr];
first_time = TRUE;
while (temp != 0) {
if (first_time)
rspeak(360);
printf(" ");
pspeak(temp, -1);
temp = g.hlink[temp];
first_time = FALSE;
}
}
return;
}
/*
Routine to move an object
*/
void move(obj, where)
int obj, where;
{
int from;
if (obj > MAXOBJ)
from = g.fixed[obj - MAXOBJ];
else {
if (enclosed(obj))
extract(obj);
from = g.place[obj];
}
if ((from > 0) && (from < MAXOBJ * 2))
carry(obj, from);
drop(obj, where);
return;
}
/*
noway, generate's some variant of "can't do that" message.
*/
int noway()
{
int msg;
msg = 14;
if (pct(50))
msg = 110;
if (pct(33))
msg = 147;
if (pct(25))
msg = 250;
if (pct(20))
msg = 262;
if (pct(17))
msg = 25;
if (pct(14))
msg = 345;
if (pct(12))
msg = 346;
return (msg);
}
/*
opaque .TRUE. If obj is non-transparent container
*/
boolean opaque(obj)
int obj;
{
return (bitset(g.obj_state[obj], 6));
}
/*
outsid .TRUE. If location is outside the cave
*/
boolean outside(loc)
int loc;
{
return (bitset(g.loc_attrib[loc], 6));
}
/*
Routine true x% of the time. (x an integer from 0 to 100)
*/
int pct(x)
int x;
{
return (ranz(100) < x);
}
/*
plural .TRUE. if object is multiple objects
*/
boolean plural(obj)
int obj;
{
return (bitset(g.obj_state[obj], 13));
}
/*
portal .TRUE. If location is a cave entrance
*/
boolean portal(loc)
int loc;
{
return (bitset(g.loc_attrib[loc], 5));
}
/*
printed .TRUE. If object can be read.
*/
boolean printed(obj)
int obj;
{
return (bitset(g.obj_state[obj], 8));
}
/*
put is the same as move, except it returns a
value used to set the negated prop values
for the repository objects.
*/
int put(obj, where, pval)
int obj, where, pval;
{
move(obj, where);
return ((-1) - pval);
}
/*
RANZ
*/
int ranz(range)
int range;
{
return (rand() % range);
}
/*
small .TRUE. If object fits in sack or small container
*/
boolean small(obj)
int obj;
{
return (bitset(g.obj_state[obj], 5));
}
/*
toting .TRUE. If an item is being caried.
*/
int toting(item)
int item;
{
boolean aaa, bbb, ccc;
int contnr, outer, outer2;
contnr = -g.place[item];
outer = -g.place[contnr];
outer2 = -g.place[outer];
aaa = holding(contnr);
bbb = enclosed(contnr) && holding(outer);
ccc = enclosed(outer) && holding(outer2);
return (holding(item) || (enclosed(item) && (aaa || bbb || ccc)));
}
/*
treasr .TRUE. If object is valuable for points
*/
boolean treasr(obj)
int obj;
{
return (bitset(g.obj_state[obj], 14));
}
/*
vessel .TRUE. if object can hold a liquid
*/
boolean vessel(obj)
int obj;
{
return (bitset(g.obj_state[obj], 15));
}
/*
wearng .TRUE. If wearing obj
*/
boolean wearng(item)
int item;
{
return (bitset(g.obj_state[item], WEARBT));
}
/*
worn .TRUE. if object is being worn
*/
boolean worn(obj)
int obj;
{
return (bitset(g.obj_state[obj], 11));
}
static char *e_msg[] = {
"message line > 70 characters", /* 00 */
"null line in message", /* 01 */
"too many words of messages", /* 02 */
"too many travel options", /* 03 */
"too many vocabulary words", /* 04 */
"required vocabulary word not found", /* 05 */
"too many rtext or mtext messages", /* 06 */
"too many hints", /* 07 */
"location has loc_attrib bit being set twice", /* 08 */
"invalid section number in database", /* 09 */
"out of order locs or rspeak entries.", /* 10 */
"illegal motion word in travel table", /* 11 */
"** unused **.",/* 12 */
"unknown or illegal word in adjective table.", /* 13 */
"illegal word in prep/obj table", /* 14 */
"too many entries in prep/obj table", /* 15 */
"object has condition bit set twice", /* 16 */
"object number too large", /* 17 */
"too many entries in adjective/noun table.", /* 18 */
"** unused **.",/* 19 */
"special travel (500>l>300) exceeds goto list", /* 20 */
"ran off end of vocabulary table", /* 21 */
"verb class (n/1000) not between 1 and 3", /* 22 */
"intransitive action verb exceeds goto list", /* 23 */
"transitive action verb exceeds goto list", /* 24 */
"conditional travel entry with no alternative", /* 25 */
"location has no travel entries", /* 26 */
"hint number exceeds goto list", /* 27 */
"invalid month returned by date function", /* 28 */
"action verb 'leave' has no object.", /* 29 */
"preposition found in unexpected table", /* 30 */
"received an unexpected word terminator from a1toa5", /* 31 */
"trying to put a container into itself (tricky!)", /* 32 */
"unknown word class in getwds", /* 33 */
"** unused **.",/* 34 */
"trying to carry a non-existent object"}; /* 35 */
/*
Fatal error routine
*/
void bug(n)
unsigned int n;
{
if (n < 36 && *e_msg[n] != '*')
fprintf(stderr, "Fatal error, probable cause: %s\n", e_msg[n]);
else
fprintf(stderr, "Fatal error number %d - Unused error number!\n", n);
panic((char *) 0, TRUE);
}
/*
Prompt for input, strip leading and trailing spaces,
return &buf[first non-whitespace].
Does not return if end of input.
*/
char *
ask(prompt, buf, buflen)
char *prompt, *buf;
int buflen;
{
fputs(prompt, stdout);
fflush(stdout);
if (!fgets(buf, buflen, stdin))
panic("end of input", FALSE);
if (*buf) {
int c;
char *end = buf + strlen(buf);
if (end[-1] != '\n')
/* Skip to end of line */
while ((c = getchar()) != '\n' && c != EOF);
while (*buf && isspace(*buf))
buf++;
while (buf <= --end && isspace(*end))
*end = '\0';
}
return buf;
}
/*
save and abort
*/
void panic(msg, save)
char *msg;
boolean save;
{
fprintf(stderr, "\nPANIC: %s%s\n",
msg ? msg : "", save ? ". Save..." : msg ? "" : "aborting.");
if (save)
saveadv("advpanic.sav");
exit(EXIT_FAILURE);
}

File diff suppressed because it is too large Load diff

View file

@ -1,594 +0,0 @@
/*
look-up vocabulary word in lex-ordered table. words may have
two entries with different codes. if minimum acceptable type
= 0, then return minimum of different codes. last word CANNOT
have two entries(due to binary sort).
word is the word to look up.
type is the minimum acceptable value,
if != 0 return %1000
*/
#include <string.h>
#include <stdio.h>
#include "advent.h"
#include "advdec.h"
static _CONST struct wac wc[] = {
"\"spelunker\"", 1016,
"22", 2053,
"22", 3012,
"34", 2053,
"34", 3013,
"4-leafed", 5034,
"7", 2053,
"7", 3011,
"?", 3051,
"above", 29,
"abra", 3050,
"abracd", 3050,
"across", 42,
"alacaz", 3050,
"all", 1109,
"altar", 90,
"and", 6001,
"answer", 2035,
"anvil", 1091,
"ascend", 29,
"at", 4009,
"attack", 2012,
"awaken", 2029,
"awkward", 26,
"axe", 1028,
"back", 8,
"ball", 1120,
"barren", 40,
"bat", 1104,
"bats", 1104,
"batshit", 1104,
"batteries", 1039,
"beans", 1024,
"bear", 1035,
"bed", 16,
"bedquilt", 70,
"bee", 1087,
"beehive", 1097,
"bees", 1087,
"billboard", 1116,
"bird", 1101,
"bitch", 2048,
"black", 5006,
"blast", 2023,
"blow", 2036,
"blowup", 2023,
"boat", 1048,
"book", 1110,
"booth", 1093,
"bottle", 1020,
"box", 1055,
"brass", 5004,
"break", 2028,
"bridge", 89,
"brief", 2026,
"broken", 54,
"broom", 1114,
"brush", 1114,
"brush", 2054,
"building", 12,
"bumble", 1087,
"burn", 2047,
"cage", 1004,
"cake", 1107, /* value must be
mushrooms + 1 */
"cakes", 1107,
"call", 2038,
"calm", 2010,
"canister", 1118,
"canyon", 25,
"cape", 1047,
"capture", 2001,
"carpet", 1040,
"carry", 2001,
"carving", 1115,
"cask", 1071,
"catch", 2001,
"cave", 67,
"cavern", 73,
"chain", 1064,
"chalice", 1070,
"chant", 2003,
"chasm", 1021, /* troll bridge */
"chest", 1055,
"chimney", 78,
"clam", 1014,
"click", 85,
"climb", 56,
"cloak", 1047,
"close", 2006,
"clover", 1073,
"cobble", 18,
"coins", 1054,
"comb", 1096,
"complain", 2048,
"continue", 7,
"continue", 2011,
"crack", 33,
"crap", 3106,
"crap!", 3106,
"crawl", 17,
"cross", 69,
"crown", 1066,
"crystal", 5033,
"cup", 1070,
"cupcakes", 1107,
"d", 30,
"dark", 22,
"debris", 51,
"defile", 23,
"depression", 63,
"descend", 30,
"describe", 2052,
"detonate", 2023,
"devour", 2014,
"diagnose", 2051,
"dial", 2039,
"diamond", 1051,
"diamonds", 1051,
"dig", 3066,
"discard", 2002,
"disturb", 2029,
"doff", 2002,
"dog", 1098,
"dome", 35,
"don", 2033,
"door", 1041, /* giant door */
"down", 30,
"down", 4008,
"downstream", 5,
"downward", 30,
"dragon", 1031,
"drawing", 1029,
"drink", 2015,
"drop", 2002,
"droplet", 1075,
"dump", 2002,
"dust", 2054,
"dwarf", 1017,
"dwarves", 1017,
"e", 43,
"east", 43,
"eat", 2014,
"egg", 1056,
"eggs", 1056,
"elfin", 5019,
"emerald", 1059,
"empty", 2013,
"enter", 3,
"entrance", 64,
"everything", 1109,
"examine", 2052,
"excavate", 3066,
"exit", 11,
"explore", 2011,
"extinguish", 2008,
"fee", 2025,
"fee", 3001,
"feed", 2021,
"fie", 2025,
"fie", 3002,
"fight", 2012,
"figure", 1027,
"fill", 2022,
"find", 2019,
"fissure", 1012,
"fling", 2017,
"floor", 58,
"flower", 1046,
"flowers", 1046,
"foe", 2025,
"foe", 3003,
"follow", 2011,
"foo", 2025,
"foo", 3004,
"food", 1019,
"forcd", 1,
"forest", 6,
"fork", 77,
"forward", 7,
"fountain", 1103,
"four-leafed", 5034,
"free", 2002,
"fresh", 5010,
"from", 4005,
"fuck", 3079,
"fuck!", 3079,
"fum", 2025,
"fum", 3005,
"gate", 2058,
"get", 2044,
"geyser", 1037, /* same as volcano */
"giant", 27,
"giant", 5029,
"glowing", 5031,
"gnome", 1105,
"go", 2011,
"gold", 1050,
"golden", 5001,
"goto", 2011,
"grab", 2032,
"grail", 1070,
"grate", 1003,
"green", 5032,
"grey", 5032,
"gripe", 2048,
"grotto", 91,
"guano", 1104,
"gully", 13,
"h20", 1081,
"hall", 38,
"headlamp", 1002,
"health", 2051,
"heave", 2017,
"heels", 1067,
"help", 3051,
"hike", 2011,
"hill", 2,
"hit", 2034,
"hive", 1097,
"hocus", 3050,
"hole", 52,
"holy", 5021,
"honey", 1096,
"honeycomb", 1096,
"horn", 1052,
"hound", 1098,
"house", 12,
"hurl", 2017,
"i", 2020,
"ice", 88,
"ignite", 2023,
"in", 19,
"in", 4001,
"insert", 2045,
"inside", 19,
"inside", 4001,
"into", 4001,
"inventory", 2020,
"inward", 19,
"iron", 5011,
"issue", 1016,
"jar", 1020,
"jerk", 2032,
"jewelry", 1053,
"jewels", 1053,
"jump", 39,
"keep", 2001,
"keg", 1071,
"key", 1090,
"keys", 1102,
"kick", 2034,
"kill", 2012,
"knapsack", 1108,
"knife", 1018,
"knives", 1018,
"knoll", 81,
"l", 2052,
"lamp", 1002,
"lantern", 1002,
"lead", 5023,
"leaden", 5023,
"leap", 39,
"leather", 5024,
"leave", 11,
"leave", 2037,
"ledge", 83,
"left", 36,
"light", 1002,
"little", 5012,
"lock", 2049,
"look", 2052,
"lost", 3068,
"low", 24,
"lyre", 1068,
"machine", 1038,
"magazine", 1016,
"main", 76,
"map", 2057,
"message", 1036,
"metal", 5035,
"ming", 5016,
"mirror", 1023,
"mist", 3069,
"moss", 1040,
"mumble", 2003,
"mushroom", 1106,
"mushrooms", 1106,
"n", 45,
"ne", 47,
"nest", 1056,
"north", 45,
"northeast", 47,
"northwest", 50,
"nothing", 2005,
"nowhere", 21,
"nugget", 1050,
"null", 21,
"nw", 50,
"oak", 5022,
"oaken", 5022,
"off", 4006,
"office", 76,
"oil", 1083, /* in bottle */
"on", 4002,
"onto", 4002,
"onward", 7,
"open", 2004,
"opensesame", 3050,
"oriental", 72,
"out", 11,
"outdoors", 32,
"outside", 11,
"over", 41,
"oyster", 1015,
"pantry", 57,
"passage", 23,
"pause", 2030,
"pearl", 1061,
"persian", 5002,
"peruse", 2027,
"peyote", 1106,
"phone", 1094,
"phonebooth", 1094,
"phuce", 82,
"pick", 2041,
"pillow", 1010,
"pirate", 1030,
"pirloc", 2059,
"piss", 3107,
"piss!", 3107,
"pit", 31,
"placate", 2010,
"plant", 1024,
"platinum", 5017,
"play", 2040,
"plover", 71,
"plugh", 65,
"pocus", 3050,
"pole", 1009,
"pool", 80,
"poster", 1113,
"pottery", 1058,
"pound", 2034,
"pour", 2013,
"pray", 92,
"prayer", 92,
"proceed", 2011,
"pull", 2032,
"punch", 2034,
"put", 2042,
"pyramid", 1060,
"q", 2018,
"quartz", 5036,
"quit", 2018,
"radium", 1119,
"rare", 5018,
"ration", 1019,
"read", 2027,
"refill", 2022,
"release", 2002,
"remove", 2046,
"reply", 2035,
"report", 2048,
"reservoir", 75,
"restore", 2031,
"retreat", 8,
"return", 8,
"right", 37,
"ring", 1072,
"road", 2,
"rock", 1119,
"rock", 15,
"rocks", 1092,
"rocks", 1115,
"rod", 1005,
"room", 59,
"rowboat", 1048,
"rub", 2016,
"ruby", 5020,
"rug", 1062,
"run", 2011,
"rusty", 5028,
"s", 46,
"sack", 1108,
"safe", 1112,
"saint-michel", 93,
"sandwich", 1019,
"sapphire", 1069,
"save", 2030,
"say", 2003,
"score", 2024,
"se", 48,
"secret", 66,
"sesame", 3050,
"shadowy", 5027,
"shake", 2009,
"shards", 1058,
"shatter", 2028,
"shazam", 3050,
"shelf", 83,
"shell", 74,
"shield", 1118,
"ship", 1048,
"shit", 3106,
"shit!", 3106,
"shoes", 1067,
"shut", 2006,
"silk", 5013,
"silken", 5013,
"silver", 5014,
"sing", 2003,
"slab", 61,
"slabroom", 61,
"slay", 2012,
"slide", 79,
"slippers", 1067,
"slit", 60,
"slugs", 1095,
"small", 5012,
"smash", 2028,
"snake", 1011,
"south", 46,
"southeast", 48,
"southwest", 49,
"spelunker", 1016,
"sphere", 1120,
"spices", 1063,
"stair", 10,
"stairs", 10,
"stalagmite", 1026,
"star", 5026,
"statue", 1074,
"steal", 2001,
"steel", 5025,
"steps", 1007,
"steps", 34,
"stick", 1049,
"sticks", 1049,
"stone", 1119,
"stop", 3139,
"stream", 14,
"strike", 2034,
"strum", 2040,
"suggest", 2048,
"surface", 20,
"suspend", 2030,
"sw", 49,
"sweep", 2054,
"swim", 3147,
"swing", 2009,
"sword", 1065,
"tablet", 1013,
"take", 2001,
"tame", 2010,
"tasty", 5030,
"telephone", 1094,
"terse", 2055,
"then", 6002,
"throw", 2017,
"thunder", 84,
"tiny", 5012,
"to", 4004,
"tome", 1110,
"toss", 2017,
"tote", 2001,
"travel", 2011,
"treasure", 5015,
"tree", 1074,
"tree", 3064,
"trees", 3064,
"trident", 1057,
"troll", 1033,
"tube", 1118,
"tunnel", 23,
"turn", 2043,
"u", 29,
"unbrief", 2026,
"unlock", 2050,
"unterse", 2055,
"up", 29,
"up", 4007,
"upon", 4002,
"upstream", 4,
"upward", 29,
"used", 5009,
"utter", 2003,
"valley", 9,
"vase", 1058,
"velvet", 5007,
"vending", 5008,
"view", 28,
"volcano", 1037,
"volume", 1110,
"w", 44,
"wake", 2029,
"waken", 2029,
"walk", 2011,
"wall", 53,
"wall", 1088, /* in blue grotto */
"wand", 1005,
"water", 1081, /* in bottle */
"wave", 2009,
"wear", 2033,
"west", 44,
"whack", 2034,
"where", 2019,
"whirl", 80,
"whirlpool", 80,
"whisk", 1114,
"whiskbroom", 1114,
"wicker", 5005,
"wine", 1085, /* in bottle */
"with", 4003,
"wiz", 2056,
"wolf", 1098,
"wooden", 5003,
"worn", 5009,
"worn-out", 5009,
"wornout", 5009,
"wumpus", 1099,
"xyzzy", 62,
"y2", 55,
"yank", 2032
};
#define MAXWC (sizeof(wc) / sizeof(struct wac))
_PROTOTYPE(int binary, (char *));
int vocab(word, type)
char *word;
int type;
{
int v1, v2, temp;
if ((v1 = binary(word)) >= 0) {
if (v1 > 0 && strcmp(word, wc[v1 - 1].aword) == 0)
v2 = v1 - 1;
else if (v1 < (MAXWC - 1) && strcmp(word, wc[v1 + 1].aword) == 0)
v2 = v1 + 1;
else
v2 = v1;
if (wc[v1].acode > wc[v2].acode) {
temp = v1;
v1 = v2;
v2 = temp;
}
if (type <= CLASS(wc[v1].acode))
return (wc[v1].acode);
else if (type <= CLASS(wc[v2].acode))
return (wc[v2].acode);
else
return (-1);
} else
return (-1);
}
int binary(w)
char *w;
{
int lo, mid, hi, check;
lo = 0;
hi = MAXWC - 1;
do {
mid = (lo + hi) / 2;
check = strcmp(w, wc[mid].aword);
if (check == 0)
return (mid);
else if (check < 0)
hi = mid - 1;
else
lo = mid + 1;
} while (lo <= hi);
return (-1);
}

View file

@ -1,4 +0,0 @@
PROG= ttt
MAN=
.include <bsd.prog.mk>

View file

@ -1,299 +0,0 @@
/* tic tac toe (noughts and crosses) Author: Warren Toomey */
/* Copyright 1988 by Warren Toomey wkt@cs.adfa.oz.au[@uunet.uu.net]
*
* You may freely copy or distribute this code as long as this notice
* remains intact.
*
* You may modify this code, as long as this notice remains intact, and
* you add another notice indicating that the code has been modified.
*
* You may NOT sell this code or in any way profit from this code without
* prior agreement from the author.
*/
/* Compile with cc -o tic tic.c -lcurses -ltermcap */
#include <stdlib.h>
#include <time.h>
#ifdef CURSES
#include <curses.h>
#endif
#include <stdio.h>
#ifndef CURSES
#define printw printf
#endif
typedef struct {
int value; /* The move returned by the */
int path; /* alphabeta consists of a value */
} MOVE; /* and an actual move (path) */
_PROTOTYPE(int main, (void));
_PROTOTYPE(int stateval, (int board [], int whosemove));
_PROTOTYPE(MOVE alphabeta, (int board [], int whosemove, int alpha, int beta));
_PROTOTYPE(void draw, (int board []));
_PROTOTYPE(void getmove, (int board []));
_PROTOTYPE(int endofgame, (int board []));
_PROTOTYPE(int randommove, (void));
/* Static evaluator. Returns 100 if we have 3 in a row -100 if they have 3
* in a row
*
* Board is array of 9 ints, where 0=empty square 1=our move 4= their move
*
* and board is indices 0 1 2 3 4 5 6 7 8 */
int stateval(board, whosemove)
int board[];
int whosemove;
{
static int row[8][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, /* Indices of 3in-a-rows */
{0, 3, 6}, {1, 4, 7}, {2, 5, 8},
{0, 4, 8}, {2, 4, 6}};
int temp; /* Temp row results */
int i, j; /* Loop counters */
int side; /* Depth multiplier */
int win, lose;
if (whosemove == 1) {
win = 100;
lose = -100;
side = 1;
} else {
/* Multiply by -1 if */
win = -100;
lose = 100;
side = -1;
} /* not out move */
for (i = 0; i < 8; i++) { /* For every 3-in-a-row */
temp = 0;
for (j = 0; j < 3; j++) /* Add up the board values */
temp += board[row[i][j]];
if (temp == 3) return(win); /* We've got 3 in a row */
if (temp == 12) return (lose); /* They've got 3 in a row */
}
return(0); /* Finally return sum */
}
MOVE alphabeta(board, whosemove, alpha, beta) /* Alphabeta: takes a board, */
int board[]; /* whose move, alpha & beta cutoffs, */
int whosemove; /* and returns a move to make and */
int alpha; /* the value that the move has */
int beta;
{
MOVE result, successor;
int best_score, i, best_path, mademove;
result.value = stateval(board, whosemove); /* Work out the board's */
/* Static value */
if ((result.value == 100) || /* If a win or loss already */
(result.value == -100))
return(result); /* return the result */
best_score = beta; /* Ok, set worst score */
mademove = 0; /* to the beta cutoff */
for (i = 0; i < 9; i++) {
if (board[i] == 0) { /* For all valid moves */
mademove = 1;
board[i] = whosemove; /* make the move on board */
successor = alphabeta(board, 5 - whosemove, -best_score - 1, -alpha - 1);
/* Get value of the move */
board[i] = 0; /* Take move back */
if (-successor.value > best_score) { /* If a better score */
best_score = -successor.value; /* update our score */
best_path = i; /* and move */
if (best_score > alpha)
break; /* If we've beaten alpha */
} /* return immediately */
}
}
if (mademove) {
result.value = best_score; /* Finally return best score */
result.path = best_path;/* and best move */
}
return(result); /* If no move, return static result */
}
void draw(board) /* Draw the board */
int board[];
{
int i, j, row;
static char out[] = " X O"; /* Lookup table for character */
row = 6;
#ifdef CURSES
move(row, 0);
#endif
for (j = 0; j < 9; j += 3) {
printw(" %d | %d | %d ", j, j + 1, j + 2);
for (i = 0; i < 3; i++) {
printw("%c ", out[board[j + i]]);
if (i < 2) printw("| ");
}
if (j < 4) {
#ifdef CURSES
move(++row, 0);
#else
printw("\n");
#endif
printw("---+---+--- ---+---+---");
}
#ifdef CURSES
move(++row, 0);
#else
printw("\n");
#endif
}
#ifdef CURSES
refresh();
#else
printw("\n");
#endif
}
void getmove(board) /* Get a player's move */
int board[];
{
int Move;
int ItemsRead;
char dumc;
do {
do {
#ifdef CURSES
move(9, 40);
printw("Your move: "); /* Prompt for move */
refresh();
#else
printw("Your move: "); /* Prompt for move */
#endif
ItemsRead = scanf("%d", &Move); /* Input the move */
if (ItemsRead == 0) scanf("%c", &dumc); /* Remove the offending character */
}
while (ItemsRead != 1);
}
while (board[Move]);
board[Move] = 4; /* If legal, add to board */
draw(board); /* Draw the board */
}
int endofgame(board) /* Determine end of the game */
int board[];
{
int eval;
int count;
eval = stateval(board, 1);
#ifdef CURSES
move(20, 25);
#endif
if (eval == 100) {
printw("I have beaten you.\n");
return(1);
}
if (eval == -100) {
printw("Bus error (core dumped)\n");
return(1);
}
count = 0;
for (eval = 0; eval < 9; eval++)
if (board[eval] != 0) count++;
if (count == 9) {
printw("A draw!\n");
return(1);
}
#ifdef CURSES
refresh();
#endif
return(0);
}
int randommove()
{ /* Make an initial random move */
int i;
i = abs((int) time((long *) 0));
return(i % 9);
}
int main()
{ /* The actual game */
int i, board[9];
char ch;
MOVE ourmove;
for (i = 0; i < 9; i++) board[i] = 0; /* Initialise the board */
#ifdef CURSES
initscr();
clear();
refresh();
#endif
printw(" TIC TAC TOE \n\n");
printw(" Your moves are 'O'\n");
printw(" My moves are 'X'\n\n");
#ifdef CURSES
move(5, 0);
printw("Do you wish to move first: ");
refresh();
while (scanf("%c", &ch) != 1);
move(5, 0);
printw(" ......."); /* Kludge to get rid */
refresh();
move(5, 0);
printw(" "); /* of input letter */
refresh();
#else
do
printw("Do you wish to move first: ");
while (scanf("%c", &ch) != 1);
#endif
if ((ch != 'y') && (ch != 'Y')) {
i = randommove(); /* If we move first */
board[i] = 1; /* make it random */
#ifdef CURSES
move(7, 42);
printw("My move: %d\n", i);
refresh();
#else
printw("My move: %d\n", i);
#endif
}
draw(board);
getmove(board);
while (1) {
ourmove = alphabeta(board, 1, 99, -99); /* Get a move for us;
* return wins */
/* Immediately & ignore losses */
board[ourmove.path] = 1;/* and make it */
#ifdef CURSES
move(7, 42);
printw("My move: %d\n", ourmove.path);
refresh();
#else
printw("My move: %d\n", ourmove.path);
#endif
draw(board);
if (endofgame(board)) break; /* If end of game, exit */
getmove(board); /* Get opponent's move */
if (endofgame(board)) break; /* If end of game, exit */
}
#ifdef CURSES
endwin();
#endif
return(0);
}

View file

@ -1,4 +1,4 @@
MAN= advent.6 ttt.6
MAN=
.include <bsd.man.mk>
.include <bsd.subdir.mk>

View file

@ -1,22 +0,0 @@
.\" @(#)adventure.6 6.2 (Berkeley) 5/6/86
.\"
.TH ADVENT 6 "May 6, 1986"
.AT 3
.SH NAME
advent, adventure \- an exploration game
.SH SYNOPSIS
.B advent
.SH DESCRIPTION
The object of the game is to
locate and explore Colossal Cave, find the treasures hidden there,
and bring them back to the building with you.
The program is self-descriptive to a point, but part of the game is to discover
its rules.
.PP
To terminate a game, type `quit';
to save a game for later resumption, type `save' now, and `restore' when
you resume.
.SH FILES
.TP 15
.B advent.sav
A saved adventure game.

View file

@ -1,23 +0,0 @@
.TH TTT 6
.SH NAME
ttt \- tic tac toe
.SH SYNOPSIS
\fBttt\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH EXAMPLES
.EX "ttt " "Start the game"
.SH DESCRIPTION
.PP
This program allows the user to engage in a game of tic tac toe (noughts and
crosses) with the computer.
The program uses the alpha-beta algorithm, so the user had better be sharp.