From b34aee797973e7289115446447ca0005a60a74b7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 5 Jun 2017 16:08:42 -0400 Subject: [PATCH 01/16] More hints. --- hints.adoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hints.adoc b/hints.adoc index e2d7d9c..1d2b092 100644 --- a/hints.adoc +++ b/hints.adoc @@ -1,4 +1,8 @@ -= Non-spoiler Hints = += Non-spoiler hints = + +Say the words you see. They can have interesting effects. + +Reading is fundamental. Yes, the fissure in the Hall of Mists can be bridged. By magic. @@ -14,3 +18,5 @@ Ogres laugh at humans, but for some reason dwarves frighten them badly. When rust is a problem, oil can be helpful. A lucky rabbit's foot might help you keep your footing. + +The troll might go away when you are no longer unbearable. -- 2.31.1 From e50d41561cf1ca5ee6f1dcefaa7190c8fbe2f50a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 5 Jun 2017 16:22:35 -0400 Subject: [PATCH 02/16] Add a bug warning. --- advent.adoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/advent.adoc b/advent.adoc index 7280b03..a53ccd3 100644 --- a/advent.adoc +++ b/advent.adoc @@ -8,8 +8,8 @@ advent - Colossal Cave Adventure *advent* [-l logfile] [-o] == DESCRIPTION == -The original Colossal Cave Adventure from 1976 was the origin of all -text adventures, dungeon-crawl (computer) games, and computer-hosted +The original Colossal Cave Adventure from 1976-77 was the origin of all +later text adventures, dungeon-crawl (computer) games, and computer-hosted roleplaying games. This is the last version released by Crowther & Woods, its original @@ -31,9 +31,14 @@ encouragement of the original authors. -o:: Old-style. Restores original interface, no prompt. +== BUGS == + +The binary save file format is fragile and unlikely to survive +through version bumps. + == REPORTING BUGS == Report bugs to Eric S. Raymond . The project page is -at http://catb.org/~esr/advent +at http://catb.org/~esr/open-adventure == SEE ALSO == wumpus(6), adventure(6), zork(6), rogue(6), nethack(6). -- 2.31.1 From 5e85d65c7911830efa76bc85049a17fb0e8c8482 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Mon, 5 Jun 2017 14:06:14 -0700 Subject: [PATCH 03/16] git-ignore MANIFEST. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2ea48c5..4a8fcd6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ database.h database.c advent.6 *.tar.gz +MANIFEST + -- 2.31.1 From acc08b8a5cdd9a56781cfe4733f6e88c22367321 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Mon, 5 Jun 2017 14:06:30 -0700 Subject: [PATCH 04/16] Get rid of tarballs with 'make clean'. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5573463..3b8844e 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ database.c database.h: compile adventure.text clean: rm -f *.o advent *.html database.[ch] compile *.gcno *.gcda - rm -f README advent.6 MANIFEST + rm -f README advent.6 MANIFEST *.tar.gz cd tests; $(MAKE) --quiet clean check: advent -- 2.31.1 From 990be32ac6862bbc788f9efa8c4dbfcd9b0955c3 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Mon, 5 Jun 2017 19:20:39 -0700 Subject: [PATCH 05/16] Add simple tests of save and resume. --- tests/saveresume.1.chk | 27 +++++++++++++++++++++++++++ tests/saveresume.1.log | 7 +++++++ tests/saveresume.2.chk | 27 +++++++++++++++++++++++++++ tests/saveresume.2.log | 6 ++++++ 4 files changed, 67 insertions(+) create mode 100644 tests/saveresume.1.chk create mode 100644 tests/saveresume.1.log create mode 100644 tests/saveresume.2.chk create mode 100644 tests/saveresume.2.log diff --git a/tests/saveresume.1.chk b/tests/saveresume.1.chk new file mode 100644 index 0000000..ee9f693 --- /dev/null +++ b/tests/saveresume.1.chk @@ -0,0 +1,27 @@ + +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. + +> seed 1240742801 +Seed set to 1240742801 + +You're in front of building. + +> save + +I can suspend your Adventure for you so that you can resume later, but +it will cost you 5 points. + +Is this acceptable? + +> y + +OK + +File name: +To resume your Adventure, start a new game and then say "RESUME". diff --git a/tests/saveresume.1.log b/tests/saveresume.1.log new file mode 100644 index 0000000..36de492 --- /dev/null +++ b/tests/saveresume.1.log @@ -0,0 +1,7 @@ +## Save right after starting +n +seed 1240742801 +save +y +saveresume +y diff --git a/tests/saveresume.2.chk b/tests/saveresume.2.chk new file mode 100644 index 0000000..d76d314 --- /dev/null +++ b/tests/saveresume.2.chk @@ -0,0 +1,27 @@ + +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. + +> resume + +File name: +You're in front of building. + +> quit + +Do you really want to quit now? + +> yes + +OK + +You scored 27 out of a possible 430, using 2 turns. + +You are obviously a rank amateur. Better luck next time. + +To achieve the next higher rating, you need 19 more points. diff --git a/tests/saveresume.2.log b/tests/saveresume.2.log new file mode 100644 index 0000000..90d4d9a --- /dev/null +++ b/tests/saveresume.2.log @@ -0,0 +1,6 @@ +## Resume and then quit +n +resume +saveresume +quit +yes -- 2.31.1 From b2c774afeb327f66e47688e469a411e65fa45017 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Mon, 5 Jun 2017 19:21:08 -0700 Subject: [PATCH 06/16] Alphabetically sort the test file list. This ensures that appropriately-named tests run in sequence. E.g., test.1.log, test.2.log, etc. --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 16a1d54..81aa23b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -26,7 +26,7 @@ listcheck: # General regression testing of commands and output; look at the *.log and # corresponding *.chk files to see which tests this runs. -TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///') +TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///' | sort) buildregress: @for file in $(TESTLOADS); do \ echo "Remaking $${file}.chk"; \ -- 2.31.1 From 78f5cc9e6ad57ae3d36996a69000764672b85891 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Mon, 5 Jun 2017 19:33:35 -0700 Subject: [PATCH 07/16] Update the tests README. --- tests/README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/README b/tests/README index a6451dc..9708155 100644 --- a/tests/README +++ b/tests/README @@ -3,6 +3,8 @@ A .tst extension means it's a game log A .chk extension means it's expected output from a test +The test files are run in alphabetical order. This allows you to ensure certain tests are run in a particular order merely by giving them appropriate names, e.g.: test.1.log, test.2.log, test.3.log. This is useful for testing save and resume. + In general, a file named foo.chk is the expected output from theb game log foo.log. To add new tests, just drop log files in this directory. -- 2.31.1 From 7118f25d5ae82d89d33fff660adaa08bd0b67295 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 00:52:04 -0400 Subject: [PATCH 08/16] Add a small tool for making logs from checkfiles. Useful because the context in checkfiles makes them easier to edit than plain logfiles are. --- tests/decheck | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 tests/decheck diff --git a/tests/decheck b/tests/decheck new file mode 100755 index 0000000..7e1be39 --- /dev/null +++ b/tests/decheck @@ -0,0 +1,3 @@ +#!/bin/sh +# Turn a non-oldstyle checkfile on stdin into an equivalent log on stdout. +sed -n -e '/> /s///p' -- 2.31.1 From 7130265578899d9c7de36b390cd2cd8889a655b3 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 00:54:56 -0400 Subject: [PATCH 09/16] In tests, exercise the "go back" code. --- tests/illformed.chk | 18 ++++++++++++++++-- tests/illformed.log | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/illformed.chk b/tests/illformed.chk index f00ed12..2b86170 100644 --- a/tests/illformed.chk +++ b/tests/illformed.chk @@ -165,9 +165,23 @@ can now save a game and resume it at once (formerly you had to wait a while first), but it now costs you a few points each time you save the game. Saved games are now stored in much smaller files than before. +> go back + +>>Foof!<< + +You're inside building. + +There are some keys on the ground here. + +There is a lamp shining nearby. + +There is food here. + +There is a bottle of water here. + > score -You have garnered 32 out of a possible 430 points, using 31 turns. +You have garnered 32 out of a possible 430 points, using 32 turns. > quit @@ -177,7 +191,7 @@ Do you really want to quit now? OK -You scored 32 out of a possible 430, using 32 turns. +You scored 32 out of a possible 430, using 33 turns. You are obviously a rank amateur. Better luck next time. diff --git a/tests/illformed.log b/tests/illformed.log index 76b0804..9e73873 100644 --- a/tests/illformed.log +++ b/tests/illformed.log @@ -33,6 +33,7 @@ n read look news +go back score quit yes -- 2.31.1 From 98a67dd50b402078cb26d19624bf1c9d66d81b67 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 05:36:39 -0400 Subject: [PATCH 10/16] Further extend test coverage. --- tests/illformed.log | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/illformed.log b/tests/illformed.log index 9e73873..af5ced5 100644 --- a/tests/illformed.log +++ b/tests/illformed.log @@ -9,6 +9,7 @@ drink find keys in listen +keys find keys unlock keys find foo @@ -34,6 +35,9 @@ read look news go back +fuck +fly +say boo score quit yes -- 2.31.1 From 3da812fdf6691a740d7f7247872e5c49323cabf7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 05:38:24 -0400 Subject: [PATCH 11/16] Address GitLab issue #8: `make check` breaks. Include tests in the generated tarball. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3b8844e..5ac6c64 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ DOCS=COPYING NEWS README.adoc TODO advent.adoc history.adoc hints.adoc advent.6 # Can't use GNU tar's --transform, needs to build under Alpine Linux. # This is a requirement for testing dist in GitLab's CI pipeline advent-$(VERS).tar.gz: $(SOURCES) $(DOCS) - @ls $(SOURCES) $(DOCS) | sed s:^:advent-$(VERS)/: >MANIFEST + @ls $(SOURCES) $(DOCS) tests | sed s:^:advent-$(VERS)/: >MANIFEST @(ln -s . advent-$(VERS)) (tar -T MANIFEST -czvf advent-$(VERS).tar.gz) @(rm advent-$(VERS)) -- 2.31.1 From 8003c6166cc708929a2b0ffe03bcffcae60fe8a1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 05:40:20 -0400 Subject: [PATCH 12/16] Note a dropped stitch. --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 4163e26..46acfa3 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ = Open Adventure project news = +Repository head:: + Include tests directory in generated tarball. + 1.0: 2016-06-05:: Forward port of Crowther & Woods's 430-point Adventure 2.5. Added -l option for logging. -- 2.31.1 From 456aa3d7b6700f3ecbbeaec039c7ea6ecd54db38 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 05:44:35 -0400 Subject: [PATCH 13/16] Should have been committee along with last change to illformed.log. --- tests/illformed.chk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/illformed.chk b/tests/illformed.chk index 2b86170..0b7cd2e 100644 --- a/tests/illformed.chk +++ b/tests/illformed.chk @@ -179,9 +179,13 @@ There is food here. There is a bottle of water here. +> fuck + +Watch it! + > score -You have garnered 32 out of a possible 430 points, using 32 turns. +You have garnered 32 out of a possible 430 points, using 33 turns. > quit @@ -191,7 +195,7 @@ Do you really want to quit now? OK -You scored 32 out of a possible 430, using 33 turns. +You scored 32 out of a possible 430, using 34 turns. You are obviously a rank amateur. Better luck next time. -- 2.31.1 From 54eb0ac2cbaf33570eb762e16c2e6ed6429a1bc8 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 06:00:08 -0400 Subject: [PATCH 14/16] Another test coverage extension. --- tests/illformed.chk | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/illformed.chk b/tests/illformed.chk index 0b7cd2e..763ea42 100644 --- a/tests/illformed.chk +++ b/tests/illformed.chk @@ -58,6 +58,10 @@ There is a bottle of water here. The stream is gurgling placidly. +> keys + +What do you want to do with the keys? + > find keys I believe what you want is right here with you. @@ -183,9 +187,17 @@ There is a bottle of water here. Watch it! +> fly + +Though you flap your arms furiously, it is to no avail. + +> say boo + +Okay, "BOO". + > score -You have garnered 32 out of a possible 430 points, using 33 turns. +You have garnered 32 out of a possible 430 points, using 36 turns. > quit @@ -195,7 +207,7 @@ Do you really want to quit now? OK -You scored 32 out of a possible 430, using 34 turns. +You scored 32 out of a possible 430, using 37 turns. You are obviously a rank amateur. Better luck next time. -- 2.31.1 From 738504d2800331099a86c768230ac117d72ec1a7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 06:18:09 -0400 Subject: [PATCH 15/16] Properly include tests directory - must use find, not ls. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5ac6c64..f010ad9 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ DOCS=COPYING NEWS README.adoc TODO advent.adoc history.adoc hints.adoc advent.6 # Can't use GNU tar's --transform, needs to build under Alpine Linux. # This is a requirement for testing dist in GitLab's CI pipeline advent-$(VERS).tar.gz: $(SOURCES) $(DOCS) - @ls $(SOURCES) $(DOCS) tests | sed s:^:advent-$(VERS)/: >MANIFEST + @find $(SOURCES) $(DOCS) tests -print | sed s:^:advent-$(VERS)/: >MANIFEST @(ln -s . advent-$(VERS)) (tar -T MANIFEST -czvf advent-$(VERS).tar.gz) @(rm advent-$(VERS)) -- 2.31.1 From 31ecc4a8e3e8dcd5db1f2349a91ef6064421d2a0 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 6 Jun 2017 06:34:46 -0400 Subject: [PATCH 16/16] Fix for parallel make. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f010ad9..dce6fc0 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ init.o: advent.h funcs.h database.h actions1.o: advent.h funcs.h database.h -actions2.o: advent.h funcs.h +actions2.o: advent.h funcs.h database.h score.o: advent.h database.h -- 2.31.1