Merge branch 'master' into actions-arithmetic

This commit is contained in:
Peje Nilsson 2017-06-16 17:43:14 +02:00
commit adbbd1df25
17 changed files with 3593 additions and 127 deletions

View file

@ -48,7 +48,7 @@ static int attack(FILE *input, long verb, token_t obj)
RSPEAK(spk); RSPEAK(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
DSTROY(BIRD); DESTROY(BIRD);
game.prop[BIRD]=0; game.prop[BIRD]=0;
spk=BIRD_DEAD; spk=BIRD_DEAD;
} }
@ -69,27 +69,23 @@ static int attack(FILE *input, long verb, token_t obj)
if (obj == OGRE && d > 0) { if (obj == OGRE && d > 0) {
RSPEAK(spk); RSPEAK(spk);
RSPEAK(KNIFE_THROWN); RSPEAK(KNIFE_THROWN);
DSTROY(OGRE); DESTROY(OGRE);
int k=0; int dwarves=0;
for (int i=1; i < PIRATE; i++) { for (int i=1; i < PIRATE; i++) {
if (game.dloc[i] == game.loc) { if (game.dloc[i] == game.loc) {
++k; ++dwarves;
game.dloc[i] = LOC_LONGWEST; game.dloc[i] = LOC_LONGWEST;
game.dseen[i]=false; game.dseen[i]=false;
} }
} }
spk=k == 2 ? OGRE_PANIC1 : OGRE_PANIC2; spk=dwarves == 2 ? OGRE_PANIC1 : OGRE_PANIC2;
RSPEAK(spk); RSPEAK(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
else if (obj == BEAR)
if (obj == BEAR)
/* FIXME: Arithmetic on message numbers */ /* FIXME: Arithmetic on message numbers */
spk = BEAR_HANDS+(game.prop[BEAR]+1)/2; spk = BEAR_HANDS+(game.prop[BEAR]+1)/2;
if (obj != DRAGON || game.prop[DRAGON] != 0) { else if (obj == DRAGON && game.prop[DRAGON] == 0) {
RSPEAK(spk);
return GO_CLEAROBJ;
}
/* Fun stuff for dragon. If he insists on attacking it, win! /* Fun stuff for dragon. If he insists on attacking it, win!
* Set game.prop to dead, move dragon to central loc (still * Set game.prop to dead, move dragon to central loc (still
* fixed), move rug there (not fixed), and move him there, * fixed), move rug there (not fixed), and move him there,
@ -113,6 +109,10 @@ static int attack(FILE *input, long verb, token_t obj)
} }
game.loc=k; game.loc=k;
return GO_MOVE; return GO_MOVE;
}
RSPEAK(spk);
return GO_CLEAROBJ;
} }
static int bigwords(long foo) static int bigwords(long foo)
@ -161,7 +161,7 @@ static int bivalve(token_t verb, token_t obj)
if (!TOTING(TRIDNT))spk= is_oyster ? OYSTER_OPENER : CLAM_OPENER; if (!TOTING(TRIDNT))spk= is_oyster ? OYSTER_OPENER : CLAM_OPENER;
if (verb == LOCK)spk=HUH_MAN; if (verb == LOCK)spk=HUH_MAN;
if (spk == PEARL_FALLS) { if (spk == PEARL_FALLS) {
DSTROY(CLAM); DESTROY(CLAM);
DROP(OYSTER,game.loc); DROP(OYSTER,game.loc);
DROP(PEARL,LOC_CULDESAC); DROP(PEARL,LOC_CULDESAC);
} }
@ -243,7 +243,7 @@ static int carry(token_t verb, token_t obj)
if (obj == SIGN)spk=HAND_PASSTHROUGH; if (obj == SIGN)spk=HAND_PASSTHROUGH;
if (obj == MESSAG) { if (obj == MESSAG) {
RSPEAK(REMOVE_MESSAGE); RSPEAK(REMOVE_MESSAGE);
DSTROY(MESSAG); DESTROY(MESSAG);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
if (game.fixed[obj] != 0) { if (game.fixed[obj] != 0) {
@ -269,7 +269,7 @@ static int carry(token_t verb, token_t obj)
} }
else if (obj == BIRD && game.prop[BIRD] != 1 && -1-game.prop[BIRD] != 1) { else if (obj == BIRD && game.prop[BIRD] != 1 && -1-game.prop[BIRD] != 1) {
if (game.prop[BIRD] == 2) { if (game.prop[BIRD] == 2) {
DSTROY(BIRD); DESTROY(BIRD);
RSPEAK(BIRD_CRAP); RSPEAK(BIRD_CRAP);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
@ -285,7 +285,7 @@ static int carry(token_t verb, token_t obj)
CARRY(BIRD+CAGE-obj,game.loc); CARRY(BIRD+CAGE-obj,game.loc);
CARRY(obj,game.loc); CARRY(obj,game.loc);
if (obj == BOTTLE && LIQUID() != 0) if (obj == BOTTLE && LIQUID() != 0)
game.place[LIQUID()] = -1; game.place[LIQUID()] = CARRIED;
if (GSTONE(obj) && game.prop[obj] != 0) { if (GSTONE(obj) && game.prop[obj] != 0) {
game.prop[obj]=0; game.prop[obj]=0;
game.prop[CAVITY]=1; game.prop[CAVITY]=1;
@ -335,7 +335,7 @@ static int discard(token_t verb, token_t obj, bool just_do_it)
if (obj == BIRD && HERE(SNAKE)) { if (obj == BIRD && HERE(SNAKE)) {
RSPEAK(BIRD_ATTACKS); RSPEAK(BIRD_ATTACKS);
if (game.closed) return GO_DWARFWAKE; if (game.closed) return GO_DWARFWAKE;
DSTROY(SNAKE); DESTROY(SNAKE);
/* Set game.prop for use by travel options */ /* Set game.prop for use by travel options */
game.prop[SNAKE]=1; game.prop[SNAKE]=1;
@ -357,13 +357,13 @@ static int discard(token_t verb, token_t obj, bool just_do_it)
} }
} }
} else if (obj == COINS && HERE(VEND)) { } else if (obj == COINS && HERE(VEND)) {
DSTROY(COINS); DESTROY(COINS);
DROP(BATTER,game.loc); DROP(BATTER,game.loc);
PSPEAK(BATTER,0); PSPEAK(BATTER,0);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) { } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) {
RSPEAK(BIRD_BURNT); RSPEAK(BIRD_BURNT);
DSTROY(BIRD); DESTROY(BIRD);
game.prop[BIRD]=0; game.prop[BIRD]=0;
return GO_CLEAROBJ; return GO_CLEAROBJ;
} else if (obj == BEAR && AT(TROLL)) { } else if (obj == BEAR && AT(TROLL)) {
@ -386,7 +386,7 @@ static int discard(token_t verb, token_t obj, bool just_do_it)
int k = LIQUID(); int k = LIQUID();
if (k == obj)obj=BOTTLE; if (k == obj)obj=BOTTLE;
if (obj == BOTTLE && k != 0) if (obj == BOTTLE && k != 0)
game.place[k]=0; game.place[k] = NOWHERE;
if (obj == CAGE && game.prop[BIRD] == 1)DROP(BIRD,game.loc); if (obj == CAGE && game.prop[BIRD] == 1)DROP(BIRD,game.loc);
DROP(obj,game.loc); DROP(obj,game.loc);
if (obj != BIRD) return GO_CLEAROBJ; if (obj != BIRD) return GO_CLEAROBJ;
@ -405,12 +405,12 @@ static int drink(token_t verb, token_t obj)
if (obj != BLOOD) { if (obj != BLOOD) {
if (obj != 0 && obj != WATER)spk=RIDICULOUS_ATTEMPT; if (obj != 0 && obj != WATER)spk=RIDICULOUS_ATTEMPT;
if (spk != RIDICULOUS_ATTEMPT && LIQUID() == WATER && HERE(BOTTLE)) { if (spk != RIDICULOUS_ATTEMPT && LIQUID() == WATER && HERE(BOTTLE)) {
game.prop[BOTTLE]=1; game.prop[BOTTLE] = 1;
game.place[WATER]=0; game.place[WATER] = NOWHERE;
spk=BOTTLE_EMPTY; spk=BOTTLE_EMPTY;
} }
} else { } else {
DSTROY(BLOOD); DESTROY(BLOOD);
game.prop[DRAGON]=2; game.prop[DRAGON]=2;
OBJSND[BIRD]=OBJSND[BIRD]+3; OBJSND[BIRD]=OBJSND[BIRD]+3;
spk=HEAD_BUZZES; spk=HEAD_BUZZES;
@ -427,11 +427,11 @@ static int eat(token_t verb, token_t obj)
if (obj == INTRANSITIVE) { if (obj == INTRANSITIVE) {
if (!HERE(FOOD)) if (!HERE(FOOD))
return GO_UNKNOWN; return GO_UNKNOWN;
DSTROY(FOOD); DESTROY(FOOD);
spk=THANKS_DELICIOUS; spk=THANKS_DELICIOUS;
} else { } else {
if (obj == FOOD) { if (obj == FOOD) {
DSTROY(FOOD); DESTROY(FOOD);
spk=THANKS_DELICIOUS; spk=THANKS_DELICIOUS;
} }
if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj == if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
@ -481,7 +481,7 @@ static int feed(token_t verb, token_t obj)
if (obj == DRAGON && game.prop[DRAGON] != 0)spk=RIDICULOUS_ATTEMPT; if (obj == DRAGON && game.prop[DRAGON] != 0)spk=RIDICULOUS_ATTEMPT;
if (obj == TROLL)spk=TROLL_VICES; if (obj == TROLL)spk=TROLL_VICES;
if (obj == SNAKE && !game.closed && HERE(BIRD)) { if (obj == SNAKE && !game.closed && HERE(BIRD)) {
DSTROY(BIRD); DESTROY(BIRD);
game.prop[BIRD]=0; game.prop[BIRD]=0;
spk = BIRD_DEVOURED; spk = BIRD_DEVOURED;
} }
@ -496,7 +496,7 @@ static int feed(token_t verb, token_t obj)
if (game.prop[BEAR] == 0)spk=NOTHING_EDIBLE; if (game.prop[BEAR] == 0)spk=NOTHING_EDIBLE;
if (game.prop[BEAR] == 3)spk=RIDICULOUS_ATTEMPT; if (game.prop[BEAR] == 3)spk=RIDICULOUS_ATTEMPT;
if (HERE(FOOD)) { if (HERE(FOOD)) {
DSTROY(FOOD); DESTROY(FOOD);
game.prop[BEAR]=1; game.prop[BEAR]=1;
game.fixed[AXE]=0; game.fixed[AXE]=0;
game.prop[AXE]=0; game.prop[AXE]=0;
@ -537,8 +537,8 @@ int fill(token_t verb, token_t obj)
spk=FILL_INVALID; spk=FILL_INVALID;
k=LIQUID(); k=LIQUID();
if (k == 0 || !HERE(BOTTLE)) {RSPEAK(spk); return GO_CLEAROBJ;} if (k == 0 || !HERE(BOTTLE)) {RSPEAK(spk); return GO_CLEAROBJ;}
game.place[k]=0; game.place[k] = NOWHERE;
game.prop[BOTTLE]=1; game.prop[BOTTLE] = 1;
if (k == OIL)game.prop[URN]=1; if (k == OIL)game.prop[URN]=1;
spk=WATER_URN+game.prop[URN]; spk=WATER_URN+game.prop[URN];
RSPEAK(spk); RSPEAK(spk);
@ -561,7 +561,7 @@ int fill(token_t verb, token_t obj)
game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2; game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2;
k=LIQUID(); k=LIQUID();
if (TOTING(BOTTLE)) if (TOTING(BOTTLE))
game.place[k] = -1; game.place[k] = CARRIED;
if (k == OIL) if (k == OIL)
spk=BOTTLED_OIL; spk=BOTTLED_OIL;
} }
@ -690,7 +690,7 @@ static int listen(void)
PSPEAK(i,OBJSND[i]+game.prop[i]); PSPEAK(i,OBJSND[i]+game.prop[i]);
spk=ARB_0; spk=ARB_0;
if (i == BIRD && OBJSND[i]+game.prop[i] == 8) if (i == BIRD && OBJSND[i]+game.prop[i] == 8)
DSTROY(BIRD); DESTROY(BIRD);
} }
RSPEAK(spk); RSPEAK(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
@ -752,8 +752,8 @@ static int pour(token_t verb, token_t obj)
if (obj != OIL && obj != WATER) {RSPEAK(spk); return GO_CLEAROBJ;} if (obj != OIL && obj != WATER) {RSPEAK(spk); return GO_CLEAROBJ;}
if (HERE(URN) && game.prop[URN] == 0) if (HERE(URN) && game.prop[URN] == 0)
return fill(verb, URN); return fill(verb, URN);
game.prop[BOTTLE]=1; game.prop[BOTTLE] = 1;
game.place[obj]=0; game.place[obj] = NOWHERE;
spk=GROUND_WET; spk=GROUND_WET;
if (!(AT(PLANT) || AT(DOOR))) if (!(AT(PLANT) || AT(DOOR)))
{RSPEAK(spk); return GO_CLEAROBJ;} {RSPEAK(spk); return GO_CLEAROBJ;}
@ -838,7 +838,7 @@ static int rub(token_t verb, token_t obj)
if (obj != LAMP) if (obj != LAMP)
spk=PECULIAR_NOTHING; spk=PECULIAR_NOTHING;
if (obj == URN && game.prop[URN] == 2) { if (obj == URN && game.prop[URN] == 2) {
DSTROY(URN); DESTROY(URN);
DROP(AMBER,game.loc); DROP(AMBER,game.loc);
game.prop[AMBER]=1; game.prop[AMBER]=1;
--game.tally; --game.tally;

View file

@ -94,7 +94,6 @@ extern long GETTXT(bool,bool,bool);
extern token_t MAKEWD(long); extern token_t MAKEWD(long);
extern void TYPE0(void); extern void TYPE0(void);
extern long VOCAB(long,long); extern long VOCAB(long,long);
extern void DSTROY(long);
extern void JUGGLE(long); extern void JUGGLE(long);
extern void MOVE(long,long); extern void MOVE(long,long);
extern long PUT(long,long,long); extern long PUT(long,long,long);
@ -131,8 +130,9 @@ extern int saveresume(FILE *, bool);
* PCT(N) = true N% of the time (N integer from 0 to 100) * PCT(N) = true N% of the time (N integer from 0 to 100)
* TOTING(OBJ) = true if the OBJ is being carried */ * TOTING(OBJ) = true if the OBJ is being carried */
#define DESTROY(N) MOVE(N, NOWHERE)
#define MOD(N,M) ((N) % (M)) #define MOD(N,M) ((N) % (M))
#define TOTING(OBJ) (game.place[OBJ] == -1) #define TOTING(OBJ) (game.place[OBJ] == CARRIED)
#define AT(OBJ) (game.place[OBJ] == game.loc || game.fixed[OBJ] == game.loc) #define AT(OBJ) (game.place[OBJ] == game.loc || game.fixed[OBJ] == game.loc)
#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ)) #define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
#define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL)) #define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
@ -207,6 +207,10 @@ enum speechpart {unknown, intransitive, transitive};
#define HOGRE 19 /* Trying to deal with ogre */ #define HOGRE 19 /* Trying to deal with ogre */
#define HJADE 20 /* Found all treasures except jade */ #define HJADE 20 /* Found all treasures except jade */
/* Special object statuses in game.place - can also be a location number (> 0) */
#define CARRIED -1 /* Player is toting it */
#define NOWHERE 0 /* It's destroyed */
/* hack to ignore GCC Unused Result */ /* hack to ignore GCC Unused Result */
#define IGNORE(r) do{if (r){}}while(0) #define IGNORE(r) do{if (r){}}while(0)

4
init.c
View file

@ -176,8 +176,8 @@ void initialise(void)
printf("Initialising...\n"); printf("Initialising...\n");
for (int i=1; i<=NOBJECTS; i++) { for (int i=1; i<=NOBJECTS; i++) {
game.place[i]=0; game.place[i] = NOWHERE;
game.prop[i]=0; game.prop[i] = 0;
game.link[i+NOBJECTS]=game.link[i]=0; game.link[i+NOBJECTS]=game.link[i]=0;
} }

16
main.c
View file

@ -262,8 +262,8 @@ bool spotted_by_pirate(int i)
/* The pirate's spotted him. He leaves him alone once we've /* The pirate's spotted him. He leaves him alone once we've
* found chest. K counts if a treasure is here. If not, and * found chest. K counts if a treasure is here. If not, and
* tally=1 for an unseen chest, let the pirate be spotted. * tally=1 for an unseen chest, let the pirate be spotted. Note
* Note that game.place[CHEST]=0 might mean that he's thrown * that game.place[CHEST] = NOWHERE might mean that he's thrown
* it to the troll, but in that case he's seen the chest * it to the troll, but in that case he's seen the chest
* (game.prop=0). */ * (game.prop=0). */
if (game.loc == game.chloc || game.prop[CHEST] >= 0) if (game.loc == game.chloc || game.prop[CHEST] >= 0)
@ -284,7 +284,7 @@ bool spotted_by_pirate(int i)
} }
} }
/* Force chest placement before player finds last treasure */ /* Force chest placement before player finds last treasure */
if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == 0 && HERE(LAMP) && game.prop[LAMP] == 1) { if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == NOWHERE && HERE(LAMP) && game.prop[LAMP] == 1) {
RSPEAK(PIRATE_SPOTTED); RSPEAK(PIRATE_SPOTTED);
movechest = true; movechest = true;
} }
@ -481,8 +481,8 @@ static void croak(FILE *cmdin)
score(endgame); score(endgame);
if (game.numdie == MAXDIE) if (game.numdie == MAXDIE)
score(endgame); score(endgame);
game.place[WATER]=0; game.place[WATER] = NOWHERE;
game.place[OIL]=0; game.place[OIL] = NOWHERE;
if (TOTING(LAMP)) if (TOTING(LAMP))
game.prop[LAMP]=0; game.prop[LAMP]=0;
for (int j=1; j<=NOBJECTS; j++) { for (int j=1; j<=NOBJECTS; j++) {
@ -754,7 +754,7 @@ static bool closecheck(void)
MOVE(TROLL2,PLAC[TROLL]); MOVE(TROLL2,PLAC[TROLL]);
MOVE(TROLL2+NOBJECTS,FIXD[TROLL]); MOVE(TROLL2+NOBJECTS,FIXD[TROLL]);
JUGGLE(CHASM); JUGGLE(CHASM);
if (game.prop[BEAR] != 3)DSTROY(BEAR); if (game.prop[BEAR] != 3)DESTROY(BEAR);
game.prop[CHAIN]=0; game.prop[CHAIN]=0;
game.fixed[CHAIN]=0; game.fixed[CHAIN]=0;
game.prop[AXE]=0; game.prop[AXE]=0;
@ -807,7 +807,7 @@ static bool closecheck(void)
for (int i=1; i<=NOBJECTS; i++) { for (int i=1; i<=NOBJECTS; i++) {
if (TOTING(i)) if (TOTING(i))
DSTROY(i); DESTROY(i);
} }
RSPEAK(CAVE_CLOSED); RSPEAK(CAVE_CLOSED);
@ -848,7 +848,7 @@ static void lampcheck(void)
if (!game.lmwarn && HERE(LAMP)) { if (!game.lmwarn && HERE(LAMP)) {
game.lmwarn=true; game.lmwarn=true;
int spk=GET_BATTERIES; int spk=GET_BATTERIES;
if (game.place[BATTER] == 0)spk=LAMP_DIM; if (game.place[BATTER] == NOWHERE)spk=LAMP_DIM;
if (game.prop[BATTER] == 1)spk=MISSING_BATTERIES; if (game.prop[BATTER] == 1)spk=MISSING_BATTERIES;
RSPEAK(spk); RSPEAK(spk);
} }

14
misc.c
View file

@ -337,12 +337,6 @@ long VOCAB(long id, long init)
BUG(21); BUG(21);
} }
void DSTROY(long object)
/* Permanently eliminate "object" by moving to a non-existent location. */
{
MOVE(object,0);
}
void JUGGLE(long object) void JUGGLE(long object)
/* Juggle an object by picking it up and putting it down again, the purpose /* 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 of things at its loc. */ * being to get the object to the front of the chain of things at its loc. */
@ -367,7 +361,7 @@ void MOVE(long object, long where)
from=game.fixed[object-NOBJECTS]; from=game.fixed[object-NOBJECTS];
else else
from=game.place[object]; from=game.place[object];
if (from > 0 && !SPECIAL(from)) if (from != NOWHERE && from != CARRIED && !SPECIAL(from))
CARRY(object,from); CARRY(object,from);
DROP(object,where); DROP(object,where);
} }
@ -388,9 +382,9 @@ void CARRY(long object, long where)
long temp; long temp;
if (object <= NOBJECTS) { if (object <= NOBJECTS) {
if (game.place[object] == -1) if (game.place[object] == CARRIED)
return; return;
game.place[object]= -1; game.place[object] = CARRIED;
++game.holdng; ++game.holdng;
} }
if (game.atloc[where] == object) { if (game.atloc[where] == object) {
@ -412,7 +406,7 @@ void DROP(long object, long where)
game.fixed[object-NOBJECTS] = where; game.fixed[object-NOBJECTS] = where;
else else
{ {
if (game.place[object] == -1) if (game.place[object] == CARRIED)
--game.holdng; --game.holdng;
game.place[object] = where; game.place[object] = where;
} }

View file

@ -41,7 +41,7 @@ void score(enum termination mode)
if(i > CHEST)k=16; if(i > CHEST)k=16;
if(game.prop[i] >= 0) if(game.prop[i] >= 0)
score += 2; score += 2;
if(game.place[i] == 3 && game.prop[i] == 0) if(game.place[i] == LOC_BUILDING && game.prop[i] == 0)
score += k-2; score += k-2;
mxscor += k; mxscor += k;
} }
@ -75,7 +75,7 @@ void score(enum termination mode)
mxscor += 45; mxscor += 45;
/* Did he come to Witt's End as he should? */ /* Did he come to Witt's End as he should? */
if(game.place[MAGZIN] == 108) if(game.place[MAGZIN] == LOC_WITTSEND)
score += 1; score += 1;
mxscor += 1; mxscor += 1;

