Exemplo n.º 1
0
dark() {
    static int lamp, light;

    if( lamp== 0 ) {                       /* инициализация */
        lamp= ( vocab("lamp")   % 1000 );
        light=( vocab("!light") % 1000 );
    }
    if( darkflag1 )             /*@VG*/
        return(darkflag1 = 0);
    return( !at(light) && (!here(lamp) || prop(lamp)==0) );
}
Exemplo n.º 2
0
/*
  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);
    }
}
Exemplo n.º 3
0
ivocab() {
    static int direct, kword, mm, mark;

    if( (F3=fopen("advvocab","r")) == NULL )  fatal();
    printf("vocabulary words   :");
    while(getlin()) {
	mark=line(1);
	if( mark=='m' ) {                /* message */
	    rtext(mm)=putmes();
	} else {
	    if( mark=='d' ) {            /* directional words */
		direct=direct+1; kword=direct;
	    } else if( mark=='s' ) {       /* special words */
		mm=ranm-mesimp;
		kword=mm+(specwr*1000);
		mesimp=mesimp+1;
	    } else {
		printf("\n%s%.10s\n","неверный маркер: ",_line); fatal();
	    }
	    p=4                                /* read list of words */;
	    while(getwrd()) {
		if( vocab(_word) >= 0 ) {
		    printf("\n%s%.4s\n","дважды определено: ",_word);
		    fatal();
		}
		nvoc=nvoc+1;
		ktab(nvoc)=kword;  atab(nvoc) = *rword;
		screen(nvoc);
	    }
	}
    }
    printf("%8d  %s %6d  %s\n",nvoc,"of",vocw,"used");
    fclose(F3);
}
Exemplo n.º 4
0
/*
		Routine to analyze a word.
*/
int analyze(char *word, int *type, int *value)
{
	int wordval, msg;

	/* make sure I understand */
	if ((wordval = vocab(word, 0)) == -1) {
		switch (rand() % 3) {
		case 0:
			msg = 60;
			break;
		case 1:
			msg = 61;
			break;
		default:
			msg = 13;
		}
		rspeak(msg);
		return 0;
	}

	*type  = wordval / 1000;
	*value = wordval % 1000;

	return 1;
}
Exemplo n.º 5
0
Arquivo: words.cpp Projeto: erg/factor
word *factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_)
{
	data_root<object> vocab(vocab_,this);
	data_root<object> name(name_,this);

	data_root<word> new_word(allot<word>(sizeof(word)),this);

	new_word->hashcode = hashcode_;
	new_word->vocabulary = vocab.value();
	new_word->name = name.value();
	new_word->def = special_objects[OBJ_UNDEFINED];
	new_word->props = false_object;
	new_word->counter = tag_fixnum(0);
	new_word->pic_def = false_object;
	new_word->pic_tail_def = false_object;
	new_word->subprimitive = false_object;
	new_word->profiling = NULL;
	new_word->code = NULL;

	jit_compile_word(new_word.value(),new_word->def,true);
	if(counting_profiler_p)
	{
		code_block *profiling_block = compile_profiling_stub(new_word.value());
		new_word->profiling = profiling_block;
		initialize_code_block(new_word->profiling);
	}

	update_word_entry_point(new_word.untagged());

	return new_word.untagged();
}
Exemplo n.º 6
0
/*
  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;
}
Exemplo n.º 7
0
 Vocab get_vocabulary(vector<SST::AnnotatedParseTree::shared_tree>& trees, int min_occurence) {
     tokenized_uint_labeled_dataset examples;
     for (auto& tree : trees)
         examples.emplace_back(tree->to_labeled_pair());
     auto index2word  = utils::get_vocabulary(examples, min_occurence);
     Vocab vocab(index2word);
     vocab.word2index[START] = vocab.size();
     vocab.index2word.emplace_back(START);
     return vocab;
 }
Exemplo n.º 8
0
// Allocates memory
word* factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_) {
  data_root<object> vocab(vocab_, this);
  data_root<object> name(name_, this);

  data_root<word> new_word(allot<word>(sizeof(word)), this);

  new_word->hashcode = hashcode_;
  new_word->vocabulary = vocab.value();
  new_word->name = name.value();
  new_word->def = special_objects[OBJ_UNDEFINED];
  new_word->props = false_object;
  new_word->pic_def = false_object;
  new_word->pic_tail_def = false_object;
  new_word->subprimitive = false_object;
  new_word->entry_point = 0;

  jit_compile_word(new_word.value(), new_word->def, true);

  return new_word.untagged();
}
Exemplo n.º 9
0
/*
  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;
}
Exemplo n.º 10
0
/* read the vocabulary */
static void
rvoc(void)
{
	char *s;
	int rv_index;
	char buf[6];

	for (;;) {
		rv_index = rnum();
		if (rv_index < 0)
			break;
		for (s = buf, *s = 0;; s++)	/* get the word */
			if ((*s = next()) == TAB || *s == '\n' || *s == LF
			    || *s == ' ')
				break;
		/* terminate word with newline, LF, tab, blank */
		if (*s != '\n' && *s != LF)
			FLUSHLF;		/* can be comments */
		*s = 0;
		/* printf("\"%s\"=%d\n", buf, rv_index); */
		vocab(buf, -2, rv_index);
	}
}
Exemplo n.º 11
0
int
main(int argc, char *argv[])
{
    int     i;
    int     rval, ll;
    struct text *kk;

    init();		/* Initialize everything */
    signal(SIGINT, trapdel);

    if (argc > 1) {	/* Restore file specified */
        /* Restart is label 8305 (Fortran) */
        i = restore(argv[1]);	/* See what we've got */
        switch (i) {
        case 0:			/* The restore worked fine */
            yea = Start();
            k = null;
            unlink(argv[1]);/* Don't re-use the save */
            goto l8;	/* Get where we're going */
        case 1:		/* Couldn't open it */
            errx(1, "can't open file");	/* So give up */
        case 2:		/* Oops -- file was altered */
            rspeak(202);	/* You dissolve */
            exit(2);	/* File could be non-adventure */
        }			/* So don't unlink it. */
    }

    startup();		/* prepare for a user		*/

    for (;;) {		/* main command loop (label 2)	*/
        if (newloc < 9 && newloc != 0 && closng) {
            rspeak(130);	/* if closing leave only by	*/
            newloc = loc;	/*	main office		*/
            if (!panic)
                clock2 = 15;
            panic = TRUE;
        }

        rval = fdwarf();		/* dwarf stuff			*/
        if (rval == 99)
            die(99);

l2000:
        if (loc == 0)
            die(99);	/* label 2000			*/
        kk = &stext[loc];
        if ((abb[loc] % abbnum) ==0 || kk->seekadr == 0)
            kk = &ltext[loc];
        if (!forced(loc) && dark()) {
            if (wzdark && pct(35)) {
                die(90);
                goto l2000;
            }
            kk = &rtext[16];
        }
l2001:
        if (toting(bear))
            rspeak(141);	/* 2001			*/
        speak(kk);
        k = 1;
        if (forced(loc))
            goto l8;
        if (loc == 33 && pct(25) && !closng)
            rspeak(8);
        if (!dark()) {
            abb[loc]++;
            for (i = atloc[loc]; i != 0; i = linkx[i]) {	/*2004*/
                obj = i;
                if (obj > 100)
                    obj -= 100;
                if (obj == steps && toting(nugget))
                    continue;
                if (prop[obj] < 0) {
                    if (closed)
                        continue;
                    prop[obj] = 0;
                    if (obj == rug || obj == chain)
                        prop[obj] = 1;
                    tally--;
                    if (tally == tally2 && tally != 0)
                        if (limit > 35)
                            limit = 35;
                }
                ll = prop[obj];	/* 2006	*/
                if (obj == steps && loc == fixed[steps])
                    ll = 1;
                pspeak(obj, ll);
            }		/* 2008 */
            goto l2012;
l2009:
            k = 54;			/* 2009			*/
l2010:
            spk = k;
l2011:
            rspeak(spk);
        }
l2012:
        verb = 0;		/* 2012			*/
        obj = 0;
l2600:
        checkhints();		/* to 2600-2602		*/
        if (closed) {
            if (prop[oyster] < 0 && toting(oyster))
                pspeak(oyster, 1);
            for (i = 1; i < 100; i++)
                if (toting(i) && prop[i] < 0)	/* 2604 */
                    prop[i] = -1 - prop[i];
        }
        wzdark = dark();	/* 2605			*/
        if (knfloc > 0 && knfloc != loc)
            knfloc = 1;
        getin(wd1, sizeof(wd1), wd2, sizeof(wd2));
        if (delhit) {		/* user typed a DEL	*/
            delhit = 0;	/* reset counter	*/
            /* pretend he's quitting */
            strlcpy(wd1, "quit", sizeof(wd1));
            wd2[0] = 0;
        }
l2608:
        if ((foobar = -foobar) > 0)
            foobar = 0;	/* 2608		*/
        /* should check here for "magic mode"		*/
        turns++;
        if (demo && turns >= SHORT)
            done(1);	/* to 13000	*/

        if (verb == say && wd2[0] != 0)
            verb = 0;
        if (verb == say)
            goto l4090;
        if (tally == 0 && loc >= 15 && loc != 33)
            clock1--;
        if (clock1 == 0) {
            closing();			/* to 10000	*/
            goto l19999;
        }
        if (clock1 < 0)
            clock2--;
        if (clock2 == 0) {
            caveclose();		/* to 11000		*/
            continue;		/* back to 2		*/
        }
        if (prop[lamp] == 1)
            limit--;
        if (limit <= 30 && here(batter) && prop[batter] == 0
                && here(lamp)) {
            rspeak(188);		/* 12000		*/
            prop[batter] = 1;
            if (toting(batter))
                drop(batter, loc);
            limit += 2500;
            lmwarn = FALSE;
            goto l19999;
        }
        if (limit == 0) {
            limit = -1;		/* 12400		*/
            prop[lamp] = 0;
            rspeak(184);
            goto l19999;
        }
        if (limit < 0 && loc <= 8) {
            rspeak(185);		/* 12600		*/
            gaveup = TRUE;
            done(2);		/* to 20000		*/
        }
        if (limit <= 30) {
            if (lmwarn || !here(lamp))
                goto l19999;	/*12200*/
            lmwarn = TRUE;
            spk = 187;
            if (place[batter] == 0)
                spk = 183;
            if (prop[batter] == 1)
                spk = 189;
            rspeak(spk);
        }
l19999:
        k = 43;
        if (liqloc(loc) == water)
            k = 70;
        if (weq(wd1, "enter") &&
                (weq(wd2, "strea") || weq(wd2, "water")))
            goto l2010;
        if (weq(wd1, "enter") && *wd2 != 0)
            goto l2800;
        if ((!weq(wd1, "water") && !weq(wd1, "oil"))
                || (!weq(wd2, "plant") && !weq(wd2, "door")))
            goto l2610;
        if (at(vocab(wd2, 1, 0)))
            strlcpy(wd2, "pour", sizeof(wd2));

l2610:
        if (weq(wd1, "west"))
            if (++iwest == 10)
                rspeak(17);
l2630:
        i = vocab(wd1, -1, 0);
        if (i== -1) {
            spk = 60;			/* 3000		*/
            if (pct(20))
                spk = 61;
            if (pct(20))
                spk = 13;
            rspeak(spk);
            goto l2600;
        }
        k = i % 1000;
        kq = i / 1000 + 1;
        switch (kq) {
        case 1:
            goto l8;
        case 2:
            goto l5000;
        case 3:
            goto l4000;
        case 4:
            goto l2010;
        default:
            bug(22);
        }

l8:
        switch (march()) {
        case 2:
            continue;		/* i.e. goto l2		*/
        case 99:
            die(99);
            goto l2000;
        default:
            bug(110);
        }

l2800:
        strlcpy(wd1, wd2, sizeof(wd1));
        wd2[0] = 0;
        goto l2610;

l4000:
        verb = k;
        spk = actspk[verb];
        if (wd2[0] != 0 && verb != say)
            goto l2800;
        if (verb == say)
            obj = wd2[0];
        if (obj != 0)
            goto l4090;
l4080:
        switch (verb) {
        case 1:			/* take = 8010		*/
            if (atloc[loc] == 0 || linkx[atloc[loc]] != 0)
                goto l8000;
            for (i = 1; i <= 5; i++)
                if (dloc[i] == loc && dflag >= 2)
                    goto l8000;
            obj = atloc[loc];
            goto l9010;
        case 2:
        case 3:
        case 9:		/* 8000 : drop, say, wave */
        case 10:
        case 16:
        case 17:	/* calm, rub, toss	*/
        case 19:
        case 21:
        case 28:	/* find, feed, break	*/
        case 29:			/* wake			*/
l8000:
            printf("%s what?\n", wd1);
            obj = 0;
            goto l2600;
        case 4:
        case 6:		/* 8040 open, lock	*/
            spk = 28;
            if (here(clam))
                obj = clam;
            if (here(oyster))
                obj = oyster;
            if (at(door))
                obj = door;
            if (at(grate))
                obj = grate;
            if (obj != 0 && here(chain))
                goto l8000;
            if (here(chain))
                obj = chain;
            if (obj == 0)
                goto l2011;
            goto l9040;
        case 5:
            goto l2009;		/* nothing		*/
        case 7:
            goto l9070;		/* on			*/
        case 8:
            goto l9080;		/* off			*/
        case 11:
            goto l8000;	/* walk			*/
        case 12:
            goto l9120;	/* kill			*/
        case 13:
            goto l9130;	/* pour			*/
        case 14:			/* eat: 8140		*/
            if (!here(food))
                goto l8000;
l8142:
            dstroy(food);
            spk = 72;
            goto l2011;
        case 15:
            goto l9150;	/* drink		*/
        case 18:			/* quit: 8180		*/
            gaveup = yes(22, 54, 54);
            if (gaveup)
                done(2);	/* 8185			*/
            goto l2012;
        case 20:			/* invent = 8200	*/
            spk = 98;
            for (i = 1; i <= 100; i++) {
                if (i != bear && toting(i)) {
                    if (spk == 98)
                        rspeak(99);
                    blklin = FALSE;
                    pspeak(i, -1);
                    blklin = TRUE;
                    spk = 0;
                }
            }
            if (toting(bear))
                spk = 141;
            goto l2011;
        case 22:
            goto l9220;	/* fill			*/
        case 23:
            goto l9230;	/* blast		*/
        case 24:			/* score: 8240		*/
            scorng = TRUE;
            printf("If you were to quit now, you would score");
            printf(" %d out of a possible ", score());
            printf("%d.", mxscor);
            scorng = FALSE;
            gaveup = yes(143, 54, 54);
            if (gaveup)
                done(2);
            goto l2012;
        case 25:			/* foo: 8250		*/
            k = vocab(wd1, 3, 0);
            spk = 42;
            if (foobar == 1 - k)
                goto l8252;
            if (foobar != 0)
                spk = 151;
            goto l2011;
l8252:
            foobar = k;
            if (k != 4)
                goto l2009;
            foobar = 0;
            if (place[eggs] == plac[eggs]
                    || (toting(eggs) && loc == plac[eggs])) goto l2011;
            if (place[eggs] == 0 && place[troll] == 0 && prop[troll] == 0)
                prop[troll] = 1;
            k = 2;
            if (here(eggs))
                k = 1;
            if (loc == plac[eggs])
                k = 0;
            move(eggs, plac[eggs]);
            pspeak(eggs, k);
            goto l2012;
        case 26:			/* brief = 8260		*/
            spk = 156;
            abbnum = 10000;
            detail = 3;
            goto l2011;
        case 27:			/* read = 8270		*/
            if (here(magzin))
                obj = magzin;
            if (here(tablet))
                obj = obj * 100 + tablet;
            if (here(messag))
                obj = obj * 100 + messag;
            if (closed && toting(oyster))
                obj = oyster;
            if (obj > 100 || obj == 0 || dark())
                goto l8000;
            goto l9270;
        case 30:			/* suspend = 8300	*/
            spk = 201;
            if (demo)
                goto l2011;
            printf("I can suspend your adventure for you so");
            printf(" you can resume later, but\n");
            printf("you will have to wait at least");
            printf(" %d minutes before continuing.", latncy);
            if (!yes(200, 54, 54))
                goto l2012;
            time(&savet);
            ciao();		/* Do we quit? */
            continue;		/* Maybe not */
        case 31:			/* hours = 8310		*/
            printf("Colossal cave is closed 9am-5pm Mon ");
            printf("through Fri except holidays.\n");
            goto l2012;
        default:
            bug(23);
        }

l4090:
        switch (verb) {
        case 1:			/* take = 9010		*/
l9010:
            switch (trtake()) {
            case 2011:
                goto l2011;
            case 9220:
                goto l9220;
            case 2009:
                goto l2009;
            case 2012:
                goto l2012;
            default:
                bug(102);
            }
l9020:
        case 2:			/* drop = 9020		*/
            switch (trdrop()) {
            case 2011:
                goto l2011;
            case 19000:
                done(3);
            case 2012:
                goto l2012;
            default:
                bug(105);
            }
l9030:
        case 3:
            switch (trsay()) {
            case 2012:
                goto l2012;
            case 2630:
                goto l2630;
            default:
                bug(107);
            }
l9040:
        case 4:
        case 6:		/* open, close		*/
            switch (tropen()) {
            case 2011:
                goto l2011;
            case 2010:
                goto l2010;
            default:
                bug(106);
            }
        case 5:
            goto l2009;	/* nothing		*/
        case 7:			/* on	9070		*/
l9070:
            if (!here(lamp))
                goto l2011;
            spk = 184;
            if (limit < 0)
                goto l2011;
            prop[lamp] = 1;
            rspeak(39);
            if (wzdark)
                goto l2000;
            goto l2012;

        case 8:			/* off			*/
l9080:
            if (!here(lamp))
                goto l2011;
            prop[lamp] = 0;
            rspeak(40);
            if (dark())
                rspeak(16);
            goto l2012;

        case 9:			/* wave			*/
            if ((!toting(obj)) && (obj != rod || !toting(rod2)))
                spk = 29;
            if (obj != rod || !at(fissur)||!toting(obj) || closng)
                goto l2011;
            prop[fissur] = 1-prop[fissur];
            pspeak(fissur, 2-prop[fissur]);
            goto l2012;
        case 10:
        case 11:
        case 18:	/* calm, walk, quit	*/
        case 24:
        case 25:
        case 26:	/* score, foo, brief	*/
        case 30:
        case 31:		/* suspend, hours	*/
            goto l2011;
l9120:
        case 12:			/* kill			*/
            switch (trkill()) {
            case 8000:
                goto l8000;
            case 8:
                goto l8;
            case 2011:
                goto l2011;
            case 2608:
                goto l2608;
            case 19000:
                done(3);
            default:
                bug(112);
            }
l9130:
        case 13:			/* pour			*/
            if (obj == bottle || obj == 0)
                obj = liq();
            if (obj == 0)
                goto l8000;
            if (!toting(obj))
                goto l2011;
            spk = 78;
            if (obj != oil && obj != water)
                goto l2011;
            prop[bottle] = 1;
            place[obj] = 0;
            spk = 77;
            if (!(at(plant) || at(door)))
                goto l2011;
            if (at(door)) {
                prop[door] = 0;	/* 9132			*/
                if (obj == oil)
                    prop[door] = 1;
                spk = 113 + prop[door];
                goto l2011;
            }
            spk = 112;
            if (obj != water)
                goto l2011;
            pspeak(plant, prop[plant] + 1);
            prop[plant] = (prop[plant] + 2) % 6;
            prop[plant2] = prop[plant] / 2;
            k = null;
            goto l8;
        case 14:			/* 9140 - eat		*/
            if (obj == food)
                goto l8142;
            if (obj == bird || obj == snake || obj == clam || obj == oyster
                    || obj == dwarf || obj == dragon || obj == troll
                    || obj == bear) spk = 71;
            goto l2011;
l9150:
        case 15:			/* 9150 - drink		*/
            if (obj == 0 && liqloc(loc) != water && (liq() != water
                    || !here(bottle)))
                goto l8000;
            if (obj != 0 && obj != water)
                spk = 110;
            if (spk == 110 || liq() != water || !here(bottle))
                goto l2011;
            prop[bottle] = 1;
            place[water] = 0;
            spk = 74;
            goto l2011;
        case 16:			/* 9160: rub		*/
            if (obj != lamp)
                spk = 76;
            goto l2011;
        case 17:			/* 9170: throw		*/
            switch (trtoss()) {
            case 2011:
                goto l2011;
            case 9020:
                goto l9020;
            case 9120:
                goto l9120;
            case 8:
                goto l8;
            case 9210:
                goto l9210;
            default:
                bug(113);
            }
        case 19:
        case 20:		/* 9190: find, invent	*/
            if (at(obj) || (liq() == obj && at(bottle))
                    || k == liqloc(loc))
                spk = 94;
            for (i = 1; i <= 5; i++)
                if (dloc[i] == loc && dflag >= 2 && obj == dwarf)
                    spk = 94;
            if (closed)
                spk = 138;
            if (toting(obj))
                spk = 24;
            goto l2011;
l9210:
        case 21:			/* feed			*/
            switch (trfeed()) {
            case 2011:
                goto l2011;
            default:
                bug(114);
            }
l9220:
        case 22:			/* fill			*/
            switch (trfill()) {
            case 2011:
                goto l2011;
            case 8000:
                goto l8000;
            case 9020:
                goto l9020;
            default:
                bug(115);
            }
l9230:
        case 23:			/* blast		*/
            if (prop[rod2] < 0 || !closed)
                goto l2011;
            bonus = 133;
            if (loc == 115)
                bonus = 134;
            if (here(rod2))
                bonus = 135;
            rspeak(bonus);
            done(2);
l9270:
        case 27:			/* read			*/
            if (dark())
                goto l5190;
            if (obj == magzin)
                spk = 190;
            if (obj == tablet)
                spk = 196;
            if (obj == messag)
                spk = 191;
            if (obj == oyster && hinted[2] && toting(oyster))
                spk = 194;
            if (obj != oyster || hinted[2] || !toting(oyster)
                    || !closed) goto l2011;
            hinted[2] = yes(192, 193, 54);
            goto l2012;
l9280:
        case 28:			/* break		*/
            if (obj == mirror)
                spk = 148;
            if (obj == vase && prop[vase] == 0) {
                spk = 198;
                if (toting(vase))
                    drop(vase, loc);
                prop[vase] = 2;
                fixed[vase] = -1;
                goto l2011;
            }
            if (obj != mirror||!closed)
                goto l2011;
            rspeak(197);
            done(3);
l9290:
        case 29:			/* wake			*/
            if (obj != dwarf||!closed)
                goto l2011;
            rspeak(199);
            done(3);

        default:
            bug(24);
        }

l5000:
        obj = k;
        if (fixed[k] != loc && !here(k))
            goto l5100;
l5010:
        if (wd2[0] != 0)
            goto l2800;
        if (verb != 0)
            goto l4090;
        printf("What do you want to do with the %s?\n", wd1);
        goto l2600;
l5100:
        if (k != grate)
            goto l5110;
        if (loc == 1 || loc == 4 || loc == 7)
            k = dprssn;
        if (loc > 9 && loc < 15)
            k = entrnc;
        if (k != grate)
            goto l8;
l5110:
        if (k != dwarf)
            goto l5120;
        for (i = 1; i <= 5; i++)
            if (dloc[i] == loc && dflag >= 2)
                goto l5010;
l5120:
        if ((liq() == k && here(bottle)) || k == liqloc(loc))
            goto l5010;
        if (obj != plant || !at(plant2) || prop[plant2] == 0)
            goto l5130;
        obj = plant2;
        goto l5010;
l5130:
        if (obj != knife || knfloc != loc)
            goto l5140;
        knfloc = -1;
        spk = 116;
        goto l2011;
l5140:
        if (obj != rod || !here(rod2))
            goto l5190;
        obj = rod2;
        goto l5010;
l5190:
        if ((verb == find || verb == invent) && wd2[0] == 0)
            goto l5010;
        printf("I see no %s here\n", wd1);
        goto l2012;
    }
}
Exemplo n.º 12
0
/* secondary data manipulation */
static void
linkdata(void)
{
	int i, j;

	/* array linkages */
	for (i = 1; i <= LOCSIZ; i++)
		if (ltext[i].seekadr != 0 && travel[i] != 0)
			if ((travel[i]->tverb) == 1)
				cond[i] = 2;
	for (j = 100; j > 0; j--)
		if (fixd[j] > 0) {
			drop(j + 100, fixd[j]);
			drop(j, plac[j]);
		}
	for (j = 100; j > 0; j--) {
		fixed[j] = fixd[j];
		if (plac[j] != 0 && fixd[j] <= 0)
			drop(j, plac[j]);
	}

	maxtrs = 79;
	tally = 0;
	tally2 = 0;

	for (i = 50; i <= maxtrs; i++) {
		if (ptext[i].seekadr != 0)
			prop[i] = -1;
		tally -= prop[i];
	}

	/* define mnemonics */
	keys  = vocab(DECR(k,e,y,s,\0), 1, 0);
	lamp  = vocab(DECR(l,a,m,p,\0), 1, 0);
	grate = vocab(DECR(g,r,a,t,e), 1, 0);
	cage  = vocab(DECR(c,a,g,e,\0),1, 0);
	rod   = vocab(DECR(r,o,d,\0,\0),1, 0);
	rod2 = rod + 1;
	steps = vocab(DECR(s,t,e,p,s),1, 0);
	bird  = vocab(DECR(b,i,r,d,\0),1, 0);
	door  = vocab(DECR(d,o,o,r,\0),1, 0);
	pillow= vocab(DECR(p,i,l,l,o), 1, 0);
	snake = vocab(DECR(s,n,a,k,e), 1, 0);
	fissur= vocab(DECR(f,i,s,s,u), 1, 0);
	tablet= vocab(DECR(t,a,b,l,e), 1, 0);
	clam  = vocab(DECR(c,l,a,m,\0),1, 0);
	oyster= vocab(DECR(o,y,s,t,e), 1, 0);
	magzin= vocab(DECR(m,a,g,a,z), 1, 0);
	dwarf = vocab(DECR(d,w,a,r,f), 1, 0);
	knife = vocab(DECR(k,n,i,f,e), 1, 0);
	food  = vocab(DECR(f,o,o,d,\0),1, 0);
	bottle= vocab(DECR(b,o,t,t,l), 1, 0);
	water = vocab(DECR(w,a,t,e,r), 1, 0);
	oil   = vocab(DECR(o,i,l,\0,\0),1, 0);
	plant = vocab(DECR(p,l,a,n,t), 1, 0);
	plant2 = plant + 1;
	axe   = vocab(DECR(a,x,e,\0,\0), 1, 0);
	mirror= vocab(DECR(m,i,r,r,o), 1, 0);
	dragon= vocab(DECR(d,r,a,g,o), 1, 0);
	chasm = vocab(DECR(c,h,a,s,m), 1, 0);
	troll = vocab(DECR(t,r,o,l,l), 1, 0);
	troll2 = troll + 1;
	bear  = vocab(DECR(b,e,a,r,\0),1, 0);
	messag= vocab(DECR(m,e,s,s,a), 1, 0);
	vend  = vocab(DECR(v,e,n,d,i), 1, 0);
	batter= vocab(DECR(b,a,t,t,e), 1, 0);

	nugget= vocab(DECR(g,o,l,d,\0),1, 0);
	coins = vocab(DECR(c,o,i,n,s), 1, 0);
	chest = vocab(DECR(c,h,e,s,t), 1, 0);
	eggs  = vocab(DECR(e,g,g,s,\0),1, 0);
	tridnt= vocab(DECR(t,r,i,d,e), 1, 0);
	vase  = vocab(DECR(v,a,s,e,\0),1, 0);
	emrald= vocab(DECR(e,m,e,r,a), 1, 0);
	pyram = vocab(DECR(p,y,r,a,m), 1, 0);
	pearl = vocab(DECR(p,e,a,r,l), 1, 0);
	rug   = vocab(DECR(r,u,g,\0,\0),1, 0);
	chain = vocab(DECR(c,h,a,i,n), 1, 0);

	back  = vocab(DECR(b,a,c,k,\0),0, 0);
	look  = vocab(DECR(l,o,o,k,\0),0, 0);
	cave  = vocab(DECR(c,a,v,e,\0),0, 0);
	null  = vocab(DECR(n,u,l,l,\0),0, 0);
	entrnc= vocab(DECR(e,n,t,r,a), 0, 0);
	dprssn= vocab(DECR(d,e,p,r,e), 0, 0);
	enter = vocab(DECR(e,n,t,e,r), 0, 0);

	pour  = vocab(DECR(p,o,u,r,\0), 2, 0);
	say   = vocab(DECR(s,a,y,\0,\0),2, 0);
	lock  = vocab(DECR(l,o,c,k,\0),2, 0);
	throw = vocab(DECR(t,h,r,o,w), 2, 0);
	find  = vocab(DECR(f,i,n,d,\0),2, 0);
	invent= vocab(DECR(i,n,v,e,n), 2, 0);

	/* initialize dwarves */
	chloc = 114;
	chloc2 = 140;
	for (i = 1; i <= 6; i++)
		dseen[i] = FALSE;
	dflag = 0;
	dloc[1] = 19;
	dloc[2] = 27;
	dloc[3] = 33;
	dloc[4] = 44;
	dloc[5] = 64;
	dloc[6] = chloc;
	daltlc = 18;

	/* random flags & ctrs */
	turns = 0;
	lmwarn = FALSE;
	iwest = 0;
	knfloc = 0;
	detail = 0;
	abbnum = 5;
	for (i = 0; i <= 4; i++)
		if (rtext[2 * i + 81].seekadr != 0)
			maxdie = i + 1;
	numdie = holdng = dkill = foobar = bonus = 0;
	clock1 = 30;
	clock2 = 50;
	saved = 0;
	closng = panic = closed = scorng = FALSE;
}
Exemplo n.º 13
0
linkdata()                              /*  secondary data manipulation */
{      
	int i,j;

	/*      array linkages          */
	for (i=1; i<=LOCSIZ; i++)
		if (ltext[i].seekadr!=0 && travel[i] != 0)
			if ((travel[i]->tverb)==1) cond[i]=2;
	for (j=100; j>0; j--)
		if (fixd[j]>0)
		{       drop(j+100,fixd[j]);
			drop(j,plac[j]);
		}
	for (j=100; j>0; j--)
	{       fixed[j]=fixd[j];
		if (plac[j]!=0 && fixd[j]<=0) drop(j,plac[j]);
	}

	maxtrs=79;
	tally=0;
	tally2=0;

	for (i=50; i<=maxtrs; i++)
	{       if (ptext[i].seekadr!=0) prop[i] = -1;
		tally -= prop[i];
	}
	//printf("Defining mnemonics\n");
	/* DEFINE SOME HANDY MNEMONICS.  THESE CORRESPOND TO OBJECT NUMBERS. */
	keys = vocab("keys\0", 1);
	lamp = vocab("lamp\0", 1);
	grate = vocab("grate", 1);
	cage  = vocab("cage\0",1);
	rod   = vocab("rod\0\0",1);
	rod2=rod+1;
	steps=vocab("steps",1);
	bird  = vocab("bird\0",1);
	door  = vocab("door\0",1);
	pillow= vocab("pillo", 1);
	snake = vocab("snake", 1);
	fissur= vocab("fissu", 1);
	tablet= vocab("table", 1);
	clam  = vocab("clam\0",1);
	oyster= vocab("oyste", 1);
	magzin= vocab("magaz", 1);
	dwarf = vocab("dwarf", 1);
	knife = vocab("knife", 1);
	food  = vocab("food\0",1);
	bottle= vocab("bottl", 1);
	water = vocab("water", 1);
	oil   = vocab("oil\0\0",1);
	plant = vocab("plant", 1);
	plant2=plant+1;
	axe   = vocab("axe\0\0",1);
	mirror= vocab("mirro", 1);
	dragon= vocab("drago", 1);
	chasm = vocab("chasm", 1);
	troll = vocab("troll", 1);
	troll2=troll+1;
	bear  = vocab("bear\0",1);
	messag= vocab("messa", 1);
	vend  = vocab("vendi", 1);
	batter= vocab("batte", 1);

	nugget= vocab("gold\0",1);
	coins = vocab("coins", 1);
	chest = vocab("chest", 1);
	eggs  = vocab("eggs\0",1);
	tridnt= vocab("tride", 1);
	vase  = vocab("vase\0",1);
	emrald= vocab("emera", 1);
	pyram = vocab("pyram", 1);
	pearl = vocab("pearl", 1);
	rug   = vocab("rug\0\0",1);
	chain = vocab("chain", 1);

	back  = vocab("back\0",0);
	look  = vocab("look\0",0);
	cave  = vocab("cave\0",0);
	null  = vocab("null\0",0);
	entrnc= vocab("entra", 0);
	dprssn= vocab("depre", 0);
	enter = vocab("enter", 0);

	pour  = vocab("pour\0", 2);
	say   = vocab("say\0\0",2);
	lock  = vocab("lock\0",2);
	throw = vocab("throw", 2);
	find  = vocab("find\0",2);
	invent= vocab("inven", 2);
	//printf("Mnemonics finished\n");
	/* initialize dwarves */
	chloc=114;
	chloc2=140;
	for (i=1; i<=6; i++)
		dseen[i]=FALSE;
	dflag=0;
	dloc[1]=19;
	dloc[2]=27;
	dloc[3]=33;
	dloc[4]=44;
	dloc[5]=64;
	dloc[6]=chloc;
	daltlc=18;

	/* random flags & ctrs */
	turns=0;
	lmwarn=FALSE;
	iwest=0;
	knfloc=0;
	detail=0;
	abbnum=5;
	for (i=0; i<=4; i++)
		if (rtext[2*i+81].seekadr!=0) maxdie=i+1;
	numdie=holdng=dkill=foobar=bonus=0;
	clock1=30;
	clock2=50;
	saved=0;
	closng=panic=closed=scorng=FALSE;
}
Exemplo n.º 14
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);

}
static void
linkdata(void)
{				/* secondary data manipulation */
	int     i, j;

	/* array linkages */
	for (i = 1; i < LOCSIZE; i++)
		if (ltext[i].seekadr != 0 && travel[i] != 0)
			if ((travel[i]->tverb) == 1)
				cond[i] = 2;
	for (j = 100; j > 0; j--)
		if (fixd[j] > 0) {
			drop(j + 100, fixd[j]);
			drop(j, plac[j]);
		}
	for (j = 100; j > 0; j--) {
		fixed[j] = fixd[j];
		if (plac[j] != 0 && fixd[j] <= 0)
			drop(j, plac[j]);
	}

	maxtrs = 79;
	tally = 0;
	tally2 = 0;

	for (i = 50; i <= maxtrs; i++) {
		if (ptext[i].seekadr != 0)
			prop[i] = -1;
		tally -= prop[i];
	}

	/* define mnemonics */
	keys = vocab(DECR('k', 'e', 'y', 's', '\0'), 1, 0);
	lamp = vocab(DECR('l', 'a', 'm', 'p', '\0'), 1, 0);
	grate = vocab(DECR('g', 'r', 'a', 't', 'e'), 1, 0);
	cage = vocab(DECR('c', 'a', 'g', 'e', '\0'), 1, 0);
	rod = vocab(DECR('r', 'o', 'd', '\0', '\0'), 1, 0);
	rod2 = rod + 1;
	steps = vocab(DECR('s', 't', 'e', 'p', 's'), 1, 0);
	bird = vocab(DECR('b', 'i', 'r', 'd', '\0'), 1, 0);
	door = vocab(DECR('d', 'o', 'o', 'r', '\0'), 1, 0);
	pillow = vocab(DECR('p', 'i', 'l', 'l', 'o'), 1, 0);
	snake = vocab(DECR('s', 'n', 'a', 'k', 'e'), 1, 0);
	fissure = vocab(DECR('f', 'i', 's', 's', 'u'), 1, 0);
	tablet = vocab(DECR('t', 'a', 'b', 'l', 'e'), 1, 0);
	clam = vocab(DECR('c', 'l', 'a', 'm', '\0'), 1, 0);
	oyster = vocab(DECR('o', 'y', 's', 't', 'e'), 1, 0);
	magazine = vocab(DECR('m', 'a', 'g', 'a', 'z'), 1, 0);
	dwarf = vocab(DECR('d', 'w', 'a', 'r', 'f'), 1, 0);
	knife = vocab(DECR('k', 'n', 'i', 'f', 'e'), 1, 0);
	food = vocab(DECR('f', 'o', 'o', 'd', '\0'), 1, 0);
	bottle = vocab(DECR('b', 'o', 't', 't', 'l'), 1, 0);
	water = vocab(DECR('w', 'a', 't', 'e', 'r'), 1, 0);
	oil = vocab(DECR('o', 'i', 'l', '\0', '\0'), 1, 0);
	plant = vocab(DECR('p', 'l', 'a', 'n', 't'), 1, 0);
	plant2 = plant + 1;
	axe = vocab(DECR('a', 'x', 'e', '\0', '\0'), 1, 0);
	mirror = vocab(DECR('m', 'i', 'r', 'r', 'o'), 1, 0);
	dragon = vocab(DECR('d', 'r', 'a', 'g', 'o'), 1, 0);
	chasm = vocab(DECR('c', 'h', 'a', 's', 'm'), 1, 0);
	troll = vocab(DECR('t', 'r', 'o', 'l', 'l'), 1, 0);
	troll2 = troll + 1;
	bear = vocab(DECR('b', 'e', 'a', 'r', '\0'), 1, 0);
	message = vocab(DECR('m', 'e', 's', 's', 'a'), 1, 0);
	vend = vocab(DECR('v', 'e', 'n', 'd', 'i'), 1, 0);
	batter = vocab(DECR('b', 'a', 't', 't', 'e'), 1, 0);

	nugget = vocab(DECR('g', 'o', 'l', 'd', '\0'), 1, 0);
	coins = vocab(DECR('c', 'o', 'i', 'n', 's'), 1, 0);
	chest = vocab(DECR('c', 'h', 'e', 's', 't'), 1, 0);
	eggs = vocab(DECR('e', 'g', 'g', 's', '\0'), 1, 0);
	trident = vocab(DECR('t', 'r', 'i', 'd', 'e'), 1, 0);
	vase = vocab(DECR('v', 'a', 's', 'e', '\0'), 1, 0);
	emerald = vocab(DECR('e', 'm', 'e', 'r', 'a'), 1, 0);
	pyramid = vocab(DECR('p', 'y', 'r', 'a', 'm'), 1, 0);
	pearl = vocab(DECR('p', 'e', 'a', 'r', 'l'), 1, 0);
	rug = vocab(DECR('r', 'u', 'g', '\0', '\0'), 1, 0);
	chain = vocab(DECR('c', 'h', 'a', 'i', 'n'), 1, 0);

	back = vocab(DECR('b', 'a', 'c', 'k', '\0'), 0, 0);
	look = vocab(DECR('l', 'o', 'o', 'k', '\0'), 0, 0);
	cave = vocab(DECR('c', 'a', 'v', 'e', '\0'), 0, 0);
	null = vocab(DECR('n', 'u', 'l', 'l', '\0'), 0, 0);
	entrance = vocab(DECR('e', 'n', 't', 'r', 'a'), 0, 0);
	depression = vocab(DECR('d', 'e', 'p', 'r', 'e'), 0, 0);
	enter = vocab(DECR('e', 'n', 't', 'e', 'r'), 0, 0);

	pour = vocab(DECR('p', 'o', 'u', 'r', '\0'), 2, 0);
	say = vocab(DECR('s', 'a', 'y', '\0', '\0'), 2, 0);
	lock = vocab(DECR('l', 'o', 'c', 'k', '\0'), 2, 0);
	throw = vocab(DECR('t', 'h', 'r', 'o', 'w'), 2, 0);
	find = vocab(DECR('f', 'i', 'n', 'd', '\0'), 2, 0);
	invent = vocab(DECR('i', 'n', 'v', 'e', 'n'), 2, 0);

	/* initialize dwarves */
	chloc = 114;
	chloc2 = 140;
	for (i = 1; i <= 6; i++)
		dseen[i] = FALSE;
	dflag = 0;
	dloc[1] = 19;
	dloc[2] = 27;
	dloc[3] = 33;
	dloc[4] = 44;
	dloc[5] = 64;
	dloc[6] = chloc;
	daltloc = 18;

	/* random flags & ctrs */
	turns = 0;
	lmwarn = FALSE;
	iwest = 0;
	knfloc = 0;
	detail = 0;
	abbnum = 5;
	for (i = 0; i <= 4; i++)
		if (rtext[2 * i + 81].seekadr != 0)
			maxdie = i + 1;
	numdie = holding = dkill = foobar = bonus = 0;
	clock1 = 30;
	clock2 = 50;
	saved = 0;
	isclosing = panic = closed = scoring = FALSE;
}