Merge branch 'master' into magic-number
This commit is contained in:
commit
c84d370918
13 changed files with 251 additions and 10 deletions
|
@ -1054,7 +1054,8 @@ int action(FILE *input, enum speechpart part, token_t verb, token_t obj)
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case intransitive:
|
case intransitive:
|
||||||
if (WD2 > 0 && verb != SAY) return (2800);
|
if (WD2 > 0 && verb != SAY)
|
||||||
|
return GO_WORD2;
|
||||||
if (verb == SAY)obj = WD2;
|
if (verb == SAY)obj = WD2;
|
||||||
if (obj == 0 || obj == INTRANSITIVE) {
|
if (obj == 0 || obj == INTRANSITIVE) {
|
||||||
/* Analyse an intransitive verb (ie, no object given yet). */
|
/* Analyse an intransitive verb (ie, no object given yet). */
|
||||||
|
|
3
advent.h
3
advent.h
|
@ -91,6 +91,9 @@ extern void* xmalloc(size_t size);
|
||||||
extern char* xstrdup(const char*);
|
extern char* xstrdup(const char*);
|
||||||
extern void packed_to_token(long, char token[]);
|
extern void packed_to_token(long, char token[]);
|
||||||
extern void speak(const char*);
|
extern void speak(const char*);
|
||||||
|
extern bool wordeq(token_t, token_t);
|
||||||
|
extern bool wordempty(token_t);
|
||||||
|
extern void wordclear(token_t *);
|
||||||
extern void PSPEAK(vocab_t, int);
|
extern void PSPEAK(vocab_t, int);
|
||||||
extern void RSPEAK(vocab_t);
|
extern void RSPEAK(vocab_t);
|
||||||
extern void SETPRM(long, long, long);
|
extern void SETPRM(long, long, long);
|
||||||
|
|
2
init.c
2
init.c
|
@ -131,7 +131,7 @@
|
||||||
* apply to players whose scores are higher than the previous N but not
|
* apply to players whose scores are higher than the previous N but not
|
||||||
* higher than this N. Note that these scores probably change with every
|
* higher than this N. Note that these scores probably change with every
|
||||||
* modification (and particularly expansion) of the program.
|
* modification (and particularly expansion) of the program.
|
||||||
* SECTION 11: Hints. Each line contains a hint number (add 10 to get cond
|
* Section 11: Hints. Each line contains a hint number (add 10 to get cond
|
||||||
* bit; see section 9), the number of turns he must be at the right loc(s)
|
* bit; see section 9), the number of turns he must be at the right loc(s)
|
||||||
* before triggering the hint, the points deducted for taking the hint,
|
* before triggering the hint, the points deducted for taking the hint,
|
||||||
* the message number (section 6) of the question, and the message number
|
* the message number (section 6) of the question, and the message number
|
||||||
|
|
9
main.c
9
main.c
|
@ -1060,8 +1060,9 @@ L2607:
|
||||||
if (V1 == ENTER && WD2 > 0) {
|
if (V1 == ENTER && WD2 > 0) {
|
||||||
WD1 = WD2;
|
WD1 = WD2;
|
||||||
WD1X = WD2X;
|
WD1X = WD2X;
|
||||||
WD2 = 0;
|
wordclear(&WD2);
|
||||||
} else {
|
} else {
|
||||||
|
/* FIXME: Magic numbers */
|
||||||
if (!((V1 != 1000 + WATER && V1 != 1000 + OIL) ||
|
if (!((V1 != 1000 + WATER && V1 != 1000 + OIL) ||
|
||||||
(V2 != 1000 + PLANT && V2 != 1000 + DOOR))) {
|
(V2 != 1000 + PLANT && V2 != 1000 + DOOR))) {
|
||||||
if (AT(V2 - 1000))
|
if (AT(V2 - 1000))
|
||||||
|
@ -1071,12 +1072,12 @@ L2607:
|
||||||
WD1 = MAKEWD(WORD_CATCH);
|
WD1 = MAKEWD(WORD_CATCH);
|
||||||
}
|
}
|
||||||
L2620:
|
L2620:
|
||||||
if (WD1 == MAKEWD(WORD_WEST)) {
|
if (wordeq(WD1, MAKEWD(WORD_WEST))) {
|
||||||
++game.iwest;
|
++game.iwest;
|
||||||
if (game.iwest == 10)
|
if (game.iwest == 10)
|
||||||
RSPEAK(W_IS_WEST);
|
RSPEAK(W_IS_WEST);
|
||||||
}
|
}
|
||||||
if (WD1 == MAKEWD(WORD_GO) && WD2 != 0) {
|
if (wordeq(WD1, MAKEWD(WORD_GO)) && !wordempty(WD2)) {
|
||||||
if (++igo == 10)
|
if (++igo == 10)
|
||||||
RSPEAK(GO_UNNEEDED);
|
RSPEAK(GO_UNNEEDED);
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1134,7 @@ Laction:
|
||||||
/* Get second word for analysis. */
|
/* Get second word for analysis. */
|
||||||
WD1 = WD2;
|
WD1 = WD2;
|
||||||
WD1X = WD2X;
|
WD1X = WD2X;
|
||||||
WD2 = 0;
|
wordclear(&WD2);
|
||||||
goto L2620;
|
goto L2620;
|
||||||
case GO_UNKNOWN:
|
case GO_UNKNOWN:
|
||||||
/* Random intransitive verbs come here. Clear obj just in case
|
/* Random intransitive verbs come here. Clear obj just in case
|
||||||
|
|
17
misc.c
17
misc.c
|
@ -50,6 +50,23 @@ void packed_to_token(long packed, char token[6])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hide the fact that wods are corrently packed longs */
|
||||||
|
|
||||||
|
bool wordeq(token_t a, token_t b)
|
||||||
|
{
|
||||||
|
return a == b;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wordempty(token_t a)
|
||||||
|
{
|
||||||
|
return a == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wordclear(token_t *v)
|
||||||
|
{
|
||||||
|
*v = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* I/O routines (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
|
/* I/O routines (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
|
||||||
|
|
||||||
void speak(const char* msg)
|
void speak(const char* msg)
|
||||||
|
|
37
tests/drinkfail.chk
Normal file
37
tests/drinkfail.chk
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
Welcome to Adventure!! Would you like instructions?
|
||||||
|
|
||||||
|
> n
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> in
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> xyzzy
|
||||||
|
|
||||||
|
>>Foof!<<
|
||||||
|
|
||||||
|
It is now pitch dark. If you proceed you will likely fall into a pit.
|
||||||
|
|
||||||
|
> drink
|
||||||
|
|
||||||
|
Drink what?
|
||||||
|
|
||||||
|
|
||||||
|
You scored 32 out of a possible 430, using 3 turns.
|
||||||
|
|
||||||
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
To achieve the next higher rating, you need 14 more points.
|
5
tests/drinkfail.log
Normal file
5
tests/drinkfail.log
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
## Drink unknown
|
||||||
|
n
|
||||||
|
in
|
||||||
|
xyzzy
|
||||||
|
drink
|
57
tests/fillfail.chk
Normal file
57
tests/fillfail.chk
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
Welcome to Adventure!! Would you like instructions?
|
||||||
|
|
||||||
|
> n
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> in
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> carry lamp
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
> carry bottle
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
> fill bottle
|
||||||
|
|
||||||
|
Your bottle is already full.
|
||||||
|
|
||||||
|
> drink
|
||||||
|
|
||||||
|
The bottle of water is now empty.
|
||||||
|
|
||||||
|
> xyzzy
|
||||||
|
|
||||||
|
>>Foof!<<
|
||||||
|
|
||||||
|
It is now pitch dark. If you proceed you will likely fall into a pit.
|
||||||
|
|
||||||
|
> fill lamp
|
||||||
|
|
||||||
|
You can't fill that.
|
||||||
|
|
||||||
|
> fill bottle
|
||||||
|
|
||||||
|
There is nothing here with which to fill the bottle.
|
||||||
|
|
||||||
|
|
||||||
|
You scored 32 out of a possible 430, using 8 turns.
|
||||||
|
|
||||||
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
To achieve the next higher rating, you need 14 more points.
|
10
tests/fillfail.log
Normal file
10
tests/fillfail.log
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
## Attempt to fill lamp, attempt to fill bottle with no source
|
||||||
|
n
|
||||||
|
in
|
||||||
|
carry lamp
|
||||||
|
carry bottle
|
||||||
|
fill bottle
|
||||||
|
drink
|
||||||
|
xyzzy
|
||||||
|
fill lamp
|
||||||
|
fill bottle
|
|
@ -31,6 +31,54 @@ Seed set to 1801426495
|
||||||
|
|
||||||
You're in front of building.
|
You're in front of building.
|
||||||
|
|
||||||
|
> in
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> nothing food
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
> calm food
|
||||||
|
|
||||||
|
I'm game. Would you care to explain how?
|
||||||
|
|
||||||
|
> walk food
|
||||||
|
|
||||||
|
Where?
|
||||||
|
|
||||||
|
> score food
|
||||||
|
|
||||||
|
Huh?
|
||||||
|
|
||||||
|
> foo food
|
||||||
|
|
||||||
|
I don't know how.
|
||||||
|
|
||||||
|
> brief food
|
||||||
|
|
||||||
|
On what?
|
||||||
|
|
||||||
|
> suspend food
|
||||||
|
|
||||||
|
Huh?
|
||||||
|
|
||||||
|
> resume food
|
||||||
|
|
||||||
|
Huh?
|
||||||
|
|
||||||
|
> out
|
||||||
|
|
||||||
|
You're in front of building.
|
||||||
|
|
||||||
> stream
|
> stream
|
||||||
|
|
||||||
You are in a valley in the forest beside a stream tumbling along a
|
You are in a valley in the forest beside a stream tumbling along a
|
||||||
|
@ -75,7 +123,9 @@ Carry what?
|
||||||
|
|
||||||
I am unsure how you are facing. Use compass points or nearby objects.
|
I am unsure how you are facing. Use compass points or nearby objects.
|
||||||
|
|
||||||
You're in front of building.
|
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.
|
||||||
|
|
||||||
> eat
|
> eat
|
||||||
|
|
||||||
|
@ -106,7 +156,7 @@ OK
|
||||||
|
|
||||||
> in
|
> in
|
||||||
|
|
||||||
You are inside a building, a well house for a large spring.
|
You're inside building.
|
||||||
|
|
||||||
There are some keys on the ground here.
|
There are some keys on the ground here.
|
||||||
|
|
||||||
|
@ -381,7 +431,7 @@ Okay, "BOO".
|
||||||
|
|
||||||
> score
|
> score
|
||||||
|
|
||||||
You have garnered 27 out of a possible 430 points, using 74 turns.
|
You have garnered 27 out of a possible 430 points, using 84 turns.
|
||||||
|
|
||||||
> quit keys
|
> quit keys
|
||||||
|
|
||||||
|
@ -395,7 +445,7 @@ Do you really want to quit now?
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
|
||||||
You scored 27 out of a possible 430, using 76 turns.
|
You scored 27 out of a possible 430, using 86 turns.
|
||||||
|
|
||||||
You are obviously a rank amateur. Better luck next time.
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,16 @@
|
||||||
foo
|
foo
|
||||||
y
|
y
|
||||||
seed 1801426495
|
seed 1801426495
|
||||||
|
in
|
||||||
|
nothing food
|
||||||
|
calm food
|
||||||
|
walk food
|
||||||
|
score food
|
||||||
|
foo food
|
||||||
|
brief food
|
||||||
|
suspend food
|
||||||
|
resume food
|
||||||
|
out
|
||||||
stream
|
stream
|
||||||
lock
|
lock
|
||||||
take water
|
take water
|
||||||
|
|
43
tests/intransitivecarry.chk
Normal file
43
tests/intransitivecarry.chk
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
Welcome to Adventure!! Would you like instructions?
|
||||||
|
|
||||||
|
> n
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> in
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> carry lamp
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
> out
|
||||||
|
|
||||||
|
You're in front of building.
|
||||||
|
|
||||||
|
> drop lamp
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
> carry
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
|
||||||
|
You scored 32 out of a possible 430, using 5 turns.
|
||||||
|
|
||||||
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
To achieve the next higher rating, you need 14 more points.
|
7
tests/intransitivecarry.log
Normal file
7
tests/intransitivecarry.log
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
## Carry when only one object is present
|
||||||
|
n
|
||||||
|
in
|
||||||
|
carry lamp
|
||||||
|
out
|
||||||
|
drop lamp
|
||||||
|
carry
|
Loading…
Add table
Add a link
Reference in a new issue