View file

@ -14,7 +14,7 @@ all: regress
.SUFFIXES: .chk .SUFFIXES: .chk
clean: clean:
rm -fr *~ adventure.text *.adv rm -fr *~ adventure.text *.adv scratch.tmp
# Show summary lines for all tests. # Show summary lines for all tests.
testlist: testlist:
@ -32,7 +32,8 @@ buildregress:
echo "Remaking $${file}.chk"; \ echo "Remaking $${file}.chk"; \
OPTS=`sed -n /#options:/s///p <$${file}.log`; \ OPTS=`sed -n /#options:/s///p <$${file}.log`; \
advent $$OPTS <$${file}.log >$${file}.chk 2>&1 || exit 1; \ advent $$OPTS <$${file}.log >$${file}.chk 2>&1 || exit 1; \
done done; \
rm -f scratch.tmp
regress: regress:
@for file in $(TESTLOADS); do \ @for file in $(TESTLOADS); do \
$(ECHO) -n " $${file} "; grep '##' $${file}.log || echo ' ## (no description)'; \ $(ECHO) -n " $${file} "; grep '##' $${file}.log || echo ' ## (no description)'; \
@ -41,6 +42,6 @@ regress:
then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \ then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
else echo "*** Nonzero return status on $${file}!"; exit 1; fi \ else echo "*** Nonzero return status on $${file}!"; exit 1; fi \
done; \ done; \
rm -f /tmp/regress$$$$ rm -f scratch.tmp /tmp/regress$$$$
# end # end

2927
tests/breakmirror.chk Normal file

File diff suppressed because it is too large Load diff

471
tests/breakmirror.log Normal file
View file

@ -0,0 +1,471 @@
## Break the mirror in endgame and die
n
seed 1838473132
in
take lamp
xyzzy
on
take rod
e
take cage
w
w
w
drop rod
take bird
take rod
w
free bird
wave rod
take necklace
drop rod
take bird
take rod
d
d
free bird
drop rod
drop cage
take cage
take bird
w
take coins
e
s
take jewelry
n
up
s
take gold
n
d
n
n
plugh
extinguish lamp
drop coins
drop jewelry
drop necklace
drop gold
plugh
on
s
take silver
s
sw
take axe
w
kill dragon
yes
drink blood
take rug
e
e
up
d
n
n
off
plugh
inven
drop rug
drop silver
out
s
w
n
take appendage
free bird
drop cage
listen
s
s
n
in
take water
plugh
on
plover
ne
take pyramid
s
plover
s
s
take rod
up
w
wave rod
drop rod
west
take diamonds
w
w
w
s
sw
se
s
kill machine
s
s
kill ogre
n
take ruby
s
w
n
n
n
nw
d
e
e
e
e
e
throw axe
take axe
n
n
n
off
plugh
drop ruby
drop diamonds
drop pyramid
plugh
on
s
s
u
n
n
d
bedquilt
throw axe
take axe
slab
s
d
water plant
u
w
u
reservoir
H'CFL
n
n
nw
u
u
u
u
ne
take ebony
sw
d
d
d
d
d
take water
s
s
s
s
d
s
d
water plant
u
drop appendage
e
d
get oil
u
w
d
climb
w
n
oil door
drop bottle
n
take trident
w
d
se
n
w
drop trident
drop ebony
drop axe
drop lantern
e
take emerald
w
take lamp
take axe
take ebony
take trident
nw
s
take vase
se
throw axe
take axe
e
take pillow
w
drop axe
ne
e
n
open clam
s
u
e
u
n
off
plugh
drop pillow
drop vase
drop trident
drop emerald
drop ebony
take keys
take food
plugh
on
s
d
w
d
n
d
d
take pearl
u
u
s
w
w
w
w
d
climb
w
get eggs
n
take bottle
n
w
d
sw
u
toss eggs
ne
ne
barren
in
feed bear
unlock chain
take chain
take bear
fork
ne
e
take spices
drop keys
fork
w
w
sw
free bear
inven
sw
sw
d
se
se
w
d
get oil
up
e
take axe
w
w
d
climb
w
fee
fie
foe
foo
take eggs
s
d
u
w
u
s
e
e
n
n
off
plugh
drop eggs
drop pearl
drop spices
drop chain
take rug
take ruby
take emerald
out
w
n
n
n
inven
fill urn
light urn
rub urn
take amber
drop rug
drop emerald
fly rug
take sapphire
fly rug
take emerald
drop ruby
take rug
drop bottle
take ruby
e
s
e
e
in
drop ruby
drop sapphire
drop amber
drop rug
look
plugh
on
s
s
u
w
w
w
s
e
s
throw axe
take axe
s
s
n
e
e
nw
take emerald
take chest
se
n
d
e
e
off
xyzzy
drop emerald
drop chest
plugh
on
s
d
w
d
e
take magazine
e
drop magazine
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
u
u
e
u
n
plover
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
e
# Everything to here is from endgame428
sw
break mirror

View file

@ -1297,10 +1297,6 @@ You're in n/s passage above e/w passage.
You're in Hall of Mt King. You're in Hall of Mt King.
> drop axe
OK
> e > e
You're in Hall of Mists. You're in Hall of Mists.
@ -1380,10 +1376,7 @@ The pirate's treasure chest is here!
You are currently holding the following: You are currently holding the following:
Brass lantern Brass lantern
Velvet pillow Velvet pillow
Dwarf's axe
> take ebony
OK
> take vase > take vase
@ -1457,10 +1450,6 @@ There is food here.
OK OK
> drop ebony
OK
> drop pillow > drop pillow
OK OK
@ -1601,7 +1590,11 @@ The way north leads through a massive, rusty, iron door.
> take bottle > take bottle
OK You can't carry anything more. You'll have to drop something first.
> pour bottle
Bottl what?
> n > n
@ -1670,7 +1663,11 @@ There is a ferocious cave bear eying you from the far end of the room!
The bear is locked to the wall with a golden chain! The bear is locked to the wall with a golden chain!
> feed bear > throw axe
The axe misses and lands near the bear where you can't get at it.
> throw food
The bear eagerly wolfs down your food, after which he seems to calm The bear eagerly wolfs down your food, after which he seems to calm
down considerably and even becomes rather friendly. down considerably and even becomes rather friendly.
@ -1700,15 +1697,14 @@ OK
You are currently holding the following: You are currently holding the following:
Set of keys Set of keys
Brass lantern Brass lantern
Small bottle
Egg-sized emerald Egg-sized emerald
Glistening pearl Glistening pearl
You are being followed by a very large, tame bear. You are being followed by a very large, tame bear.
You scored 239 out of a possible 430, using 295 turns. You scored 225 out of a possible 430, using 294 turns.
You may now consider yourself a "Seasoned Adventurer". You may now consider yourself a "Seasoned Adventurer".
To achieve the next higher rating, you need 12 more points. To achieve the next higher rating, you need 26 more points.

View file

@ -223,7 +223,6 @@ u
e e
u u
s s
drop axe
e e
w w
w w
@ -238,7 +237,6 @@ e
e e
nw nw
inven inven
take ebony
take vase take vase
take trident take trident
take chest take chest
@ -251,7 +249,6 @@ e
off off
xyzzy xyzzy
drop chest drop chest
drop ebony
drop pillow drop pillow
drop vase drop vase
drop trident drop trident
@ -279,7 +276,9 @@ climb
w w
get eggs get eggs
n n
# Test for "Ground wet" message
take bottle take bottle
pour bottle
n n
w w
d d
@ -291,7 +290,8 @@ ne
ne ne
barren barren
in in
feed bear throw axe
throw food
take chain take chain
unlock chain unlock chain
# Also tests message from bear in inventory # Also tests message from bear in inventory

26
tests/logopt.chk Normal file
View file

@ -0,0 +1,26 @@
Welcome to Adventure!! Would you like instructions?
> > >
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.
>
You are inside a building, a well house for a large spring.
There are some keys on the ground here.
There is a shiny brass lamp nearby.
There is food here.
There is a bottle of water here.
>
>
You scored 32 out of a possible 430, using 1 turn.
You are obviously a rank amateur. Better luck next time.
To achieve the next higher rating, you need 14 more points.

5
tests/logopt.log Normal file
View file

@ -0,0 +1,5 @@
## Exercise logging option and seed dump
#options: -s -l scratch.tmp
n
in

View file

@ -7,8 +7,8 @@ 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 Around you is a forest. A small stream flows out of the building and
down a gully. down a gully.
> seed 1924231168 > seed 739688815
Seed set to 1924231168 Seed set to 739688815
You're in front of building. You're in front of building.
@ -507,10 +507,6 @@ You are in a maze of twisty little passages, all alike.
There is a little axe here. There is a little axe here.
> thake axe
Sorry, I don't know the word "THAKE".
> take axe > take axe
OK OK
@ -524,10 +520,6 @@ You are in a maze of twisty little passages, all alike.
There is a little axe here. There is a little axe here.
> taje axe
Sorry, I don't know the word "TAJE".
> take axe > take axe
OK OK
@ -584,17 +576,55 @@ You are in a maze of twisty little passages, all alike.
You are in a maze of twisty little passages, all alike. You are in a maze of twisty little passages, all alike.
> inven > n
You are currently holding the following: You are in a maze of twisty little passages, all alike.
Brass lantern
Wicker cage > s
Little bird in cage
Dwarf's axe You are in a maze of twisty little passages, all alike.
> e
Dead end
> w
You are in a maze of twisty little passages, all alike.
> n
You are in a maze of twisty little passages, all alike.
> s
You are in a maze of twisty little passages, all alike.
> e
You are in a maze of twisty little passages, all alike.
> sw
There is no way to go that direction.
You are in a maze of twisty little passages, all alike.
Do you need help getting out of the maze?
> y
I am prepared to give you a hint, but it will cost you 4 points.
Do you want the hint?
> y
You can make the passages look less alike by dropping things.
You scored 75 out of a possible 430, using 108 turns. You scored 71 out of a possible 430, using 113 turns.
Your score qualifies you as a novice class adventurer. Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 46 more points. To achieve the next higher rating, you need 50 more points.

View file

@ -1,5 +1,5 @@
n n
seed 1924231168 seed 739688815
seed 1071883378 seed 1071883378
in in
take lamp take lamp
@ -90,10 +90,8 @@ w
throw axe throw axe
take axe take axe
throw axe throw axe
thake axe
take axe take axe
throw axe throw axe
taje axe
take axe take axe
w w
w w
@ -108,4 +106,13 @@ w
w w
w w
w w
inven n
s
e
w
n
s
e
sw
y
y

View file

@ -96,6 +96,10 @@ It is now pitch dark. If you proceed you will likely fall into a pit.
Read what? Read what?
> read keys
I see no keys here.
> on lamp > on lamp
Your lamp is now on. Your lamp is now on.
@ -137,7 +141,7 @@ have no bird seed.
The little bird is now dead. Its body disappears. The little bird is now dead. Its body disappears.
You scored 32 out of a possible 430, using 23 turns. You scored 32 out of a possible 430, using 24 turns.
You are obviously a rank amateur. Better luck next time. You are obviously a rank amateur. Better luck next time.

View file

@ -17,6 +17,7 @@ w
take cage take cage
w w
read read
read keys
on lamp on lamp
read read
w w