Compare commits

...
Sign in to create a new pull request.

1665 commits

Author SHA1 Message Date
Eric S. Raymond
7d848c89e1 Add spell-checking to the regression tests. 2025-05-25 11:06:46 -04:00
Eric S. Raymond
7bbf994fce Spellcheck the manual page a well. No errors. 2025-05-25 11:03:34 -04:00
Eric S. Raymond
3e989aec53 Spellcheck the YAML - yielded one trivial fix. 2025-05-25 10:57:34 -04:00
Eric S. Raymond
9df69fe034 Ready to ship 1.20. 2024-09-23 18:48:11 -04:00
Eric S. Raymond
a2bb39dc7e Eliminate a confusing dummy argument in a macro. 2024-09-23 14:22:25 -04:00
Eric S. Raymond
5c90880f0a Comment and macro cleanup. 2024-09-23 06:06:32 -04:00
Eric S. Raymond
92451f1fff Eliminate thew last property inequality outside a macro. 2024-09-23 05:08:11 -04:00
Eric S. Raymond
96ad6c6245 Reflow. 2024-09-23 04:38:24 -04:00
Eric S. Raymond
40742e112b Expand a macro to simplify code. 2024-09-23 04:26:59 -04:00
Eric S. Raymond
a4fd14caf7 Back away from trying for the found member until we make stashed work. 2024-09-23 04:26:59 -04:00
Eric S. Raymond
9a6e4406f5 Confine uses of PROP_STASHIFY() to advent.h
Now it shouyld be possible to manipulate a stashed flag by only
changing macros.
2024-09-23 04:26:59 -04:00
Eric S. Raymond
08f0351817 Introduce OBJECT_STASHIFY. 2024-09-23 04:26:59 -04:00
Eric S. Raymond
0157e58668 Remove an unneeded layer of macro indirection. 2024-09-23 03:35:52 -04:00
Eric S. Raymond
354e56a69b Clean up some comments. 2024-09-23 03:35:52 -04:00
Eric S. Raymond
9c3f4b0c90 Reflow. 2024-09-22 13:08:31 -04:00
Eric S. Raymond
20fd7c589f Typo fix. 2024-09-20 22:19:14 -04:00
Eric S. Raymond
8c553af53e Avoid a GNUism, POSIX strncasecmp() is declarted in strings.h. 2024-09-20 22:05:25 -04:00
Eric S. Raymond
f1cb740c41 Define TRUNCLEN and explain its issues. 2024-09-20 22:04:16 -04:00
Eric S. Raymond
cf4adf8d02 Repair truncation in oldstyle mode.
Sure would be nice to remember while this code had TOKEN + TOKEN
where one would think it should just say TOKEN.
2024-09-20 10:49:44 -04:00
Eric S. Raymond
acdfa96315 Fix a busted comment. 2024-09-20 10:40:22 -04:00
Eric S. Raymond
3d6c689ffa Make oldstyle correctly suppress line editing. 2024-09-20 10:29:37 -04:00
Eric S. Raymond
8dcc6e6641 Correct missing negative. 2024-09-20 10:03:15 -04:00
Eric S. Raymond
e17ff128da Remove obsolete comment part. 2024-06-30 17:20:46 -04:00
Eric S. Raymond
cb293f4aa4 Rename some macos for clarity. 2024-06-30 14:48:44 -04:00
Eric S. Raymond
124e7768b4 Cease relying on C storage starting zeroed. 2024-06-27 19:50:56 -04:00
Eric S. Raymond
63e8579f74 Ready to shp 1.19. 2024-06-27 13:39:27 -04:00
Eric S. Raymond
1080b45d39 Comment typo fix. 2024-06-27 13:29:28 -04:00
Eric S. Raymond
86fe4bd121 Verify that tesrts still match advent430 where expected. 2024-06-27 13:04:33 -04:00
Eric S. Raymond
bd499dc532 Fix GitLab issue #69: repeated knive caveat message 2024-06-25 16:42:14 -04:00
Eric S. Raymond
ae6eced72d Incorporate Ryan Sarson's test for correct knife message. 2024-06-25 13:08:50 -04:00
Eric S. Raymond
7903ac1bb8 More validation, with -Wall and -Wextra. 2024-06-03 21:12:41 -04:00
Eric S. Raymond
b51612131d Typo fix. 2024-04-29 11:43:41 -04:00
Eric S. Raymond
62cd0c78da Reissue 1.18 - same code, corrected metadata. 2024-02-15 12:56:01 -05:00
Eric S. Raymond
bad34acf1e Improve the project summary. 2024-02-05 08:07:31 -05:00
Eric S. Raymond
0fafbe379f Ubuntu-discuss doesn't want to see release notifications. 2024-02-05 07:51:00 -05:00
Eric S. Raymond
fcf6935689 Ready to ship 1.18. 2024-02-05 07:49:07 -05:00
Eric S. Raymond
b610a62685 Documentation polishing. 2024-02-05 07:43:23 -05:00
Eric S. Raymond
6174129116 Add a detail to the installation instructiions. 2024-02-04 16:56:20 -05:00
Eric S. Raymond
a2fa136988 Remove unused production. 2024-02-04 16:16:05 -05:00
Eric S. Raymond
43a08621e4 asciidoc -> asciidoctor. 2024-02-04 15:52:03 -05:00
Eric S. Raymond
f24fcd2971 Perform full code validation on every make check. 2024-02-04 12:48:33 -05:00
Eric S. Raymond
580f409ee6 At this revision, make cppcheck runs clean. 2024-02-04 11:44:04 -05:00
Eric S. Raymond
5b917084b0 Minor repair of savefile validation code. 2024-02-04 11:43:36 -05:00
Eric S. Raymond
1ef39055f3 Make reflow run black. 2024-02-04 10:07:58 -05:00
Eric S. Raymond
0175344caa 1TBS reflow, the bracening. 2024-01-29 12:14:56 -05:00
Eric S. Raymond
be429016af 1TBS reflow with clang-format. 2024-01-28 08:09:39 -05:00
Eric S. Raymond
c11938aed5 Place1TBS mandatory braces. 2024-01-28 07:14:46 -05:00
Eric S. Raymond
258b7703f2 Simplify SPDX copyright lines to the shortest canonical form...
...because if we leave them longer than 80 chars, reflow is going to
mess them up.
2024-01-28 07:14:46 -05:00
Eric S. Raymond
83c6a66887 Typo fix. 2024-01-15 05:10:46 -05:00
Eric S. Raymond
3c09c25cc3 Update tapview and tapdiffer. 2024-01-15 05:03:53 -05:00
Eric S. Raymond
f26514b5dd Fix SPDX headers. 2024-01-15 04:58:21 -05:00
Eric S. Raymond
cf7ea0cd89 Remove debugging debris. 2024-01-15 04:57:47 -05:00
Eric S. Raymond
2db3bed3f1 Fix up copyright notices. SPDX wants only one per file. 2024-01-03 06:30:40 -05:00
Eric S. Raymond
a6ec8a9595 Simplify some dependencies. 2024-01-03 06:15:04 -05:00
Eric S. Raymond
75bc031b46 Reduce include complexity. 2024-01-03 05:55:57 -05:00
Eric S. Raymond
dd65960ec5 Ready to ship 1.17. 2024-01-02 21:58:14 -05:00
Eric S. Raymond
90f96a25da pylint cleanup. 2024-01-02 21:53:23 -05:00
Eric S. Raymond
c10e9694e3 Corrected fix, and test, for #67. 2024-01-02 17:19:42 -05:00
Eric S. Raymond
11d966f349 Add -a option to synopsis. 2024-01-02 16:57:15 -05:00
Eric S. Raymond
e1a17fd442 NEWS update. 2024-01-02 16:38:59 -05:00
Eric S. Raymond
eb63994931 Better explanation of backwards compatibility with 4.30. 2024-01-02 16:34:54 -05:00
Eric S. Raymond
0b82afa5c1 Commit a test script. 2024-01-02 16:03:30 -05:00
Eric S. Raymond
b247359d7f Initialize dwarf locations in YAML, not C.
Minimizes magic numbers.
2024-01-02 12:12:32 -05:00
Eric S. Raymond
1f9f39d789 Address GitLab issue #67: saying Z'ZZZ at the reservoir causes the water to part/crash together 2024-01-02 10:42:11 -05:00
Eric S. Raymond
2582e240bd Fix defective copyright notices. 2024-01-02 09:46:09 -05:00
Eric S. Raymond
9fbd603f8d Typo fix. 2024-01-02 09:28:39 -05:00
Nicola Smaniotto
5016978156
saveresume.c: add missing semicolon
Fixes compilation when ADVENT_NOSAVE is set
2023-11-27 17:41:26 +01:00
Eric S. Raymond
7d4dd78679 Apply black to move Python style to standard form. 2023-09-17 16:17:30 -04:00
Eric S. Raymond
ab4653b89c Comment polishing. 2023-05-10 20:08:10 -04:00
Torbjörn Andersson
b28eb66868 Spelling fixes. 2023-04-18 18:44:08 +02:00
Eric S. Raymond
f0119f8431 Comment rtpo fix. 2023-04-18 08:02:14 -04:00
Eric S. Raymond
5075c63cf4 Add some map tags. 2023-04-18 07:51:55 -04:00
Eric S. Raymond
ebf3e389c0 Add exolanatory comment. 2023-04-17 09:19:26 -04:00
Eric S. Raymond
6cef68cda5 Use fixed-lwength types to make the save format more portable 2023-04-17 07:24:51 -04:00
Eric S. Raymond
234da6b468 Remove unnecessary code duplication. 2023-04-17 07:06:56 -04:00
Eric S. Raymond
adbb5c1204 Ready to ship 1.16. 2023-04-15 14:44:20 -04:00
Eric S. Raymond
869c53d1b1 Comment polishing. 2023-04-15 10:00:23 -04:00
Eric S. Raymond
ef78c36ddb Improve state-macro encapsulation. 2023-04-15 09:29:28 -04:00
Eric S. Raymond
5d3205e1e9 Add explanatory comments. 2023-04-15 06:29:59 -04:00
Eric S. Raymond
a6b41fdb8f Simplify initialization code. All tests pass, 100% coverage. 2023-04-14 08:24:51 -04:00
Eric S. Raymond
9ff036d789 Make build with conditional compilation easier. 2023-04-14 06:16:29 -04:00
Eric S. Raymond
88feaab0c0 Remove a remnant line number. 2023-04-10 19:29:11 -04:00
Eric S. Raymond
4d4e8dce96 Magic-number elimination. 2023-04-10 19:27:07 -04:00
Eric S. Raymond
82c3ae5e65 Condition in alternative state-management macros.
These do not entirely work yet. #define FOUNDBOOL to enable them.

All tests pass, 100% coverage.
2023-04-10 19:26:18 -04:00
Eric S. Raymond
1af01ff91f Confine use of STATE_NOTFOUND to macros. 2023-04-08 23:04:34 -04:00
Eric S. Raymond
9e9731d59b Turn an odd test into a macro disjunction.
Was game.objects[i].prop > STATE_NOTFOUND.

This finishes off all the statec comparisons we want to macroize.
2023-04-08 21:17:55 -04:00
Eric S. Raymond
191d3cb043 More nontrivial macro abstraction of state checks.
game.prop < 0 becomes an alternation of macros.
2023-04-08 20:32:04 -04:00
Eric S. Raymond
c82d1214fa First nontrivial replacement of object state test by macro.
Test was game.objects[i].prop >= 0, but we know that state -1
(STATE_NOTFOUND) can't occiur here because the object is in
a lit room.
2023-04-08 20:02:27 -04:00
Eric S. Raymond
02987d0330 Encapsulate object-state state tests and setttings in macros.
This isn't a complete refwctoring, just the part than can be done with
transparetly correct capture of inlinre logic into macros.

No logic changes. Tests pass, 100% coverage.
2023-04-08 19:35:41 -04:00
Eric S. Raymond
9cd7c53d78 Refactor put() function and calls. 2023-04-07 13:19:51 -04:00
Eric S. Raymond
ab2779cd93 Remove unneeded use of put(). 2023-04-07 13:09:57 -04:00
Eric S. Raymond
819aed5c4e Add test for behavior of stashed objects in endgame. 2023-04-07 12:33:52 -04:00
Eric S. Raymond
8d4d64fafb Structurization of hints. 2023-04-07 10:52:16 -04:00
Eric S. Raymond
eebc87f889 Structurize object info. 2023-04-07 10:35:13 -04:00
Eric S. Raymond
8fe07c8bf3 Structurize locatiuon info. 2023-04-07 09:30:33 -04:00
Eric S. Raymond
ff9c73a37d Structurize the informaruin about dwarves. 2023-04-07 09:15:20 -04:00
Eric S. Raymond
195e6e149b Apply loc_t type. 2023-04-07 08:18:50 -04:00
Eric S. Raymond
4369284c75 Boolification. 2023-04-07 07:35:28 -04:00
Torbjörn Andersson
7e21108e95 Spelling fixes. 2023-04-07 10:50:01 +02:00
Eric S. Raymond
829c13d1d5 Fix some screwy formatting of conditionals...
...probably by the original FOTRAN-to-C translator.
2023-04-06 21:29:39 -04:00
Eric S. Raymond
2f60504e07 Comment typo fixes. 2023-04-06 21:01:48 -04:00
Eric S. Raymond
5de3b8ff70 In notes.adoc, update the new-features list and credits. 2023-04-06 20:07:25 -04:00
Eric S. Raymond
520d365f74 Resume now detects if a save has incompatible endianness. 2023-04-06 19:41:22 -04:00
Eric S. Raymond
4b08b726f9 Simplify the signature of savefile(). 2023-04-06 19:26:04 -04:00
Eric S. Raymond
58cf204eba Implement the magic-cookie check and its test. 2023-04-06 19:03:02 -04:00
Eric S. Raymond
d16822a583 Give savefiles an identifting header. SAve format version gets bumped. 2023-04-06 17:54:02 -04:00
Eric S. Raymond
3640e5cb96 Refactoring step - change some visibilities. 2023-04-06 17:44:11 -04:00
Eric S. Raymond
e99cc69de0 Quiet make test down. 2023-04-06 17:28:43 -04:00
Eric S. Raymond
e8991f69e9 Simplify and speed up testing. 2023-04-06 16:38:21 -04:00
Eric S. Raymond
3e72486724 Comment typo fix 2023-04-06 12:13:38 -04:00
Eric S. Raymond
f5ff25f52a Magic-number elimination. 2023-04-06 10:03:24 -04:00
Eric S. Raymond
e1a528a4c5 Move NEWS file to asciidoc. 2023-04-05 21:48:02 -04:00
Eric S. Raymond
9726d8207c Add some SPDX headers. 2023-04-05 21:36:52 -04:00
Eric S. Raymond
fe378b9e13 Improved behavior when magic words are said before they're seen.
Note: there is a tiny risk that this could break savefile
compatibility, as I swiped an unused int member in the game structure
and turned it into a bool. int and bool *should* be the same sixe...
2023-04-05 19:49:38 -04:00
Eric S. Raymond
4ce4de190e Magic number removal. 2023-04-05 18:02:47 -04:00
Eric S. Raymond
9b53140f1c GO_* enums no longer have an order constraint. 2023-04-05 17:48:26 -04:00
Eric S. Raymond
3c6648882d How to set up prerequisites for oldcompare 2023-04-04 19:14:45 -04:00
Eric S. Raymond
00bdc2133a Improve TAP messages slightly. 2023-04-04 09:53:10 -04:00
Eric S. Raymond
20e1b9d930 Update tapdiffer version. 2023-04-04 09:32:18 -04:00
Eric S. Raymond
1ce4fc2ac3 Improve copyright lines. 2023-04-03 17:05:01 -04:00
Eric S. Raymond
642b7e4890 Ready to ship 1.15. 2023-04-03 11:36:39 -04:00
Eric S. Raymond
ec1d99f354 Commenting fix. 2023-04-03 11:36:39 -04:00
Eric S. Raymond
6ebc2bf0e3 Documentation fix. 2023-04-03 11:25:11 -04:00
Eric S. Raymond
25230068fe Partial REUSE cmpliance. 2023-04-03 11:25:11 -04:00
Eric S. Raymond
71abcb4e65 Add explanatory comment. 2023-04-03 09:42:55 -04:00
Eric S. Raymond
2dd1ccc535 Fix for Gitlab issue #65: revisiting "fee fie foe foo" and "fum".
100% coverage, "make oldcompare" passes.
2023-04-03 09:24:21 -04:00
Eric S. Raymond
0a1f5dbb43 Nothing but FOO can start a magic-word sequence,
100% coverage ans oldcompare passes.
2023-04-03 07:14:11 -04:00
Eric S. Raymond
20cb8b9ffb Back out test lines that break compatibility with advent430.
Coverage is still 100% even withthese lines commebted out.
2023-04-02 18:28:45 -04:00
Eric S. Raymond
b86d4afd20 Back out the behavior change to magic words outside the Giant's Room.
There are twi reasons for this. One is to decompolicate verifying
the fix for issue $85: revisiting "fee fie foe foo" and "fum". The
other is because I'm now convinced that the test should notr be
"Are you in the Giant's Room" but :Have you read the grafitti there?
2023-04-02 17:53:09 -04:00
Eric S. Raymond
d9ddf4d805 Consolidate all magicwords tests into one file. 100% coverage. 2023-04-02 17:45:04 -04:00
Eric S. Raymond
9c6219a27d The oldcompare production no longer requires savefiles. 2023-04-02 11:54:37 -04:00
Eric S. Raymond
34516ecf39 Test name change, 2023-04-02 10:42:10 -04:00
Eric S. Raymond
7dc3482c5b Start building a better test load for micwords. 2023-04-02 10:23:07 -04:00
Eric S. Raymond
40a4acb868 Comment typo fixes. 2023-04-02 07:41:49 -04:00
Torbjörn Andersson
54927c33e5 Spelling fixes 2023-04-02 07:32:24 +02:00
Eric S. Raymond
e49fb5f367 Close out oldcompare.
At this revision all test logs either pass checkfile comparison
against advent439 or have a NOCOMPARE comment explaining why they don't
pass, turning into a TAP skip. 100% coverage.
2023-04-01 18:37:08 -04:00
Eric S. Raymond
59a5afb72e Improve advent430 comparisons. 2023-04-01 16:58:52 -04:00
Eric S. Raymond
f95442b310 Test comment typo fixes. 2023-04-01 11:34:46 -04:00
Eric S. Raymond
97a69d8cbd Merge two NOCOMPARE tests. 2023-04-01 11:01:28 -04:00
Eric S. Raymond
0d2332573b Tweak a fuzzed test fotr advent430 compability. 100% coverage. 2023-04-01 10:47:49 -04:00
Eric S. Raymond
7af8492169 Add a warning comment. 2023-04-01 08:46:44 -04:00
Eric S. Raymond
3af590e972 Trim the illformed test. Still 100% coverage. 2023-03-30 20:09:10 -04:00
Eric S. Raymond
2c8aa9668c Add explanatory comments to two tests. 2023-03-30 08:46:35 -04:00
Eric S. Raymond
30a98cc916 Factor out the test of the bare word "seed". 2023-03-30 01:05:32 -04:00
Eric S. Raymond
872b94f927 Factor out most of illformed that doesn't cause advent430 problems. 2023-03-30 00:05:13 -04:00
Eric S. Raymond
74c3158f42 Add more NOCOMPARE exclusions due to version skew. 2023-03-29 22:05:27 -04:00
Eric S. Raymond
ef180a0731 Truncatte bigfail test because the RNG gets confused by resurrection. 2023-03-29 18:25:35 -04:00
Eric S. Raymond
77ac2f1570 Coverage exclusions for -d. 2023-03-29 18:16:43 -04:00
Eric S. Raymond
ff46cf7fac Add -d option 2023-03-29 16:04:36 -04:00
Eric S. Raymond
c80162b467 More test cleanup to converge with advent430 branch. 2023-03-29 14:40:38 -04:00
Eric S. Raymond
65f221e03f Add a more carefully factored test...
...so we can exclude the part advent430 won't pass.
2023-03-29 10:59:42 -04:00
Eric S. Raymond
cbb5572b21 Clean up some tests, adding newlines at EOF where they're missing.
The advent430 command interpreter accidentally accepted input lines with no
trailing newline. Thus, these files produced spurious mismatches.
2023-03-29 10:55:56 -04:00
Eric S. Raymond
a5eeb0b2bc Add a useful warning to the tests makefile 2023-03-29 09:36:58 -04:00
Eric S. Raymond
4eccfa127c Document a bugfix and isolate it in a test. 2023-03-29 09:24:12 -04:00
Eric S. Raymond
dc8b19bcdc Implement NOCOMPARE magic. 2023-03-23 14:58:06 -04:00
Eric S. Raymond
2070db3a2a Test simplification - we don't care about the difference in processing blank lines. 2023-03-22 21:20:24 -04:00
Eric S. Raymond
e3fbac804b Reconciliation with advent430. 2023-03-22 20:39:36 -04:00
Eric S. Raymond
5f7ce87040 Change prompt generation to be more compatible with the advent430 branch. 2023-03-22 17:09:14 -04:00
Eric S. Raymond
1e05134b47 Minor fix to prompt generation. 2023-03-22 17:03:50 -04:00
Eric S. Raymond
1ffb81b70b YAML markup fix. 2023-03-22 14:48:49 -04:00
Eric S. Raymond
fefd2a19fb Remove redundant test. 2023-03-22 14:48:49 -04:00
Eric S. Raymond
4fa3d4d758 Test cleanup and reconvilation with advent430. 2023-03-22 14:48:49 -04:00
Eric S. Raymond
07a0f066ba Quoting fixes in the YAML. 2023-03-22 00:05:58 -04:00
Eric S. Raymond
a006bdd272 TAPify the ancient-diffs report. 2023-03-22 00:05:58 -04:00
Eric S. Raymond
327efd3678 Test cleanup. 2023-03-22 00:05:58 -04:00
Eric S. Raymond
b044e9ab42 Move in the direction of being able to do ancient regression tests. 2023-03-21 17:27:30 -04:00
Eric S. Raymond
8fd3eb8b92 Testing simplification. 2023-03-16 10:18:56 -04:00
Eric S. Raymond
9fdbe73315 Revert "Tapify output of cheat."
There was a better way.
2023-03-16 10:15:47 -04:00
Eric S. Raymond
9758883ea2 More TAPification. 2023-03-16 09:48:16 -04:00
Eric S. Raymond
f5d15ab1f2 Tapify output of cheat. 2023-03-16 08:32:59 -04:00
Eric S. Raymond
f07b3ba2d4 Address GitLab issue #66: Missing couple of ; in saveresume.c 2023-03-16 07:43:17 -04:00
Eric S. Raymond
87855f8124 Avoid a compiler warning. 2023-03-14 14:58:26 -04:00
Eric S. Raymond
786832210e Magic-number elimination. 2023-03-14 14:58:26 -04:00
Eric S. Raymond
9b89dd2829 Experimental test production. 2023-03-14 14:58:26 -04:00
Eric S. Raymond
17840d0e15 Comment polishing. 2023-03-12 17:59:10 -04:00
Eric S. Raymond
5929a68b88 Real test coverage dor SAVE_TAMPERING. 2023-03-12 17:37:58 -04:00
Eric S. Raymond
43af075fa9 Cleann up scratchfile after tesrs. 2023-03-12 17:21:15 -04:00
Eric S. Raymond
47c3d14a11 Comment polishing. 2023-03-12 17:14:18 -04:00
Eric S. Raymond
db8ca5eb26 Documentation polishing. 2023-03-12 12:58:11 -04:00
Eric S. Raymond
ca5b6975dc NEWS update. 2023-03-12 12:41:13 -04:00
Eric S. Raymond
282842c4a9 Whitespace trimming of save and resume names. 2023-03-12 12:10:30 -04:00
Eric S. Raymond
7723f3fc1a Add coverage exception now that SAVE_TAMPERING is back. 2023-03-12 10:11:52 -04:00
Eric S. Raymond
0ffb297801 Relax the savefile validity check a little.
There was a very old bug, probably predating the OpenAdventure port,
that would poke a stashed value of -1 into the snake object if you did
a save in endgame, and then fail the savefile validation on resume.
This was masked for a long time by a bug in put() just fixed a couple
of revisions ago.
2023-03-12 10:03:43 -04:00
Eric S. Raymond
04df0ce64c Add message and bailout on invalid save.
Note: save/resume still fails at saveresume.4
at this revision.
2023-03-12 06:39:57 -04:00
Eric S. Raymond
569a39aa7c Drop an attempt to pacify cppcheck that's no longer needed. 2023-03-11 10:58:38 -05:00
Eric S. Raymond
1652df4540 Add ANSI prototype, 2023-03-11 10:40:01 -05:00
Eric S. Raymond
ba3248224e Add C coverage exclsion required by unbreaking the property setter. 2023-03-11 10:29:38 -05:00
Eric S. Raymond
b7bf85904d Fix a formal-type glitch. 2023-03-11 09:44:51 -05:00
Eric S. Raymond
71f05c4567 Bugfix: bird starts caged in endgame.
Turns out the code of put() had been modified ibcorrectly, but
the bug was masked in all but a few cases, noe of which would be
encountered in normal gameplay.

A test to ensure this bug does noit recur has been added.
2023-03-11 09:35:26 -05:00
Eric S. Raymond
fe8a82927c Document a bugfix. 2023-03-10 17:17:38 -05:00
Eric S. Raymond
b125fe7b2a Fix interrupted-magic-words cosmetic bug.
C patch by Torbjörn Andersson.
2023-03-10 16:43:27 -05:00
Eric S. Raymond
3971a61ab0 Ready to ship 1.14. 2023-03-09 10:19:53 -05:00
Eric S. Raymond
8f527fb433 Fix whitespace glitch. 2023-03-09 10:19:53 -05:00
Eric S. Raymond
643eab4e9c Use $(advent) rather than advent where needed. 2023-03-09 08:54:20 -05:00
Eric S. Raymond
f53476f826 Complete fix of GitLab issue #64: Coverage summary looks wrong 2023-03-08 22:55:12 -05:00
Eric S. Raymond
83c32598be Partially address Gitlsb issue #64: Coverage summary looks wrong 2023-03-08 21:54:45 -05:00
Torbjörn Andersson
98b95e92ee Another typo fix. 2023-03-08 18:15:51 +01:00
Eric S. Raymond
8d409c6b3b Add a comment to the code that fixes the inventory-count bug. 2023-03-07 08:12:36 -05:00
Eric S. Raymond
e1ce7d6b6a Documentation polishing. 2023-03-07 06:27:08 -05:00
Eric S. Raymond
f911e42453 Eliminate some forwards. 2023-03-06 23:41:07 -05:00
Eric S. Raymond
12d39ef72b Improve Makefile recipe for coverage testing. 2023-03-06 12:55:17 -05:00
Eric S. Raymond
1efd1027f7 Add test for interspersed non-motion command amidst magic words. 2023-03-04 20:26:13 -05:00
Eric S. Raymond
1121bb8aa5 NEWS and notes.adoc update. 2023-03-04 20:16:07 -05:00
Eric S. Raymond
a01c08385c Prevent a spurious coverage error. 2023-03-04 19:58:57 -05:00
Eric S. Raymond
643656fcc3 Complain to user on save/resume.restore when it's disabled. 2023-03-04 19:48:17 -05:00
Eric S. Raymond
ac0c5fc024 Document -a option. 2023-03-03 17:18:00 -05:00
Rob Swindell (on Debian Linux)
dfff80faa8 Add optional auto-save/restore feature using -a <filename> option
To enable use with online Bulletin Board Systems (BBSes) where users
may be disconnected unexpectedly, but would naturally want to resume
playing their same game, added support for an optional save game
path/filename to be specified on the command-line (very similar to
"-r <filename>"), except this save/restore file is:
1. automatically loaded/restored if it exists
2. automatically created when starting a new game
3. automatically updated when exiting a game for any reason
4. cannot be changed to a different path/filename by the user

Since a BBS server program can be expected to send a SIGHUP or SIGTERM
to the game process upon user disconnection (or timeout), those
signals are caught and a graceful termination will occur which saves
the current game state.

Build with ADVENT_AUTOSAVE defined to enable this option.

BUG:
The 'info' command still reports the save/suspend/pause commands as
valid, though they are not when this build option is used (same is
true of ADVENT_NOSAVE, and that doesn't apparently bother anyone).
2023-03-02 19:44:47 -08:00
Eric S. Raymond
426684fec2 Increase retrigressiveness of oldstyle a bit. 2023-03-01 17:46:13 -05:00
Eric S. Raymond
162c5abc8a Comment typo fix. 2023-03-01 16:03:13 -05:00
Eric S. Raymond
1f644a1d7d Don't crap out on failed diff. 2023-03-01 14:01:44 -05:00
Eric S. Raymond
17782cab67 Another comment typo fix. 2023-03-01 13:52:54 -05:00
Eric S. Raymond
94e7cc6505 Address Gitlab isse #62: Comment typos. 2023-03-01 13:04:53 -05:00
Eric S. Raymond
3f34adad3b Move pylint suppressions inline. 2023-02-28 19:46:50 -05:00
Eric S. Raymond
17c74326c1 Ready to ship 1.13. 2023-02-28 19:02:10 -05:00
Eric S. Raymond
b8c7a6d5ea cppcheck cleanup. 2023-02-28 18:55:12 -05:00
Eric S. Raymond
e5e6dbd741 NEWS update. 2023-02-28 18:40:40 -05:00
Eric S. Raymond
89266b7c1a Documerntation and comment polishing. 2023-02-28 17:05:37 -05:00
Eric S. Raymond
9a1b4d021e Improve message emission when player wins. 2023-02-28 15:10:54 -05:00
Eric S. Raymond
ff2dd31209 Update our tapview copy. 2023-02-28 15:04:42 -05:00
Eric S. Raymond
66b8192ae8 SPDXify generated code. 2023-02-28 14:55:40 -05:00
Eric S. Raymond
23e9931645 Prevent spurious error return. 2023-02-28 14:48:33 -05:00
Eric S. Raymond
20859304c0 Eliminate a bad code smell. 2023-02-28 06:45:24 -05:00
Eric S. Raymond
aa32e8f4d6 Add Ryan Sarson's 430-point win to the test suite. 2023-02-27 23:03:38 -05:00
Eric S. Raymond
60d7070506 Cleanup for current pylint. 2023-02-17 13:45:50 -05:00
Eric S. Raymond
a44ec19753 Documentation polishing. 2023-02-07 05:27:24 -05:00
Eric S. Raymond
9812b7a357 Comment improvements. 2023-02-07 04:55:59 -05:00
Eric S. Raymond
d9111efc68 Ready to ship 1.12 2023-02-06 17:03:34 -05:00
Eric S. Raymond
5e2614678b NEWS update. 2023-02-06 16:52:16 -05:00
Eric S. Raymond
0aead5634e Another typo fix. 2023-02-06 16:46:03 -05:00
Eric S. Raymond
7810888164 Experimental tweak of Docker image to try to fix manpage build. 2023-02-06 16:36:59 -05:00
Eric S. Raymond
aaaf0ac7d2 Typo fixes. 2023-02-06 16:03:38 -05:00
Eric S. Raymond
750cfe36d8 Fix for GitLab issue #59. 2022-10-21 11:21:58 -04:00
Eric S. Raymond
b6c0f5bff0 Add Patreon link. 2022-04-20 11:59:26 -04:00
Eric S. Raymond
e5d01c83f0 Remove ibsoletre constraint comment.
I think it became obsolete when we factored out state-change messages.
2022-04-20 11:32:02 -04:00
Eric S. Raymond
3dcf8449e5 In the grapher,add some room condition bits to clean up code. 2022-04-20 11:09:08 -04:00
Eric S. Raymond
3f3e114536 In the grapher, split forset from surface mode. 2022-04-20 07:15:18 -04:00
Eric S. Raymond
baab09e3ab py;imt cleanup. 2022-04-19 22:41:14 -04:00
Eric S. Raymond
81c7bb6d5b More grapher improvement. 2022-04-19 22:36:28 -04:00
Eric S. Raymond
c547f4498b Add verbose optionm to grapher. 2022-04-19 20:39:54 -04:00
Eric S. Raymond
74b1589b57 Various grapher improvements. 2022-04-19 19:48:35 -04:00
Eric S. Raymond
67a887f432 Magic-number elimination. 2022-04-19 17:07:46 -04:00
Eric S. Raymond
00c2182d9b Code cleanup. 2022-04-19 16:36:20 -04:00
Eric S. Raymond
9af3ab4ecd Improve comments. 2022-04-19 16:36:20 -04:00
Eric S. Raymond
017162da6e Declare the poject finished in the designer's notes. 2022-04-18 16:41:13 -04:00
Eric S. Raymond
648deb4770 Remove the TODo, last iten about lamp image is obsolerte
* We are aware that the lamp currently used as the project logo is a
hurricane lamp, not a proper miner's lamp. Submissions of potential
replacement images would be welcome.
The deleted TODO said:

* We are aware that the lamp currently used as the project logo is a
  hurricane lamp, not a proper miner's lamp. Submissions of potential
  replacement images would be welcome.

Further research using an image search on the web reveals that there
have been miners' lamps thart visually resemble outr hurricane-lamp
images pretty closely,  so we can keep using it.
2022-04-18 16:18:43 -04:00
Eric S. Raymond
156b39c34a Do full code validation before each release. 2022-04-18 14:47:01 -04:00
Eric S. Raymond
c71a4dc441 NEWS update, 2022-04-18 14:43:55 -04:00
Eric S. Raymond
732b581031 Remove an issue about dropping the vase, the drop code doesn't change state. 2022-04-18 13:57:29 -04:00
Eric S. Raymond
86e2e21ef8 Drop vase on pillow in well house and confirm that you get points for it. 2022-04-18 12:40:09 -04:00
Eric S. Raymond
3afaabead3 NEWS update.
After re-reading the code, I have concluded that the objective of making it
more typeful can be abandoned. The tyings typefulness could give us are
largely achieved.
2022-04-18 12:01:35 -04:00
Eric S. Raymond
d320212622 Indent cleanup. 2022-04-18 10:31:13 -04:00
Eric S. Raymond
f7d6884ded cppcheck cleanup. 2022-04-18 10:24:11 -04:00
Eric S. Raymond
d9d58ea168 Base UNDEEP on the previiously unreferenced DEEP condition bit.
Removes the only dependency on the order of locations left in the macros.
2022-04-18 10:01:14 -04:00
Eric S. Raymond
846f293e06 Typo fix. 2022-04-14 15:49:56 -04:00
Eric S. Raymond
70a9edd497 Ready to ship 1.11 2022-04-14 14:38:50 -04:00
Eric S. Raymond
dee8809e30 pylint cleanup. 2022-04-14 13:54:45 -04:00
Eric S. Raymond
44017d64bb Reorganize and clean up test machinery. 2022-04-14 12:27:15 -04:00
Eric S. Raymond
dd7b664e32 Revert Makefile changes that broke coverage testing for cheat.c 2022-04-14 12:05:03 -04:00
Eric S. Raymond
1c2346392e Grapher simplification. 2022-04-14 11:34:43 -04:00
Eric S. Raymond
f6fc7f244d Graph mode for maze all different. 2022-04-14 07:47:47 -04:00
Eric S. Raymond
18566a349a Add logic for chasing forwarding limks to the graph maker. 2022-04-13 22:31:46 -04:00
Eric S. Raymond
4069bf210b cppcheck cleanup. 2022-04-13 20:55:57 -04:00
Eric S. Raymond
ceba6482a1 Introduce and use matags in the YAML. 2022-04-13 20:31:07 -04:00
Eric S. Raymond
9e6095afa0 Inprove -m mapping. 2022-04-13 15:20:26 -04:00
Eric S. Raymond
ad75cc1eb7 Mapping improvements. 2022-04-13 13:41:57 -04:00
Eric S. Raymond
0f5fd82b77 Add a test of resurrection logic. 2022-04-13 04:38:41 -04:00
Eric S. Raymond
834f6e753c Add test that dropping vase in tghe soft room does not break it. 2022-04-13 04:23:28 -04:00
Eric S. Raymond
b30059bb72 NEWS update. 2022-04-13 04:01:41 -04:00
Eric S. Raymond
af7ce31dd9 Simplify the test machinery. 2022-04-13 03:59:57 -04:00
Eric S. Raymond
337377ab57 savecheck only needs to be run for makiung coverage reports. 2022-04-13 03:45:59 -04:00
Eric S. Raymond
d235313e97 Switch normal regression testing to TAP output. 2022-04-13 03:13:53 -04:00
Eric S. Raymond
129136b51e Integrate multifile test into TAP sequence. 2022-04-13 02:58:02 -04:00
Eric S. Raymond
7b3b5d32c0 More steps towards TAP. 2022-04-13 02:42:25 -04:00
Eric S. Raymond
c78845e05a Update maxhinert for tap from reposurgeon...
...but it doesn't work yet.
2022-04-12 23:23:48 -04:00
Eric S. Raymond
74dc0d168a Take test coverage back to 100% 2022-04-12 22:47:41 -04:00
Eric S. Raymond
829e55f99d Another test coverage improvement. 2022-04-12 21:51:37 -04:00
Eric S. Raymond
10b888f449 Another coverage improvement 2022-04-12 21:24:42 -04:00
Eric S. Raymond
f9237d6970 Improve YAML symbol coverage. 2022-04-12 20:08:45 -04:00
Eric S. Raymond
8c80aa183b Scratch a to-do item. 2022-04-12 19:53:13 -04:00
Eric S. Raymond
8b8a3a73c4 Fix bugs in coverage testing. 2022-04-12 19:45:43 -04:00
Eric S. Raymond
865e10e6d0 Coverage fixups. 2022-04-12 11:27:07 -04:00
Eric S. Raymond
c5250b5f3f Clean up warning and deprecation issues. 2022-04-12 10:53:37 -04:00
Eric S. Raymond
49e2479efa Improve test coverage. 2022-04-07 06:42:20 -04:00
Eric S. Raymond
6f7c5743c6 Add a coverage exclusion. 2022-04-06 22:27:14 -04:00
Eric S. Raymond
00cbf464b5 Ready to ship 1.10. 2022-04-06 20:02:07 -04:00
Eric S. Raymond
2df951ba60 Improve the maze graph. 2022-04-06 19:11:09 -04:00
Eric S. Raymond
6dd37a6ec3 Namespace splittiing to prune the maze graph. No eeffect on gameplay. 2022-04-06 18:59:14 -04:00
Eric S. Raymond
07f77a8ffd Proof of concept for dungeon graph maker. 2022-04-06 17:47:57 -04:00
Eric S. Raymond
7d2cfa5166 Typo fix. 2022-04-06 15:48:06 -04:00
Eric S. Raymond
beae508e1d Add a test for the isolated-foo case 2022-04-06 14:54:43 -04:00
Eric S. Raymond
dd5ca23302 Second part of fix for "fee fie foe foo" and "fum", with test. 2022-04-06 14:41:30 -04:00
Eric S. Raymond
db384731a7 Address GitLab issue #56: handling of "fee fie foe foo" and "fum"
Also add a regression test for this.
2022-04-06 13:43:08 -04:00
Eric S. Raymond
a2116b3d79 Add test for correct listen behavior. 2022-04-06 07:54:20 -04:00
Eric S. Raymond
46e1595cb0 Address Gitlanb issue #54: listen command not showing all sounds 2022-04-06 07:49:42 -04:00
Eric S. Raymond
e0b9aeda6e Resolve Gitlab issue #55: in endgame, some object starting states are incorrect
The uncaged status of the bird in the endagame doesn't seem worth the effort to fix it.
2022-04-05 19:20:21 -04:00
Eric S. Raymond
73b49d27f4 Fix issue #51: rug flying is broken
And add a test for the fix.
2022-04-05 15:18:17 -04:00
Eric S. Raymond
bb2b8e0fca Support execution of command script arguments. 2022-04-05 14:33:29 -04:00
Eric S. Raymond
8378063198 Address GitLab issue #53: inventory limit glitch in original game is not reproduced
It was actually a bit of a philosophical question whether I should try to make
this fix revertible with -o. I decided not to, as it's just something the user
may stumble over rather than being an edifying feature of the origiunal interface.
2022-04-04 18:08:50 -04:00
Eric S. Raymond
0799bc2f79 Address Gitlib issu #57: Resume can't open save file...
...when auto-completed filename is followed by a space character.
2022-04-04 17:51:06 -04:00
Eric S. Raymond
5ab94ce8de Fix bad copypasta. 2021-03-14 20:45:34 -04:00
Eric S. Raymond
5aaa22860a Experimental steps towards TAP and test parallelization. 2021-03-10 16:56:39 -05:00
Eric S. Raymond
f2f238e9e4 Address GitLab issue #55: water should not be available in endgame. 2021-02-15 22:21:26 -05:00
Eric S. Raymond
a251e18682 Address Gitlab issue #52: endgame oyster reading is incorrect 2021-02-15 18:11:57 -05:00
Jason Ninneman
be3457abeb Overhaul CI pipeline to use a custom Ubuntu-based Docker image. 2021-01-12 09:08:56 -07:00
Jason Ninneman
12443b0159 Use Python 3, not 2. 2021-01-11 15:56:05 +00:00
Jason Ninneman
eb27776c99 Change and add packages for tumbleweed. 2021-01-11 15:56:05 +00:00
Eric S. Raymond
ba11a8df2e In the YAML, name the rabbit foot because it has a reference. 2021-01-11 01:06:44 -05:00
Eric S. Raymond
b93d2d396f Tweak for Debian packaging. 2021-01-11 00:27:09 -05:00
Eric S. Raymond
bfbea454c7 Trim a legend to less than 80 lines. 2021-01-11 00:20:03 -05:00
Eric S. Raymond
747c42029d Attempt fix for issue #52: endgame oyster reading is incorrect 2021-01-11 00:14:51 -05:00
Eric S. Raymond
8984e48e78 Attempting fix for issue #50: carried clam can be opened (with trident) 2021-01-10 22:14:11 -05:00
Eric S. Raymond
fe1b02f4c0 Correction to the date of first drop. Also, a thinko fix. 2021-01-10 21:02:30 -05:00
Eric S. Raymond
e879e35a02 We can be precise to the day about the release date...
...because Don's original code drop at SAIL was recovered and
announced on Twitter on 2021-01-01.
2021-01-04 14:40:08 -05:00
Eric S. Raymond
90d9ffd85d Ready to release 1.9. 2020-08-27 20:41:17 -04:00
Eric S. Raymond
d9e33a8478 Deal with the consequences of an entry-point deprecation in Python. 2020-08-27 20:33:44 -04:00
Eric S. Raymond
039c06882e Ready for 1.8 release. 2019-04-19 16:29:15 -04:00
Eric S. Raymond
baa7800a3f Fix markup. 2019-04-19 16:25:59 -04:00
Eric S. Raymond
7d0b15ef89 Fixes for some links in the history section. 2019-04-19 16:19:32 -04:00
Eric S. Raymond
3b714272fb control metadata update. 2019-04-19 16:19:32 -04:00
Eric S. Raymond
41c0e77684 Typo fix. 2019-04-19 16:19:32 -04:00
Robert Oschler
569e7c5051 Update INSTALL.adoc to provide extra help for those getting an error regarding yaml when trying to follow the install instructions. 2019-04-19 18:43:46 +00:00
Jason Ninneman
b909cc695f Install missing CI pipeline dependency. 2019-03-01 11:11:44 -07:00
Jason Ninneman
1e6b58420e Use the new path to the openSUSE Docker image. 2019-03-01 11:03:58 -07:00
Eric S. Raymond
989bdad3ee Add a warning to avoid CI breakage. 2019-02-28 22:42:59 -05:00
Jason Ninneman
2ad0fc148b Bump save version number in a test. 2019-02-28 13:04:12 -07:00
Eric S. Raymond
1d54ebb6bd Note that save format has been bumped. 2019-02-28 13:55:56 -05:00
Eric S. Raymond
ae02eac051 Add a coverage exception. 2019-02-28 13:38:08 -05:00
Eric S. Raymond
cf64568f83 Make dungeon.[ch] depemdent on advent.h in case of save version bump. 2019-02-28 12:48:54 -05:00
Eric S. Raymond
9cbea5a5db Documentation polishing. 2019-02-28 07:26:52 -05:00
Eric S. Raymond
b817c54245 Documentation polishing. 2019-02-28 07:09:57 -05:00
Eric S. Raymond
2ddd091893 Documentation polishing. 2019-02-28 06:21:24 -05:00
Eric S. Raymond
b2b4377f71 Bump the save format number, just in case. 2019-02-28 06:04:57 -05:00
Eric S. Raymond
81af59974b The FORTRAN-derived longs were semantically ints. Make it so.
Note. because we used fixed-length declrations in the right places, this
shouldn't break saves.

(Besides being right, this will someday make a port to Go a touch easier,
if we decide to do that.)
2019-02-28 05:58:16 -05:00
Eric S. Raymond
b8c9cf90d8 Restore eyeball-friendliness of INSTALL.adoc. 2019-02-28 05:38:06 -05:00
Eric S. Raymond
7de00b0741 NEWS update. 2019-02-28 05:30:41 -05:00
Jason Ninneman
58a2de6d75 Drop clang debug test to restore pipeline to working order. 2019-02-28 10:24:14 +00:00
Jason Ninneman
5c260e3aec Apply the recent typo fixes to the tests, so they pass. 2019-02-28 10:24:14 +00:00
Jason Ninneman
a727aebdfa Improve INSTALL.adoc's directions and asciidoc-ness.
View it in the Gitlab web interface to see the intended result.
2019-02-28 10:24:14 +00:00
Eric S. Raymond
83f432780a Remove use of Unicode number sign in comments.
"#" for this use is well established in English.  It's not worth opening the
i18n can of worms here.
2019-02-28 05:18:04 -05:00
Eric S. Raymond
0d27a5e03d Document a user-visible change. 2019-02-28 04:59:44 -05:00
Horst H. von Brand
cd36e91381 A few in-game message typos...
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
2018-12-10 22:26:39 -03:00
Horst H. von Brand
894ac28186 Another typo
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
2018-12-10 22:09:22 -03:00
Horst H. von Brand
64b120c03b A couple of "locaiton" in advent.h
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
2018-12-10 21:38:27 -03:00
Aaron Traas
8c6593ad0c Commenting and cleanups 2018-12-10 10:56:35 -05:00
Aaron Traas
e7dc3eab5d Correct return types for all of the action handling functions in actions, so it's clear we're not just using arbitrary ints 2018-12-07 10:36:42 -05:00
Aaron Traas
2a5dac3d8c Abstracted a chuck of do_command() into seperate function do_move(), moved that call to main loop, so as to narrow the focus of do_command() to getting and processing commands. 2018-12-07 10:35:36 -05:00
Aaron Traas
e3b508536d Fix warning on macOS 2018-12-06 10:01:34 -05:00
Aaron Traas
5f4df123b4 Refactored; added state property to command struct to notate where in the lifecycle of command processing that the command is. 2018-12-05 15:05:55 -05:00
Aaron Traas
9475552be4 Major cleanups. Pre-process loop back in main loop, pre-processing abstracted into a function that makes sense. 2018-12-04 11:03:17 -05:00
Eric S. Raymond
b84a2392a1 Ready for 1.7 release. 2018-12-03 22:23:29 -05:00
Eric S. Raymond
673da862b5 NEWS update. 2018-12-03 21:06:03 -05:00
Aaron Traas
ea3b456715 Makefile fix for macOS 10.14 2018-12-03 13:51:02 -05:00
Aaron Traas
dd1d69ad82 Fix for change in list handling behavior in Python 3 2018-12-03 13:48:00 -05:00
Eric S. Raymond
6667ffd1f1 Address GitLab issue #45: OSX Compile issue 2018-11-30 09:50:25 -05:00
Eric S. Raymond
fcf99d56d8 Resolve GitLab issue #46: -o (oldstyle) clarification. 2018-11-30 09:50:25 -05:00
Eric S. Raymond
e65f31cac2 Documentation fix. 2018-11-30 09:50:25 -05:00
NHOrus
524f035e76 Reindentation, typo fix 2018-11-23 20:41:31 +03:00
Eric S. Raymond
f1d3b75561 Remove comments that are obsolete now that the code is goto-less. 2018-11-20 07:05:23 -05:00
Aaron Traas
a437136543 We are now goto free! 2018-11-19 17:01:31 -05:00
Aaron Traas
16545a5765 Eliminated "Lookup" label 2018-11-19 14:52:13 -05:00
Eric S. Raymond
eb49f4d0d2 Comment polishing. 2018-11-18 16:27:06 -05:00
Eric S. Raymond
08f77c692a Attempting voodoo change to banish GitLab error.
This shouldn't be necessary.
2018-11-18 12:39:04 -05:00
Eric S. Raymond
deb489cd8c Eliminate a label. 2018-11-16 08:30:26 -05:00
Eric S. Raymond
9a32aab879 Explicit preserve logic is no longer needed...
...now that we're not heedlessly nuking the command state.
2018-11-16 07:38:49 -05:00
Eric S. Raymond
42a42c49ac Extend coverage. 2018-11-16 07:20:58 -05:00
Eric S. Raymond
5fb6e2e1bc Magic-number elimination. 2018-11-16 05:19:31 -05:00
Eric S. Raymond
c09e36ef8b Recover 100% test coverage. 2018-11-16 05:04:18 -05:00
Eric S. Raymond
09cd426443 Try to get that last line of coverage. 2018-11-15 19:56:01 -05:00
Eric S. Raymond
7991d007ac Choose a less obscure label name. 2018-11-15 14:03:20 -05:00
Eric S. Raymond
17e6078122 Remove some dead symbols revealed by coverage analysis. 2018-11-15 14:00:37 -05:00
Eric S. Raymond
31d561b470 Coverage improvement. Also, it's rude to die silently. 2018-11-15 13:55:10 -05:00
Eric S. Raymond
3ca9613bcd More coverage tweaks. 2018-11-15 13:33:16 -05:00
Eric S. Raymond
42c66160a7 Another coverage tweak. 2018-11-15 13:23:16 -05:00
Eric S. Raymond
5ce427b62b Another coverage tweak. 2018-11-15 12:40:04 -05:00
Eric S. Raymond
79875c8088 Tweak code-coverage exclusions. 2018-11-15 12:18:27 -05:00
Eric S. Raymond
ce5b694458 Ready for 1.6 release. 2018-11-15 12:18:27 -05:00
Eric S. Raymond
1a5d7c7013 Ready for 1.6 release. 2018-11-15 10:08:10 -05:00
Eric S. Raymond
0590c080ee Remove unneeded code. 2018-11-14 19:08:55 -05:00
Eric S. Raymond
7bb2cda986 typo fix. 2018-11-14 13:53:17 -05:00
Eric S. Raymond
438ddceda7 NEWS update. 2018-11-14 13:42:04 -05:00
Eric S. Raymond
75772cf006 Typo fixes from Horst H. von Brand. 2018-11-14 13:33:09 -05:00
Eric S. Raymond
e060b99baf Create regression test for issue #36. 2018-11-14 13:17:56 -05:00
Eric S. Raymond
7701642e0c Regression test for GitLab issue #37 fix. 2018-11-14 13:03:33 -05:00
Eric S. Raymond
a4c87aa0b3 Fix for GitLab issue #37: prompt incorrectly handled. 2018-11-14 13:01:39 -05:00
Eric S. Raymond
876fbb2f78 Prepare for sync with the issue #37 bugfix branch. 2018-11-14 11:52:55 -05:00
Eric S. Raymond
87452af448 Sync patch. 2018-11-14 11:43:38 -05:00
Eric S. Raymond
25765a1b0f Typo fix. 2018-11-12 04:19:54 -05:00
Javier
6d9481130b Fix typo in the NEWS file (2016 -> 2017) 2018-11-11 22:11:32 +00:00
Eric S. Raymond
b93d529487 Ready for 1.5 release. 2018-11-11 09:06:44 -05:00
Eric S. Raymond
d5d6a3e02d Handle a bare numeric token on the command line a bit more gracefully. 2018-11-11 09:05:03 -05:00
Eric S. Raymond
ac2dad44bc NEWS update. 2018-11-11 08:56:15 -05:00
Eric S. Raymond
8207199a33 Identify libedit better. 2018-11-11 08:37:15 -05:00
Eric S. Raymond
6e340dfd53 Fix some accidental test damage in Javier's last commit. 2018-11-11 08:02:21 -05:00
Javier
a782e19982 Patch 1 2018-11-11 12:56:03 +00:00
Eric S. Raymond
f01b3267c8 An attempt to fix GitLab issue #37 failed, but...
...update the condioned-out code to at least make sense with the
current versions of the data structures.
2018-03-11 23:47:43 -04:00
Eric S. Raymond
6de0149f9e Fix for GitLab issue #40: Inconsistant inventory space 2018-03-10 17:58:46 -05:00
Eric S. Raymond
782c5c3f29 SPDXify the code. 2018-03-08 20:56:21 -05:00
Eric S. Raymond
c0a4d55d6c History update. 2018-03-08 10:26:22 -05:00
Eric S. Raymond
37dc950dd6 Address GitLab issue #42. 2018-03-08 08:38:27 -05:00
Eric S. Raymond
88c734ceea Remove an unnecessary argument. 2018-03-08 08:36:37 -05:00
NHOrus
5cdaa301dc Additional warnings
One of the two is fixed and GCC-exclusive, will cause more
warnings on Clang
2018-03-08 15:20:14 +03:00
NHOrus
2787cb1413 Fix CI pipeline 2018-03-08 15:18:32 +03:00
Eric S. Raymond
d51238481a Typo fix. 2017-09-17 11:35:45 -04:00
NHOrus
5ff7592a51 Unlike objects, player doesn't go to -1 when destroyed.
Tighten bounds check.
2017-09-13 19:34:35 +03:00
NHOrus
db2daf1da4 Type constants to prevent overflow 2017-09-12 08:18:17 +03:00
NHOrus
076bb8908b If divident negative, then remainder is negative too.
RNG values need to be always positive.
Solution: Transposing positively by divisor. In all the two places it may happen.
2017-09-11 21:27:57 +03:00
NHOrus
4e4c2e0198 Be consistent 2017-09-11 00:58:13 +03:00
NHOrus
9e2cb3c191 Put some of important parameters into fixed width signed integers
Massaged test files. Fixes issue #41
2017-09-11 00:58:13 +03:00
NHOrus
43f0cb232b Silenced fallthrough warning 2017-09-05 18:32:56 +03:00
NHOrus
96ead306b5 Prevent RNG overflow.
Pass save under validation by pointer, so we could mess with underlying
values a little. Only thing I feel we can safely and sanely modify.
2017-09-05 18:20:21 +03:00
NHOrus
0dd40bba32 Removed old copy-paste error
Put numdie bounds check in croak to prevent OOB access on negative
numdie while preserving tests
2017-09-05 17:46:38 +03:00
NHOrus
e5a0c6e2b7 Prevent tampering with PRNG parameters in save 2017-08-24 14:48:02 +03:00
NHOrus
917af2e744 Fixed copy-paste errors 2017-08-24 14:41:21 +03:00
NHOrus
17d94c46cd Prevent division by zero 2017-08-24 14:25:29 +03:00
NHOrus
25424a01db Verify bounds for linked lists 2017-08-24 13:47:57 +03:00
NHOrus
5e39abf730 Corrected limit for atloc, see init.c for filling double-linked list 2017-08-24 13:40:10 +03:00
NHOrus
aeaa0400cb Fix value, add check for linked locations 2017-08-24 13:02:51 +03:00
NHOrus
98b21323a6 Bounds check for properties; it is not violated in normal game 2017-08-24 11:21:10 +03:00
NHOrus
f496bff945 Syntax error 2017-08-13 15:58:35 +01:00
NHOrus
ad9c53abdb Validate dwarves and tally 2017-08-13 15:56:37 +01:00
NHOrus
0fbd79b608 Reindentation 2017-08-13 15:56:07 +01:00
NHOrus
f0dc3d3b7c Verify sanity of location arrays 2017-08-13 15:16:09 +01:00
NHOrus
36f72f1902 Validating sanity of locations in restored game 2017-08-13 15:13:20 +01:00
NHOrus
7ad7dd209e Remove extraneous listing of files 2017-08-13 12:14:09 +01:00
Eric S. Raymond
2d575dd0e3 Ready for 1.4 release. 2017-08-07 23:21:10 -04:00
Eric S. Raymond
cf92b9d9d6 Remove duplicative phase code. 2017-08-03 15:51:39 -04:00
Jason S. Ninneman
26bf324e07 Use the '=' operator (not memcpy()) to shallow-copy structs. 2017-08-03 12:41:35 -07:00
Eric S. Raymond
87c6d3fb1e Canonicalize OV commands to VO form.
Allows us to get rid of some obscure logic that causes an unnecessary
word shift. One error message changes in a benign way.
2017-08-03 15:02:41 -04:00
Eric S. Raymond
cfa37c83a7 Massage "{oil|water} {plant|door} into equivalent pourcommand.
Bedfore this change the command was passed in OV form, which we want
to get rid of.
2017-08-03 14:48:44 -04:00
Eric S. Raymond
0468da2cdf Simplify overcomplicated code. 2017-08-03 14:22:38 -04:00
Eric S. Raymond
2d618410b8 More breadcrumb improvements. 2017-08-03 12:56:50 -04:00
Eric S. Raymond
8b1533db1a Improve debugging. 2017-08-03 12:25:56 -04:00
Jason S. Ninneman
24d102781c Typedefify command_t; simplify code accordingly. 2017-08-03 08:29:46 -07:00
Jason S. Ninneman
5c30d6429f Simplify command word handling. 2017-08-03 08:24:18 -07:00
Jason S. Ninneman
23ae7edb10 Upgrade get_vocab_metadata() to use command_type_t. 2017-08-03 08:24:18 -07:00
Jason S. Ninneman
5c91ea3739 Encapsulate command words into their own struct. 2017-08-03 08:24:18 -07:00
Jason S. Ninneman
a15e7c9f91 Add command_word_t, for command words. 2017-08-03 08:16:19 -07:00
Jason S. Ninneman
0d3393ebee Datatype definition for command word types. 2017-08-03 08:16:19 -07:00
Eric S. Raymond
1966264715 Cope with YAML idiosyncracy at unquoted "YES". 2017-08-03 10:54:33 -04:00
Eric S. Raymond
812d0194bb Add breadcrumbs for grammar debugging. 2017-08-03 10:54:33 -04:00
Jason S. Ninneman
2ae60b85d1 Add INSTALL.adoc and templates/*.tpl to make recipes.
Fixes issues #38 and #39.
2017-08-02 14:01:39 -07:00
Eric S. Raymond
35ae4af6da Ready for 1.3 release. 2017-08-01 20:03:17 -04:00
Eric S. Raymond
06c8c97738 Exclude %V from coverage since we removed it from the test suite. 2017-08-01 19:55:34 -04:00
Eric S. Raymond
6c7e5a3ac1 Remove 'version test...
...it's too much of a PITA to edit the check file after every release bump.
2017-08-01 19:45:55 -04:00
Eric S. Raymond
25e6b11fd0 Add regression test for split commands. 2017-08-01 19:40:28 -04:00
Eric S. Raymond
a00229050a Remove unused phase codes. 2017-08-01 19:26:29 -04:00
Eric S. Raymond
fd4e3aea6a Address GitLab issue #36: "Get what?" prompt incorrectly handled 2017-08-01 18:37:58 -04:00
Eric S. Raymond
878efdddfb Remove unnecessary clearing of command verb. 2017-07-31 17:40:25 -04:00
Eric S. Raymond
e50f1b8a7b Coverage repair. 2017-07-31 15:26:56 -04:00
Eric S. Raymond
5d6b3aaf62 Fix a coverage gap. 2017-07-31 14:59:58 -04:00
Aaron Traas
319c5830c8 Moved dungeon.c and dungeon.h templates into external files.
Also refactored to use named vars in the templates, so it's easier to
refactor, as order when you call .format() isn't important.
2017-07-23 12:15:25 -04:00
Aaron Traas
8765f49fdc Address Gitlab issue #35 2017-07-22 14:41:23 -04:00
Aaron Traas
ca5374edc3 Modified action() to take take a copy of command rather than a pointer.
It should be safer now that we're not scribbling all over command in
action(), as it's closer to pure. Also fixed a bug in say.
2017-07-21 18:27:02 -04:00
Aaron Traas
30f13c6c25 Back up to 100% coverage. 2017-07-21 17:22:03 -04:00
Aaron Traas
e8a627f964 Specials excised from adventure.yaml 2017-07-21 17:15:23 -04:00
Aaron Traas
5f28f95244 All specials are now actions. Builds correct outputs, more needs deleting. 2017-07-21 16:56:43 -04:00
Eric S. Raymond
80b2b9b356 Simplify seed and waste cpmands using %d in the YAML string. 2017-07-21 14:03:39 -04:00
Aaron Traas
5337e00725 Fix to Gitlab issue #32. Now SEED and WASTE are in adventure.yaml
NOTE: the tests are all updated because now, like every other action,
SEED and WASTE have a \n before their output, as they correctly use
SPEAK
2017-07-21 10:23:02 -04:00
Eric S. Raymond
ef236aea3b More type hygiene. 2017-07-21 07:44:09 -04:00
Eric S. Raymond
a3c159660b Comment cleanup, semantic types, information hiding. 2017-07-21 07:38:09 -04:00
Eric S. Raymond
b27f767cc6 Fix a prototype. 2017-07-20 22:53:15 -04:00
Eric S. Raymond
6718c57d49 Address GitLab issue #34: static char* get_input() is not a prototype 2017-07-20 22:04:01 -04:00
Eric S. Raymond
609159ad6d Abolish as many undifferentiated long variables as possible.
Simple counter become ints.
2017-07-20 18:49:08 -04:00
Eric S. Raymond
7c3f834bca Full comments for all game structure members. 2017-07-20 18:24:57 -04:00
Eric S. Raymond
617f368673 Comment and structure cleanup. 2017-07-20 17:42:31 -04:00
Eric S. Raymond
51182c6bc9 More comment cleanup. 2017-07-20 17:25:03 -04:00
Eric S. Raymond
535d9e7964 Comment cleanup. 2017-07-20 17:25:03 -04:00
Aaron Traas
a167945e19 Information hiding - moved all of command input parsing to misc.c
get_command_input() is effectively an I/O function that takes raw input
and makes it into a command_t. With other I/O functions, it belongs in
misc.c.

This alos allowed me to make 4 other functions static, as they were only
called by get_command_input();
2017-07-20 16:02:54 -04:00
NHOrus
10d681ebeb Test for freshly fixed bugs
Also, removed redundant specials from illformed
2017-07-20 21:00:23 +03:00
Eric S. Raymond
6fda3acbe6 Remove unused enum. 2017-07-20 13:46:42 -04:00
Eric S. Raymond
2c2640a4d8 Restore full code coverage. 2017-07-20 13:37:26 -04:00
Eric S. Raymond
243d05b4f8 Fix core dump in debug mode due to uninitialized allocated storage. 2017-07-20 12:58:42 -04:00
Eric S. Raymond
2aa35a6d84 Fix test breakage. 2017-07-20 12:29:52 -04:00
Eric S. Raymond
342994376a Address GitLab issue #28: Advent hangs on some inputs 2017-07-20 12:24:02 -04:00
Eric S. Raymond
b7af7b9e87 Prevent OB1 error. 2017-07-20 11:27:02 -04:00
Eric S. Raymond
4da9742cd2 Fix invalid variable reuse. 2017-07-20 11:15:15 -04:00
Eric S. Raymond
5701a777c6 Remove unused variables. 2017-07-20 10:53:15 -04:00
Eric S. Raymond
08f260c4d5 Fix Gitlab issue #30: Say is broken. 2017-07-20 10:47:33 -04:00
Eric S. Raymond
aa5870a92e Some vocabulary lookup code can be hidden from main.c. 2017-07-20 10:38:59 -04:00
Eric S. Raymond
8bd947b54d Last remnants of packing removed.
As a bonus, a bug in %S pluralization became obvious and was fixed.
2017-07-20 10:36:22 -04:00
Eric S. Raymond
2fa530340d No more packing in the parser.
As a side effect, ill-formed input consisting of "_\n" gives
a slighty better error message.
2017-07-20 10:17:56 -04:00
Eric S. Raymond
78ba0fac6a Remove unneeded vocabulary lookup. 2017-07-20 10:13:15 -04:00
Eric S. Raymond
08c40bc999 Eliminate last logic guard on a packed value. 2017-07-20 09:50:58 -04:00
Eric S. Raymond
29b8f5b142 Remove a packing call - word buffer is good enough. 2017-07-20 09:11:13 -04:00
Eric S. Raymond
4e01669e06 Remove special-case code that was inducing bugs. 2017-07-20 09:08:10 -04:00
Eric S. Raymond
3f90f5bf38 Improved word type checking. 2017-07-20 07:40:19 -04:00
Eric S. Raymond
52723acb72 Eliminate some uses of wd2 - tests can be done on raw2 buffer instead. 2017-07-20 07:09:20 -04:00
Eric S. Raymond
360adc8bfb Add some word-type checking where it's needed. 2017-07-20 07:02:35 -04:00
Eric S. Raymond
d998965faf Make compparuson out to TOKLEN only explicit in vocab lookups. 2017-07-20 05:54:55 -04:00
Eric S. Raymond
278e9c8240 Get symbol coverage on LOC_SMALLPIT 2017-07-19 15:38:31 -04:00
Eric S. Raymond
19854c9614 Remove a test pair that seems to be duplicative. 2017-07-19 14:00:12 -04:00
Jason S. Ninneman
8ac4a59a67 Tell the compiler not to warn about legitimate case fallthroughs. 2017-07-19 09:47:20 -07:00
Eric S. Raymond
cbf03c43a8 Typo fix. 2017-07-17 16:30:41 -04:00
Eric S. Raymond
97bb25d9c5 Cover short descriotion of LOC_SMALLPIT. 2017-07-17 16:22:09 -04:00
Eric S. Raymond
bbdaa07172 Record 100% code coverage. 2017-07-17 14:28:40 -04:00
NHOrus
faedb38a64 Step with debug compiling with Clang, to contrast with GCC 2017-07-17 13:56:52 -04:00
NHOrus
30822d0ba4 No magic, revert some experimental changes in pipeline 2017-07-17 13:56:52 -04:00
NHOrus
a680514d5f Use OpenSUSE in CI pipeline, instead 2017-07-17 13:56:52 -04:00
Jason S. Ninneman
ee7bacc9ec Use Fedora for the CI pipeline. 2017-07-17 13:56:52 -04:00
Jason S. Ninneman
f34df0b8a2 Use ASan and UBSan in debug builds. 2017-07-17 13:56:52 -04:00
Jason S. Ninneman
b736e3bc8e Deploy maximum "fortified source" and stack protection. 2017-07-17 13:56:52 -04:00
Jason S. Ninneman
007db7a729 Ensure cheat is built with debug options when 'make debug' is given. 2017-07-17 13:56:52 -04:00
Aaron Traas
5fa5d506ee LOC_SMALLPIT.small and LOC_TOPSTALACTITE.small 2017-07-17 13:34:53 -04:00
Aaron Traas
e9cd50ec38 YAML coverage generator minor cleanup 2017-07-17 13:34:53 -04:00
Dr. Tobias Quathamer
9fa52c7889 Add .desktop file for advent 2017-07-17 16:19:34 +02:00
Dr. Tobias Quathamer
bef62b1e85 Add SVG file for advent icon 2017-07-17 16:14:45 +02:00
Eric S. Raymond
a4c1737428 Remove flawed code to drop batteries. 2017-07-17 07:29:44 -04:00
Eric S. Raymond
992bdbf16c Cover MISSING_BATTERIES in a test. Needs unducumented "waste" fallback. 2017-07-17 06:07:01 -04:00
Eric S. Raymond
3be0cb3596 Prevent multiline string quotes from confusing Emacs. 2017-07-16 17:23:40 -04:00
Eric S. Raymond
9b5142af5a De-FORTRANIZE some IDs. 2017-07-16 16:05:26 -04:00
Eric S. Raymond
2fca59d9fd Information hiding. 2017-07-16 15:23:03 -04:00
Jason S. Ninneman
7a542633e5 Discuss specials: in the adventure.yaml comments. 2017-07-16 12:19:42 -07:00
Eric S. Raymond
15c936d240 Fix adventitious '' occurrences. 2017-07-16 14:17:26 -04:00
Eric S. Raymond
0b31f7530b Consolidare window1 test into bigfail. 2017-07-16 14:06:04 -04:00
Eric S. Raymond
0df532f92f Test consolidation into bigfail.log. 2017-07-16 13:05:34 -04:00
Eric S. Raymond
3e3c93903f Extend bigfail test. 2017-07-16 09:23:40 -04:00
NHOrus
614d9b34ad Removed temporary variable for clarity; Upsized text buffer in fallback to maximum possible size 2017-07-16 16:07:23 +03:00
NHOrus
8d9c8e4d5c Deal with more agressive gcov 7.1; Reindent 2017-07-16 16:00:19 +03:00
Aaron Traas
33e546b746 Test consolidation 2017-07-16 07:57:44 -04:00
Aaron Traas
818b95a85f YAML coverage generator minor cleanup 2017-07-16 07:53:20 -04:00
Aaron Traas
b47d95853b Fixed YAML coverage generator in python3 2017-07-16 07:53:20 -04:00
Eric S. Raymond
058fc70344 Fold smallpit test into bigfail. 2017-07-16 07:48:37 -04:00
Eric S. Raymond
8bce57d3df Fix bug where knife hit might not be reported. 2017-07-16 07:13:06 -04:00
Eric S. Raymond
427bd23a10 Test consolidation - move a lot of nonlethal failures into bigfail.log. 2017-07-16 06:26:51 -04:00
Eric S. Raymond
9b585f40d8 Two coverage imprivenents, one by recognizing dead code. 2017-07-16 05:33:43 -04:00
Eric S. Raymond
9eda1f424d Apply state_change() to mirror object. 2017-07-16 05:08:03 -04:00
Eric S. Raymond
c4cbb859c2 More test consolidation. 2017-07-16 04:13:08 -04:00
Eric S. Raymond
c499426d57 Test consolidation. 2017-07-16 04:00:33 -04:00
Eric S. Raymond
76806f814e Improve symbol coverage. 2017-07-15 20:49:38 -04:00
Aaron Traas
87d7117ddd YAML coverage - TROLL_BLOCKS arbitrary message 2017-07-15 18:10:29 -04:00
Aaron Traas
834d645d8b Named unnamed actions and specials 2017-07-15 17:20:02 -04:00
Aaron Traas
ac4e43196c Full refactor of YAML dungeon generator.
The big difference is that the differences between the entity types
is concentrated in one place.

Also concentrated all File I/O in main function, moved most processing
outside of main
2017-07-15 17:19:29 -04:00
Aaron Traas
fb86d64b20 First stage cleanup of YAML dungeon generator. Less hard-coded stuff.
Next stage will be rewrite so report object contains all of the keys
and coverage values, so we're not scribbling over DB all the time, and
we don't have to walk over things multiple times, and can keep HTML
generation in one place
2017-07-15 13:10:39 -04:00
Eric S. Raymond
fefc1ff486 Improve symbol coverage. 2017-07-15 13:00:48 -04:00
Eric S. Raymond
fece880dc2 Documentation polishing. 2017-07-15 12:05:54 -04:00
Aaron Traas
33dfafc705 YAML coverage - last object message 2017-07-14 13:13:24 -04:00
Eric S. Raymond
d1e29319fa Code cleanup. 2017-07-14 13:10:13 -04:00
Eric S. Raymond
1954c04ccc Fix off-by-two bug. 2017-07-14 12:39:06 -04:00
Aaron Traas
040e027a71 YAML coverage - object messages 100% covered 2017-07-14 12:29:09 -04:00
Jason S. Ninneman
e581c7741d Replace some more wd? with id?. 2017-07-14 09:18:55 -07:00
Jason S. Ninneman
11043b7246 Replace some uses of wd[12] with id[12]. 2017-07-14 09:18:55 -07:00
Jason S. Ninneman
596a15457d Dragon attack code no longer edits the command struct.
This also fixes a minor bug where refusing to attack the dragon
costs the player two turns instead of one.
2017-07-14 09:18:55 -07:00
Jason S. Ninneman
ff6a816e5f Handle word type and raw strings. 2017-07-14 09:18:55 -07:00
Jason S. Ninneman
820737fb80 Use vocab IDs along side packed words. 2017-07-14 09:18:24 -07:00
Eric S. Raymond
61570c700b More coverage improvements. 2017-07-14 12:00:29 -04:00
Eric S. Raymond
66fba512a7 Partially address GitLab issue #27: arbitrary_messages unreachable 2017-07-14 11:33:22 -04:00
NHOrus
7f18e66866 Refactored discard to concentrate bird-related things in one place 2017-07-14 16:38:25 +03:00
NHOrus
66ba9a0101 Refactored carry for clarity 2017-07-14 16:38:25 +03:00
NHOrus
3d2ba18355 Do not base endgame bonus on arbitrary messages
This may break save files, but doesn't, due to padding
2017-07-14 16:38:25 +03:00
Aaron Traas
6a90dcd017 YAML coverage - commented out unused arbitrary messages 2017-07-13 23:20:27 -04:00
Aaron Traas
e4aed91401 YAML coverage - all the listen messages 2017-07-13 23:16:24 -04:00
Aaron Traas
7220425015 YAML coverage - cleanup and comments 2017-07-13 21:52:27 -04:00
Aaron Traas
52cdc8b87a YAML coverage - locations 100% covered 2017-07-13 21:52:27 -04:00
Aaron Traas
342c27494d YAML coverage - more locations and message
- LOC_DEADCRAWL
- CROSS_BRIDGE
- LOC_BOULDERS2.short
- LOC_WINDOW1
2017-07-13 21:52:27 -04:00
Aaron Traas
4bffb10094 YAML coverage - hints 100% covered 2017-07-13 21:52:27 -04:00
Aaron Traas
99595f6a2a YAML coverage parser bug fixed -- handling \n and \t correctly 2017-07-13 21:52:27 -04:00
Aaron Traas
2ec9c7cc1a YAML coverage parser fixed to equate "NO_MESSAGE" with None 2017-07-13 21:52:27 -04:00
Aaron Traas
a6e80af64f adventure.yaml - coverage of all scoring class thresholds 2017-07-13 21:52:27 -04:00
Aaron Traas
e696fed6db Prompt and taunt you after 3rd and final death
Fixed a bug where you'd not be asked about whether to be resurrected a
final time. Now you are.
2017-07-13 21:52:27 -04:00
NHOrus
49d9ef1bee No spk remains in the code base 2017-07-13 21:52:27 -04:00
NHOrus
761d660cd2 Test that troll really retuns after we take eggs 2017-07-13 21:52:27 -04:00
NHOrus
03b2f1c86e Removed unused code, reindented 2017-07-13 21:52:27 -04:00
Aaron Traas
0e2c851131 Expand scope of coverage_dungeon.py - actions and obituaries 2017-07-13 21:52:27 -04:00
Aaron Traas
e176039b01 Expand scope of coverage_dungeon.py - specials 2017-07-13 21:52:13 -04:00
Aaron Traas
39cc166979 Expand scope of coverage_dungeon.py
hints, classes and turn thrusholds are now supported
2017-07-12 17:52:56 -04:00
Eric S. Raymond
24f29c6ba7 Cosmetic text fix. 2017-07-12 13:48:55 -04:00
Jason S. Ninneman
50efa22849 Express word type with an enum instead of magic numbers.
* Make a cleaner function for getting vocab metadata.
* Get rid of magic numbers.
* Purge get_vocab_id().
* Abolish the *_WORD() macros.
* Add FIXME comment on some ugliness.
2017-07-12 10:35:00 -07:00
Aaron Traas
b5badcacc8 Forcing floating point division for % coverage, so we don't show 0% 2017-07-12 08:56:50 -04:00
Eric S. Raymond
619eaea982 Remove obsolete comment. 2017-07-12 05:24:12 -04:00
Eric S. Raymond
a368e2a8b8 Remove obsolete caveat. 2017-07-12 05:11:03 -04:00
Eric S. Raymond
dd975b9886 In TODO, note some possible tests. 2017-07-12 04:42:24 -04:00
Eric S. Raymond
4a4c113624 Prevent game from uttering solecisms about the "floor" when outside. 2017-07-12 00:19:16 -04:00
Jason S. Ninneman
bd1b893263 Python-agnosticize coverage_dungeon.py. 2017-07-11 23:14:40 +00:00
Jason S. Ninneman
a0c33c2483 Install Python 2 pip in Alpine. 2017-07-11 23:14:39 +00:00
Jason S. Ninneman
8b38f66cbf Use Python 2 in Alpine Linux, because that's default. 2017-07-11 23:14:39 +00:00
Jason S. Ninneman
b8dd0eb904 Make the build Python-2/3 agnostic. 2017-07-11 23:14:39 +00:00
Jason S. Ninneman
b5e8eec80e Replace tests on packed words with tests on strings. 2017-07-11 23:14:38 +00:00
Eric S. Raymond
bcacb84166 Record a fix. 2017-07-11 19:13:24 -04:00
Eric S. Raymond
7ddbe04632 Demonstrate that we don't have the vase bug. 2017-07-11 19:06:10 -04:00
Aaron Traas
92ddbba212 LOC_* coverage - at 98.4% 2017-07-11 17:35:23 -04:00
Eric S. Raymond
3a7ce1b73a Minor bug fix in an error notification. 2017-07-11 17:05:55 -04:00
Eric S. Raymond
f06e5b8fdb Address Issue #13: The "eat" command exhibits strange behavior 2017-07-11 16:16:38 -04:00
Eric S. Raymond
559b6435d1 Actual 1.2 release. 2017-07-11 11:59:53 -04:00
Eric S. Raymond
3a722da650 Minor coverage inclusion. 2017-07-11 11:57:46 -04:00
Eric S. Raymond
da37afb19b Documentation polishing. 2017-07-11 06:00:21 -04:00
Eric S. Raymond
d7bad65d5b More comment polishing. 2017-07-11 04:42:36 -04:00
Eric S. Raymond
9a14d2e1cd Comment polishing. 2017-07-11 04:35:00 -04:00
Eric S. Raymond
00cf2a9373 Comment polishing. 2017-07-11 04:15:57 -04:00
Eric S. Raymond
de3be760b6 Comment polishing. 2017-07-11 03:43:37 -04:00
Eric S. Raymond
96950869c6 Reindent. 2017-07-11 03:26:00 -04:00
Eric S. Raymond
d9aadeedba LCOV exclusuon correction - addresses issue #25. 2017-07-10 23:04:22 -04:00
Aaron Traas
12b2ff74f6 Cleanups and clarifications in do_command() 2017-07-10 17:43:59 -04:00
Aaron Traas
9056fa7a2c Eliminated another label 2017-07-10 17:35:24 -04:00
Aaron Traas
18ec2f79b0 Eliminated a label 2017-07-10 17:23:20 -04:00
Aaron Traas
4d7858d333 Cleaned up do_command() a little 2017-07-10 17:21:09 -04:00
Aaron Traas
b29f56f595 Isolate command input processing, got rid of label "Laction" 2017-07-10 16:30:51 -04:00
Aaron Traas
7c610a120d refactored fallback_handler() to use command_t, isolating from side effects 2017-07-10 16:09:18 -04:00
Aaron Traas
21c36003cd Test message corrected 2017-07-10 16:04:48 -04:00
Aaron Traas
39fbd7a56f Revert "Remove 'version' test. Framework plays badly with variable output."
This reverts commit 13f7304081.
2017-07-10 16:04:48 -04:00
Eric S. Raymond
76c6ab4cfa Tweak a coverage exclusion. 2017-07-10 14:57:55 -04:00
Aaron Traas
3bfaff447b Coverage - bird attack snake in endgame 2017-07-10 12:53:13 -04:00
Eric S. Raymond
9a16382b12 Bear can't dies where it can be chained. 2017-07-10 12:49:45 -04:00
Eric S. Raymond
13f7304081 Remove 'version' test. Framework plays badly with variable output.
We'll have to come up with generic solution to this.
2017-07-10 12:18:35 -04:00
NHOrus
0ea7dcf1a0 Version bump in tests 2017-07-10 15:11:19 +03:00
NHOrus
5ae50f1580 Fail getting some more hints by disqualifying conditions 2017-07-10 15:10:46 +03:00
NHOrus
6ae7d0bf16 Two different failures to get hint for ogre 2017-07-10 15:10:46 +03:00
NHOrus
af6ee946ef Fail to feed the snake, find the pirate before he pounces 2017-07-10 15:10:46 +03:00
Eric S. Raymond
b1b0399c66 Ready to release 1.2. 2017-07-10 07:46:26 -04:00
Eric S. Raymond
28ebecc1f1 Add historical details. 2017-07-09 16:48:29 -04:00
Aaron Traas
91c9fa3066 Coverage: LOC_DIFFERENT* and fail to feed bear 2017-07-09 15:32:14 -04:00
Aaron Traas
f43bacfa0f Sort coverage report to make more readable 2017-07-09 15:31:11 -04:00
Eric S. Raymond
034a13595b Clean up test titles. 2017-07-09 14:58:44 -04:00
NHOrus
173b1b1acd Test for failure to deal with ogre by attacking him 2017-07-09 20:39:14 +03:00
NHOrus
9b879b41cb Test for selecting different plants 2017-07-09 20:36:41 +03:00
NHOrus
5cee3cc785 Tests for failing with the golden eggs 2017-07-09 20:35:24 +03:00
NHOrus
7ba34df739 Last unfired test - for getting the jade (better start over!) 2017-07-09 20:28:15 +03:00
NHOrus
2b22871cce Some fuzzing-generated tests, with possible coverage redundancies 2017-07-09 20:25:39 +03:00
NHOrus
53b68161ff Two more lines of coverage; more cleanup for macros 2017-07-09 20:25:28 +03:00
Eric S. Raymond
6a27214470 Documentation improvement. 2017-07-09 07:39:48 -04:00
Eric S. Raymond
859663b14b Documentation polishing. 2017-07-09 07:03:26 -04:00
Aaron Traas
926a806db9 Made YAML coverage test work with variable messages (%s, %d, etc.) 2017-07-08 19:37:51 -04:00
NHOrus
53cb12b4d0 Bound the sizes of strcpy. 2017-07-08 15:16:21 -04:00
NHOrus
a3ffa2455b № and minor syntax correction 2017-07-08 21:00:26 +03:00
NHOrus
c0817b6bb5 Fix dead bear tests 2017-07-08 20:02:30 +03:00
NHOrus
e09ba7244d Minor deduplication 2017-07-08 19:59:50 +03:00
NHOrus
d739c111d7 Restructure quips for invalid movements. 2017-07-08 19:59:50 +03:00
NHOrus
386ca2b8d2 Restructure lightcheck 2017-07-08 19:59:50 +03:00
Eric S. Raymond
7d690e0b95 Set game.newloc when reincarnated. Fixes a bug. 2017-07-08 11:34:09 -04:00
Eric S. Raymond
fcfc7c3b5c Add a code audit production using cppcheck. 2017-07-08 09:51:10 -04:00
Eric S. Raymond
9a6e492ba4 Expand test coverage, partly fixing Gitlab issue #23. 2017-07-08 08:59:28 -04:00
Eric S. Raymond
75094fd658 Comment polishing. 2017-07-08 08:35:44 -04:00
Eric S. Raymond
2935e07bc9 Documentation polishing. 2017-07-08 01:52:19 -04:00
Aaron Traas
4446c61d5f Now YAML coverage test generates a nice HTML template 2017-07-07 22:41:59 -04:00
Eric S. Raymond
6af7db8cd9 Comment polishing. 2017-07-07 16:39:11 -04:00
Aaron Traas
310559ce15 adventure.yaml coverage test script -- not at all polished, but works 2017-07-07 16:28:14 -04:00
NHOrus
5af8fb18f0 Prevent access beyond boundaries of array on fallthrough 2017-07-07 23:15:54 +03:00
NHOrus
9100c14d2c Fuzzed tests for two of untested hint conditions 2017-07-07 22:41:53 +03:00
Eric S. Raymond
100152c21d Comment cleanup. 2017-07-07 15:34:32 -04:00
Eric S. Raymond
1cbc3d827b Eliminate magic numbers from C side of condition handling. 2017-07-07 15:01:25 -04:00
Eric S. Raymond
2bdf9e2803 Purge magic numbers from C side of destination handling. 2017-07-07 11:04:18 -04:00
NHOrus
e619c41048 Don't forget to ask important questions when removing restore of saves 2017-07-07 17:58:42 +03:00
NHOrus
0042d641dc Plugged all memory leaks.
Now all tests pass under ASan or Valgrind.
2017-07-07 12:07:52 +03:00
NHOrus
551838cea2 Deal around newline-only lines pruned to zero-lenght
Test for that, too
2017-07-07 11:21:37 +03:00
NHOrus
ef97d579ea Don't zero stuff twice 2017-07-07 11:18:02 +03:00
NHOrus
51b6b52dc8 Eliminated multiple reassigments 2017-07-07 10:20:32 +03:00
NHOrus
d51da9d0b8 Magic Number Elimination 2017-07-07 10:04:26 +03:00
Eric S. Raymond
7c1c169bf8 More readable dungeon.c output. 2017-07-06 16:41:06 -04:00
Eric S. Raymond
7b13a88429 Make the travel table in the dungeon.c output easier to read. 2017-07-06 15:56:23 -04:00
Eric S. Raymond
004693c261 Towards a more readable generated file. 2017-07-06 15:56:23 -04:00
NHOrus
ea4986e0f5 Stop overwriting obj by dragon check 2017-07-06 19:12:16 +03:00
NHOrus
8f5c262e6d Semantic type for verb 2017-07-06 18:40:11 +03:00
NHOrus
cca3686f2f Clear login in bvreak
Test double-breaking of vase
2017-07-06 18:23:07 +03:00
NHOrus
0a04293f23 Prevent multiple assigment to game.bonus in blast 2017-07-06 18:18:31 +03:00
NHOrus
adab8e2190 Be explicitely intransitive 2017-07-06 18:11:02 +03:00
NHOrus
ca7ac4063f Magic-number elimination and fix
More test coverage for some of the cases
2017-07-06 17:55:56 +03:00
Eric S. Raymond
da6a090b83 Magic-number elimination. 2017-07-06 07:42:41 -04:00
NHOrus
aee5fff1a3 Some test improvements 2017-07-06 11:04:07 +03:00
NHOrus
fd3b08e7d1 Improve readability 2017-07-06 10:32:33 +03:00
NHOrus
53efcdf2d2 Cleaned up light and extinguish 2017-07-06 10:27:49 +03:00
NHOrus
a802db1ce0 Cleaned up eat 2017-07-06 10:18:18 +03:00
NHOrus
acf303a57f Pruned out special case of discarding the vase 2017-07-06 10:13:43 +03:00
NHOrus
7be2c233ed Cleared up lock/unlock logic 2017-07-06 10:12:55 +03:00
NHOrus
de2b1894f2 obj_t in actions. And some more magical word removal
Also, reindented everything, as usual
2017-07-06 10:05:11 +03:00
Eric S. Raymond
146abeae17 Magic-number elimination. 2017-07-05 21:45:55 -04:00
Eric S. Raymond
da1f251524 Remove arithmetic on a location number. 2017-07-05 20:51:45 -04:00
Eric S. Raymond
b2a686b07d Location arithmetic elimination. 2017-07-05 20:29:50 -04:00
Jason S. Ninneman
ad24add3c0 actions[] now has strings instead of enums. 2017-07-05 16:31:41 -07:00
Eric S. Raymond
88477f1175 Repair tests to track previous change. 2017-07-05 19:26:32 -04:00
Eric S. Raymond
c8cac18f42 Improve giant-words failure message. 2017-07-05 17:32:44 -04:00
Jason S. Ninneman
0b99885ed2 Remove the specials[] duplicates of the 'big' words. 2017-07-05 14:02:52 -07:00
Jason S. Ninneman
0e540429b0 Working but unpolished refactor of bigwords(). 2017-07-05 14:02:52 -07:00
Eric S. Raymond
73608b6307 Further infiltrare semantic types. 2017-07-05 16:55:16 -04:00
NHOrus
d3578c9da9 Test for bear, from tag seed 2017-07-05 15:41:36 -04:00
NHOrus
b2d71155e9 same with bear, but without test 2017-07-05 15:41:36 -04:00
NHOrus
603f548a21 Fixed feed command and white space in tests 2017-07-05 15:41:36 -04:00
NHOrus
7137c20316 Capture correct behavior from seed 2017-07-05 15:41:36 -04:00
NHOrus
725105b4a2 Made feeding a switch instead of elsif chain 2017-07-05 15:41:36 -04:00
NHOrus
23aced5c7c One bit less math on states 2017-07-05 15:41:36 -04:00
NHOrus
40ff648431 Moved state_change to misc.c to start using it in main.c, too 2017-07-05 20:23:34 +03:00
NHOrus
df422fe2ed Test cover all of discard 2017-07-05 19:12:05 +03:00
NHOrus
878800edc6 Triggering more phrases 2017-07-05 18:59:05 +03:00
Eric S. Raymond
6ec4bc0dba Make a test more explicit. 2017-07-05 11:47:10 -04:00
Eric S. Raymond
e521cc368e Repair oilplant.log. 2017-07-05 11:36:16 -04:00
Eric S. Raymond
3b64fb3bfd Reduce test makefile verbosity under Emacs. 2017-07-05 11:09:56 -04:00
NHOrus
c35cf99966 Static analysis warnings squished 2017-07-05 17:45:12 +03:00
Eric S. Raymond
7be7ac9406 Magic-number elimination. 2017-07-05 03:17:24 -04:00
Eric S. Raymond
fd57b3b5bd Fix dropped stitch in last commit. 2017-07-05 02:55:51 -04:00
Eric S. Raymond
d522d22c71 Magic-number elimination. 2017-07-05 02:53:39 -04:00
Eric S. Raymond
752ac08737 Documentation polishing. 2017-07-05 02:42:51 -04:00
Eric S. Raymond
df87c596fb Under oldstyle, mangled echoed unknown text to simulate old behavior. 2017-07-05 02:34:36 -04:00
Eric S. Raymond
c8f3289828 Minor clarifications. 2017-07-05 02:02:39 -04:00
NHOrus
caab2242fc Trigger 'NO_EDIBLES' message 2017-07-05 08:37:04 +03:00
Eric S. Raymond
31c1a44915 Adapt bottle object to use state_change(). 2017-07-05 01:15:40 -04:00
NHOrus
8613f0b3d9 Magic number elimination
Special state/locations for game.fixd object array
2017-07-05 07:56:36 +03:00
Eric S. Raymond
3d5c7239f1 Simplify vase-dropping logic using state_change(). 2017-07-05 00:40:14 -04:00
Eric S. Raymond
5ae09b9c34 Magic-number elimination. 2017-07-04 23:46:16 -04:00
Eric S. Raymond
c48c330883 Magic-number elimination in the olover/alcove pasage code.
Wuth this change, the location table becomes order-independent (I think).
2017-07-04 22:57:34 -04:00
Aaron Traas
f3dae6ff83 Coverage -- more odd actions 2017-07-04 17:41:42 -04:00
Aaron Traas
19127d05df Removed equivocation between ROD and ROD2 in throw()
Already dealt with in action(), so redundant and unreachable here.
2017-07-04 17:13:26 -04:00
Eric S. Raymond
abf820bb5c Magic-number elimination. 2017-07-04 14:40:10 -04:00
Eric S. Raymond
f37a413524 Magic-number elimination. 2017-07-04 14:15:20 -04:00
Eric S. Raymond
a8ac2f477a Abstract out some state arithmetic. 2017-07-04 13:41:12 -04:00
NHOrus
4ac9df527b Test for filling full bottle with different liquid 2017-07-04 20:35:03 +03:00
NHOrus
63396e6abc Oops. Also, sometimes it's better be explicit in parameters 2017-07-04 19:50:19 +03:00
NHOrus
92de4856a6 Localized spk in discard 2017-07-04 19:45:00 +03:00
NHOrus
733b035933 Completed unspk'ing of vcarry. 2017-07-04 19:41:06 +03:00
NHOrus
e46cbdf194 Unspk'd (v)carry. Made logic more visible.
And tested some of newly exposed cases.
2017-07-04 19:30:22 +03:00
NHOrus
665103410a Unspk'd and streamlined attack. Tested one of discovered gaps. 2017-07-04 18:41:28 +03:00
Aaron Traas
16a175bbab Eliminated bivalve function.
Reason: only called in lock(), you can't be TOTING a clam, you can't
have the trident at a carryable oyster, and the code IMHO is more
readable this way.
2017-07-04 10:06:41 -04:00
Eric S. Raymond
e1cca3b28a State-arithmetic elimination. 2017-07-04 09:17:20 -04:00
Eric S. Raymond
e31e69b172 Grammar fix. 2017-07-04 09:04:10 -04:00
NHOrus
e1d9c97118 Drinking not from stream gets the same result 2017-07-04 15:18:49 +03:00
NHOrus
dc34ac3d06 workaround for eat grate bug in retrospective tests 2017-07-04 15:18:49 +03:00
NHOrus
85f918f9c0 Unspk'd chain action 2017-07-04 15:18:49 +03:00
NHOrus
469a0e74ed linearized drink 2017-07-04 15:18:49 +03:00
NHOrus
3c636e27e2 linearized extinguish 2017-07-04 15:18:49 +03:00
NHOrus
8cbb8afcbe Unspk'd and restructured fill 2017-07-04 15:18:49 +03:00
NHOrus
e6efd6dbac Partial cleanup of fill 2017-07-04 15:18:49 +03:00
NHOrus
294f2b8a6d Removed magic from checks for liquids 2017-07-04 15:18:49 +03:00
NHOrus
de5696431d Unspk'd find 2017-07-04 15:18:49 +03:00
NHOrus
ffd08893dd Unspk'd inventory lookup 2017-07-04 15:18:49 +03:00
NHOrus
b8def22d24 Unspk'd lock, cleaned up logic 2017-07-04 15:18:49 +03:00
NHOrus
babf08ddc4 Cleaned up unused variables 2017-07-04 15:18:49 +03:00
NHOrus
df2830598c Unspk'd Giant Words 2017-07-04 15:18:49 +03:00
Eric S. Raymond
248fc90e3d Another use of state_change(). 2017-07-04 08:16:10 -04:00
Eric S. Raymond
e91b8c2a06 Another use of state_change() and changes messages. 2017-07-04 07:59:20 -04:00
Eric S. Raymond
e62e4f6e46 YAML cleanup. 2017-07-04 07:39:07 -04:00
Jason S. Ninneman
4f78dfea24 Begin replacing tests on strings with tests on vocab IDs. 2017-07-03 18:21:25 -07:00
Jason S. Ninneman
07e7b8131e Upgrade get_vocab_id() to handle empty strings. 2017-07-03 18:08:04 -07:00
Eric S. Raymond
659f797d8a Implement and document new state-label syntax. 2017-07-03 20:27:56 -04:00
Eric S. Raymond
217f05b28b Comment polishing. 2017-07-03 19:26:32 -04:00
Eric S. Raymond
1c4fcaf43e Discard implementation of %L and %U format specifiers, now never used. 2017-07-03 18:40:06 -04:00
Eric S. Raymond
df36b62c74 Reducing use of dynamic allocation forecloses many errors. 2017-07-03 17:53:25 -04:00
Eric S. Raymond
6e67222206 Information hiding. 2017-07-03 17:21:06 -04:00
Eric S. Raymond
4b51b06b73 Simplify tokenization code. 2017-07-03 17:13:28 -04:00
Eric S. Raymond
393010ec41 Entirely eliminate wd1x and wd2x members of the command block.
In the process, fix another case-smashing bug.
2017-07-03 16:49:33 -04:00
NHOrus
f52a78a1f8 Captured output of help and info commands
Can't believe it wasn't done before
2017-07-03 22:15:19 +03:00
Eric S. Raymond
3d511d9e66 Use DOWN rather thabnd D in YAML. 2017-07-03 14:55:34 -04:00
Eric S. Raymond
a768555312 Use the raw buffer in tr command structure for editing.
This fixes some minor bugs. Unknown words are no longer truncated
nor uppercased on echo.
2017-07-03 12:52:28 -04:00
Eric S. Raymond
854e21a1af Remove a bad command from a check log.
It's interfering with a refactor, and pathological cases really
ought to be checked elsewhere.
2017-07-03 10:10:14 -04:00
Eric S. Raymond
f03bde268e Refactor tokenization to save raw tokens and use static buffer space...
...rather than dynamic storage.

As a side effect, this seems to have fixed a very ninor bug in the processing
of the bare word 'nothing'.  But I don't know where the bug was.  Not happy.
2017-07-03 08:53:10 -04:00
Eric S. Raymond
eba8015059 Magic-number elimination. 2017-07-03 07:14:15 -04:00
Eric S. Raymond
f48ec1eb36 Named state labels for every not clause. 2017-07-03 07:00:42 -04:00
Eric S. Raymond
bf209577a5 Make the YAML less fussy.
Don't string-quote things that are semantically like enums.
2017-07-03 06:47:30 -04:00
Eric S. Raymond
7740b163c8 playermove() never returns false; simplify accordingly 2017-07-03 06:10:52 -04:00
NHOrus
f8166fdb89 Visit room with breathtaking view
Try to extinguish a volcano
Closes #22
2017-07-03 07:30:53 +03:00
NHOrus
63152e6714 Broke all logical or into multiline statement to show lcov's lies
Results are weird, some things that need to be checked aren't and
at least my local lcov doesn't show them as unchecked
2017-07-03 07:20:37 +03:00
NHOrus
fc5267fe8b Unspk'd bivalve action, exposing more untested surface 2017-07-03 06:46:24 +03:00
NHOrus
ac65f3fd5f Unspk'd fly command 2017-07-03 06:29:02 +03:00
NHOrus
8b3ef7ca78 Unspk'd listen and lock commands 2017-07-03 06:21:38 +03:00
NHOrus
38970a1c98 Unspk'd pour command 2017-07-03 06:12:19 +03:00
NHOrus
5613b0ce36 Unspk and streamline eat command 2017-07-03 06:07:57 +03:00
NHOrus
e1f52f4e31 Removed helper function 2017-07-03 05:59:57 +03:00
NHOrus
da78e7eb92 Wake dwarves differently 2017-07-03 05:41:49 +03:00
NHOrus
77a3616182 Cover branch last branch of bird action
And remove distracting line from tests
2017-07-03 05:30:46 +03:00
Aaron Traas
e10faf6edb Coverage -- attack bird after game closed 2017-07-02 22:08:45 -04:00
Aaron Traas
9b3be62aaa Remove testing for intransitive seperate from NO_OBJECT in attact()
because we look for it immediately below, and this code is never
reached. If it were, intransitive attacks would never work.
2017-07-02 21:56:49 -04:00
Aaron Traas
c8445a88d7 Coverage -- corner cases in lock and find 2017-07-02 21:53:28 -04:00
Aaron Traas
481d198d39 Coverage -- giant words 2017-07-02 21:42:42 -04:00
Aaron Traas
854b9b0abd Coverage -- intransitive attack 2017-07-02 21:42:42 -04:00
NHOrus
c7aecb7249 Removed spk from wave, fixed compiler warning 2017-07-03 01:01:01 +03:00
NHOrus
993194bd4d Undid unspeaking of wave, fixed test again.
Changed property math to helper function.
2017-07-03 00:47:17 +03:00
NHOrus
eeda78a210 Don't spk in wave and action 2017-07-03 00:04:44 +03:00
NHOrus
8fcbc8ecba More magic number elimination 2017-07-02 22:57:26 +03:00
NHOrus
fbc80f0363 Unfalsify coverage check 2017-07-02 22:57:25 +03:00
Eric S. Raymond
89e1833d8f Magic-number elimination. 2017-07-02 15:32:50 -04:00
NHOrus
c811512a82 More tests, multilined yaml 2017-07-02 15:16:50 -04:00
Eric S. Raymond
e712f4c0e0 Magic-number elimination. 2017-07-02 14:47:21 -04:00
NHOrus
369c67840e Attack content and dead bear 2017-07-02 21:10:27 +03:00
Eric S. Raymond
708dd0fb4a Imprive coverage of cheat. 2017-07-02 13:57:01 -04:00
Aaron Traas
35f4af108d Coverage - attack sitting bear 2017-07-02 13:40:24 -04:00
Jason S. Ninneman
6af38a92f6 Eliminate the global game.blklin. 2017-07-02 10:37:10 -07:00
NHOrus
8456b866ff Rationalize attack logic
Fix the compiler warnings about bunching ands with ors
2017-07-02 20:29:51 +03:00
Eric S. Raymond
346bcf9458 Magic-number elimination. 2017-07-02 13:22:50 -04:00
Jason S. Ninneman
73278b1a3c Bump save file version number.
Also add missing space in the version mesage.
2017-07-02 09:55:53 -07:00
Aaron Traas
589a1c92ad Test coverage: intransitive lock 2017-07-02 12:52:17 -04:00
Aaron Traas
dd50e7c9d3 Eliminate unreachable code in lock() 2017-07-02 12:52:17 -04:00
Aaron Traas
2d71fe8137 Add capabilities to cheat. Expand testing to cover. 2017-07-02 12:52:17 -04:00
Aaron Traas
7eaefce61d Moved application settings to settings_t struct
Since logfp, oldstyle, and prompt were application settings, rather than
have them all as global vars, move them to a single global var, seperate
from game state, as they aren't, technically, game state, but are
application settings.
2017-07-02 12:52:17 -04:00
Jason S. Ninneman
d23111daba Replace datime() with just time().
Also make the 'savetime' value meaningful.

This removes a separate library dependency on some systems.
2017-07-02 09:46:01 -07:00
Eric S. Raymond
fb8ba08986 Change VERSION_SKEW message - save file cersion is now...
...decoupled from program version.
2017-07-02 12:43:29 -04:00
Eric S. Raymond
d3b525212b Documentation polishing. 2017-07-02 11:19:29 -04:00
Eric S. Raymond
ea963d4af8 Documentation polishing. 2017-07-02 11:01:32 -04:00
Eric S. Raymond
1d41d9a2f8 Begin decomposing cond magic numbers. 2017-07-02 10:55:02 -04:00
NHOrus
29672a6447 Fixed logic, documented it in notes and tests 2017-07-02 17:50:42 +03:00
NHOrus
e91742e1b9 Fixed regression in #21 Cleaned up logic of light/extinguish 2017-07-02 10:16:13 -04:00
NHOrus
73af0e3a55 Fix for issue #21, hopefully 2017-07-02 10:16:13 -04:00
NHOrus
4c32714997 really capture it 2017-07-02 10:16:13 -04:00
NHOrus
8ec7c9d576 Capture current state of bugs, for #21 2017-07-02 10:16:13 -04:00
NHOrus
a5478639b6 Capture wonkyness of extinguishing urn 2017-07-02 10:16:13 -04:00
NHOrus
664b4cf4d7 more tests 2017-07-02 10:16:13 -04:00
NHOrus
e65132a108 Ability to use non-standard FreeBSD gcov tool 2017-07-02 10:16:13 -04:00
NHOrus
634cd0f17f Make include of dependency platform-generic 2017-07-02 10:16:13 -04:00
Aaron Traas
3d3cd4ba39 Localize scope for restore file pointer in main. 2017-07-02 02:28:58 -04:00
Aaron Traas
22a557efb1 Coverage -- version command 2017-07-02 02:22:52 -04:00
Aaron Traas
85f8334e17 centralize calls to make_zzword()
make_zzword() now called in set_seed(), because the only times it was
called in the entire application is after every invocation of set_seed().
2017-07-02 02:02:09 -04:00
Aaron Traas
be115e9567 Fixed -r option. Added test to make sure it doesn't break later. 2017-07-02 01:36:28 -04:00
Aaron Traas
70838f7001 Changed usage message to multi-line string for cheat 2017-07-02 01:17:14 -04:00
Aaron Traas
f815299a2a make_zzword() moved to initialize. Pruned unused stuff from cheat.c 2017-07-02 01:07:53 -04:00
Eric S. Raymond
6c822610c5 Improve test coverage. 2017-07-01 23:51:24 -04:00
Eric S. Raymond
a6954db376 Rewrite dwarf-encounter ceck so coverage testing sees all predicates. 2017-07-01 23:33:57 -04:00
Eric S. Raymond
4f08537e2d More magic-number elimination. 2017-07-01 23:07:23 -04:00
Eric S. Raymond
5c2b76f762 Magic-number elimination. 2017-07-01 22:50:08 -04:00
Wayne Conrad
16688c6d8f Fix typo in data comments 2017-07-01 19:12:05 -04:00
Wayne Conrad
76e3e27f66 Fix typo in notes 2017-07-01 19:12:05 -04:00
Eric S. Raymond
f1b37ea163 Supply missing implementation of nodwarf bit in travel rules. 2017-07-01 19:11:24 -04:00
Eric S. Raymond
0aa70d04cf Another step in de-obscurifying the travel code. 2017-07-01 19:11:24 -04:00
Jason S. Ninneman
e05f959974 Refactor specials[] to have strings instead of enum references.
Clean up arbitrary_messages[] accordingly.
2017-07-01 11:53:54 -07:00
Eric S. Raymond
e57d9d514c Minor refactor - create an equality function to simplify skip logic. 2017-07-01 14:07:23 -04:00
Jason S. Ninneman
e66b4561d4 Never write the input prompt to log files. 2017-07-01 11:04:21 -07:00
Eric S. Raymond
50bbbbceee Forther break apart the magic enconding of travel arrays. 2017-07-01 12:51:12 -04:00
Eric S. Raymond
c98668c529 Remove debris from a misclick. 2017-07-01 12:40:12 -04:00
Eric S. Raymond
0d0b8df0a3 Ignore l g z i under oldstyle. 2017-07-01 12:35:31 -04:00
NHOrus
3c8482a613 Change state of vase
Clear temporary save where it needs to be cleared instead of random places
2017-07-01 18:25:39 +03:00
NHOrus
ab79fc7814 Do not compare state to magic numbers 2017-07-01 18:25:39 +03:00
NHOrus
b8d86b840d Little more less magic in dragon state 2017-07-01 18:25:39 +03:00
Eric S. Raymond
9355882cac Documentation polishing. 2017-07-01 11:01:06 -04:00
Jason S. Ninneman
d529a14356 Ensure libedit is installed for the pipeline jobs. 2017-07-01 07:29:53 -07:00
Jason S. Ninneman
b3828c8edc Attempt to unbreak pipeline. 2017-07-01 07:27:37 -07:00
Jason S. Ninneman
dec4cf3968 Jettison the -s option.
It's no longer needed since libedit doesn't have the 'paste bug'.
2017-07-01 07:22:53 -07:00
Jason S. Ninneman
98f019b9e4 Remove the linenoise submodule. 2017-07-01 07:22:53 -07:00
Jason S. Ninneman
5fcebc66ae Move most build instructions into INSTALL.adoc. 2017-07-01 07:22:53 -07:00
Jason S. Ninneman
c69355f08a Update documentation about the libedit conversion. 2017-07-01 07:22:53 -07:00
Jason S. Ninneman
ad3b097c9e Replace linenoise with libedit in code and build. 2017-07-01 07:22:53 -07:00
Eric S. Raymond
f47f3a4603 Magic-number elimination for dragon and rug. 2017-07-01 10:01:39 -04:00
NHOrus
45820bc8cd Reindend, compile out all save stuff 2017-07-01 16:46:51 +03:00
NHOrus
8cc5ee5412 Put stuff back in init, C-style 2017-07-01 16:45:42 +03:00
Jason S. Ninneman
b3fb636149 Apply DEMOTE_WORD(). 2017-07-01 13:22:53 +00:00
Eric S. Raymond
ab94051da1 Magic-number and state-arithmetic removal. 2017-07-01 09:21:47 -04:00
Jason S. Ninneman
36a6cbca34 Add a DEMOTE_WORD() macro. 2017-07-01 06:18:24 -07:00
Jason S. Ninneman
2328739e51 Interim magic number replacement. 2017-07-01 06:15:54 -07:00
Eric S. Raymond
065caace64 Move PRNG initialization to simplify cheat.c 2017-07-01 08:59:45 -04:00
NHOrus
0a87fc9f78 Spread documentation from init.c It was empty without anything to document. Reindented, too 2017-07-01 08:53:03 -04:00
NHOrus
7f2c118e56 Cut initialize in favor of implicit/default initialization where possible 2017-07-01 08:53:03 -04:00
NHOrus
562569f33c Putting cleanup in the right place, too 2017-07-01 15:39:37 +03:00
NHOrus
b0705ba0bb Fix make debug check 2017-07-01 15:39:37 +03:00
Eric S. Raymond
58b44313d3 Without IGNORE, -Wunused-result throws a warning on fread(2).
I've seen it happen on fwrite(2) as well; wrapping that as well in
case some compiler decides to be finicky.
2017-07-01 08:35:05 -04:00
Eric S. Raymond
9714bf8c82 Magic-number elimination. 2017-07-01 01:59:06 -04:00
NHOrus
062840db69 Test modification for little more coverage 2017-06-30 23:26:18 -04:00
NHOrus
c83df10dc6 Stop leaking memory 2017-06-30 23:26:18 -04:00
Jason S. Ninneman
8bc08773fa Various cleanups.
* Remove disused macro.
* GCC doesn't seem to mind if IGNORE() is left off.
* Enumify phase codes.
* Use EXIT_* macros in all exit() calls.
* How did this even work without extern?
* Give advent.h a much-needed makeover.
* Use the chomp indicator in YAML string blocks to avoid code ugliness.
2017-07-01 03:19:33 +00:00
Aaron Traas
31f27b672c Error message when you make if without retrieving git modules yet 2017-06-30 20:49:44 -04:00
Eric S. Raymond
ba9e933f20 Use YAML block-literal syntax to avoid wrapped lines.
In vspeak(), andle text with extra trailing \n.
2017-06-30 16:33:31 -04:00
Jason S. Ninneman
030fa6d27d The bugtype enum doesn't need explicit numbers. 2017-06-30 13:25:12 -07:00
NHOrus
94ea37d2bc Plugged little linenoise memory leaks. 2017-06-30 21:42:37 +03:00
Eric S. Raymond
e10637c419 Implement and document %V escape so version only needs to be set once. 2017-06-30 14:35:18 -04:00
Jason S. Ninneman
40acab43af Remove disused function definitions. 2017-06-30 11:08:54 -07:00
Jason S. Ninneman
4fe9b94db4 Remove more disused macros. 2017-06-30 11:05:37 -07:00
Jason S. Ninneman
d9d089bdcc Remove some disused stuff. 2017-06-30 10:56:38 -07:00
Eric S. Raymond
39a25f8ec7 Magic-number elimination. 2017-06-30 13:30:49 -04:00
NHOrus
d6dab20801 Removed line as redundant
As of 8675c4facd lines 612-613 in main.c unreachable due to earlier
dispatch at line 1132 that redirects all find/inventory verbs into actions.c
Message NEARBY fires from YAML link to those verbs.
Also, reduced signature of playermove() to motion only.
2017-06-30 13:28:29 -04:00
Eric S. Raymond
8675c4facd Less magical numbers. 2017-06-30 12:10:26 -04:00
Eric S. Raymond
2c41018358 Improve test coverage. 2017-06-30 12:06:41 -04:00
Eric S. Raymond
1f45966dec Magic-number ellimination, contiguity warnings, cleanup. 2017-06-30 12:06:41 -04:00
NHOrus
a48e0ff30e Tests for misc and main 2017-06-30 18:30:19 +03:00
Eric S. Raymond
51a4d7bd3a Remove gaps from arbitrary_messages, there are no more number sependencies.
Some spans within the list may still rely on contiguity.
2017-06-30 11:27:15 -04:00
NHOrus
a6d1f9228b Fixed previous test, added nibble more 2017-06-30 18:05:41 +03:00
Eric S. Raymond
46185a6e88 Magic-number elimination. 2017-06-30 11:03:57 -04:00
Eric S. Raymond
0bbfe6baf7 Fix date typo. 2017-06-30 10:46:59 -04:00
NHOrus
a0f5fa0e04 Last one test case 2017-06-30 12:27:11 +03:00
NHOrus
c1efa29510 Some more easy tests 2017-06-30 11:31:18 +03:00
Eric S. Raymond
4aa85d0068 Update illformed.chk for current YAML. 2017-06-29 18:27:14 -04:00
Eric S. Raymond
645d00c711 Deduce version from NEWS. 2017-06-29 18:25:45 -04:00
Eric S. Raymond
72b4e4b127 Update NEWS. 2017-06-29 17:54:30 -04:00
Eric S. Raymond
129226b58a Implement 'version' command. 2017-06-29 17:52:26 -04:00
Aaron Traas
aa1dd666a9 Test coverage -- fix regression 2017-06-29 17:22:00 -04:00
Aaron Traas
d0a868bd4a Test coverage - add lots more coverage from actions.c 2017-06-29 17:05:48 -04:00
Eric S. Raymond
78eee015e3 Not the best idea to try to rewach Don Woods for help any more. 2017-06-29 16:59:27 -04:00
Eric S. Raymond
4d1b1fa4ad Typo fix. 2017-06-29 16:46:36 -04:00
Eric S. Raymond
41d65c1cab Add Aaron Traas to credits. 2017-06-29 16:44:01 -04:00
Eric S. Raymond
50e059eff8 Start another round of magic_number removal, this time for motions. 2017-06-29 16:41:49 -04:00
Aaron Traas
ffb8393985 Documentation and comment cleanup.
Also, renove uused enums.
2017-06-29 16:37:07 -04:00
Eric S. Raymond
2bd3ea61c2 'd' had a collision; 'drop' vs ;down'. Remove from 'drop' synonyms. 2017-06-29 16:28:20 -04:00
Eric S. Raymond
21d959a5c2 Documentation polishing and minor test improvements. 2017-06-29 16:25:55 -04:00
NHOrus
0f15c9e0f3 Breaking one-line conditionals 2017-06-29 22:51:30 +03:00
Eric S. Raymond
3001fb1dc1 Re-indented. 2017-06-29 15:45:59 -04:00
Jason S. Ninneman
3f580acc05 Clean out the now-disused vocabulary structure. 2017-06-29 15:30:33 -04:00
Aaron Traas
e7d1388c42 Updated documentation 2017-06-29 15:30:22 -04:00
Aaron Traas
ffdda21739 Cleanup test case 2017-06-29 15:30:22 -04:00
Aaron Traas
02ece8f874 Coverage - Die while closing after lamp dim 2017-06-29 15:30:22 -04:00
NHOrus
97f307c912 k2 is dead 2017-06-29 21:35:44 +03:00
NHOrus
d48504f22f Untangling variable reuse 2017-06-29 21:35:44 +03:00
NHOrus
5697a8de63 Separate debugging of linenoise 2017-06-29 21:23:04 +03:00
Eric S. Raymond
58a8a761e2 Fix an OB1 bug in allocation. 2017-06-29 13:43:36 -04:00
NHOrus
bf2fa227f0 Unshadowed k2 into k3 in main.c
Reindented everything
2017-06-29 20:11:53 +03:00
Jason S. Ninneman
5f44fccf4d Upstream linenoise rebased their project. 2017-06-29 09:34:23 -07:00
Eric S. Raymond
da27ae1932 Transition to YAML is done, adventure.text and travel.py can go away. 2017-06-29 12:21:50 -04:00
Eric S. Raymond
2b8b1b0130 Comment polishing. 2017-06-29 12:18:55 -04:00
Jason S. Ninneman
1ee0e5c7b0 Finish newdb -> dungeon renaming. 2017-06-29 08:54:55 -07:00
Jason S. Ninneman
db281a96d7 newdungeon.py is now make_dungeon.py.
newdb.[ch] is now dungeon.[ch].
2017-06-29 08:54:35 -07:00
Jason S. Ninneman
074d2c8a0f Remove MAPLIN(). Fold common.[ch] into other files and remove them. 2017-06-29 08:54:35 -07:00
Jason S. Ninneman
83fb64b5a8 Jettison MAKEWD(), GETTXT(), vocab(), GETIN(), and the old db compiler. 2017-06-29 08:54:35 -07:00
Aaron Traas
c4ceca3db9 Coverage - Test going back when you can't. 2017-06-29 10:57:34 -04:00
Aaron Traas
a434192373 Fixed automated testing 2017-06-29 10:16:41 -04:00
Aaron Traas
a4de450bfa Add make target for coverage 2017-06-29 10:16:40 -04:00
Eric S. Raymond
d43854f0f6 Simplify conditional evaluation when processing travel opcodes. 2017-06-29 08:46:29 -04:00
Eric S. Raymond
289f72e078 Address GitLab issue #16: make dist produces incomplete tarball 2017-06-29 07:05:11 -04:00
Jason S. Ninneman
50435465a6 Completely wire vocab words in YAML to the code.
This massive patch:
* Finishes working all the vocab words into YAML structures.
* Adds vocab ID generator functions.
* Redoes the input-getting system, removing the need for GETIN(),
  GETTXT(), etc.
* Changes advent<->ascii mapping to avoid the special 'shift'
  character.
* Works around some bad behavior in the dragon attack logic.
* Handles the reservoir magic word without changing the database
  contents.
2017-06-29 01:59:37 -07:00
Eric S. Raymond
9d918edeaa Eliminate some promiscuous variable reuse.
This was making the opcode-conditional evaluation logic much more
difficult to read than it needed to be.
2017-06-28 21:06:36 -04:00
Eric S. Raymond
7281c39807 Improve documentation if the *most* obscure span of code. 2017-06-28 20:24:29 -04:00
Aaron Traas
6150e3be1f Make clean now removes cheat binary 2017-06-28 17:30:46 -04:00
Eric S. Raymond
d96d5db51f More magic-number removal. 2017-06-28 17:29:33 -04:00
Eric S. Raymond
b5260417dd Magic-number elimination. 2017-06-28 17:07:15 -04:00
Eric S. Raymond
1ed8126912 Implement and document state-changes messages in YAML.
Examples at the lamp and grate.  This is a way to pull strings out of
arbitrary_messages and make them part of the object definition.
2017-06-28 16:14:23 -04:00
NHOrus
aca6d79087 Some more linter warnings 2017-06-28 15:09:05 -04:00
Aaron Traas
b729853e7a Removed advent.info and added to .gitignore
advent.info is a generated file. No need to keep it in the repo.
2017-06-28 13:41:53 -04:00
Aaron Traas
60847652aa Test coverage: make LCOV ignore code unreachable without interactive shell 2017-06-28 13:23:34 -04:00
Aaron Traas
6521d49c07 Test coverage: make LCOV ignore bug() and all calls to BUG()
In theory, these should be unreachable, so they shouldn't be covered
with testing.
2017-06-28 13:23:34 -04:00
Aaron Traas
94aca03203 Test coverage: make LCOV ignore sig_handler and OOM check 2017-06-28 13:23:34 -04:00
Eric S. Raymond
d5942e1732 More test repairing. 2017-06-28 13:21:31 -04:00
Eric S. Raymond
783e2e5e2d Repair test breakage from previous commit. 2017-06-28 13:18:07 -04:00
Eric S. Raymond
f6267ff3eb Test consolidation. 2017-06-28 13:03:45 -04:00
Eric S. Raymond
533f737cb3 Merge two tests so the suite can run a little faster. 2017-06-28 12:54:50 -04:00
Jason S. Ninneman
e336aaed0e Update linenoise. 2017-06-28 09:14:57 -07:00
Eric S. Raymond
a1af74b534 Declare one-letter synonyms for some commands.
As issue #6 (Add single-letter verb synonyms) says:

Modern interactive fiction has converged on a fairly standard
vocabulary of one-letter abbreviations for common verbs. Besides
directional commands, they are:

d - drop
g - get
i - inventory
l - look
x - examine (synonymous in ADVENT with look)
z - wait

Open Adventure should implement these.

This commit doesn't make them work yet, but it declares them for when the
lexical analyzer is fully YAML-driven.
2017-06-28 12:05:41 -04:00
Eric S. Raymond
f5719f1aba Magic-number elimination. 2017-06-28 11:45:53 -04:00
Aaron Traas
eb89cd5b4e Cleaned up tests/Makefile - added save generation to its own target 2017-06-28 10:57:28 -04:00
Aaron Traas
6152e35afd Test coverage: command-line options for advent 2017-06-28 10:57:28 -04:00
Aaron Traas
3b780dd57e Test coverage -- 100% cheat for real this time 2017-06-28 10:57:28 -04:00
Eric S. Raymond
ceb5c27218 Comment polishing. 2017-06-28 10:51:47 -04:00
Eric S. Raymond
27bc9f3bd2 De-macroize references to travel opcode fields we won't unpack further. 2017-06-28 09:21:41 -04:00
Eric S. Raymond
db68e0097e Break travel array into three struct fields. 2017-06-28 08:53:24 -04:00
Eric S. Raymond
aace0b1359 More macro abstraction of the travel opcodes. 2017-06-28 08:26:36 -04:00
Eric S. Raymond
fb35c34171 After splitting out the stop field, nothing ever negates a travel opcode...
...so all those labs() calls can go away.
2017-06-27 22:15:22 -04:00
Eric S. Raymond
8560122f01 Break travel opcodes into a two-element structure. 2017-06-27 22:11:58 -04:00
Eric S. Raymond
d53f125555 All travel[] references are now wrapped in extractor/predicate macros.
This is a step toward pulling the magic numbers apart into data structures
so there will be fewer magic numbers in the code.
2017-06-27 21:55:29 -04:00
Eric S. Raymond
f6cd34f778 Begin abstracting out the magic properties of travel-array opcodes. 2017-06-27 21:46:07 -04:00
Eric S. Raymond
e49ba9fb2b Remove unused enums. 2017-06-27 20:11:21 -04:00
Eric S. Raymond
45384f6bf2 More use of state labels. 2017-06-27 20:10:59 -04:00
Eric S. Raymond
d891b883b9 Minor refactoring step. 2017-06-27 19:44:20 -04:00
Eric S. Raymond
b3b6314fa4 More use of state labels. 2017-06-27 17:27:42 -04:00
Eric S. Raymond
ed4e6ad422 Allow state labels in not clauses. 2017-06-27 16:54:58 -04:00
Aaron Traas
6fe8f98b35 Test Coverage - elicit hints for grate and snake 2017-06-27 16:13:49 -04:00
Aaron Traas
1e643da216 Remove unused code 2017-06-27 16:13:49 -04:00
Aaron Traas
4592a24350 Test coverage -- additional coverage in actions.c 2017-06-27 16:13:49 -04:00
Aaron Traas
7b1eb1ec58 buildregress now generates save files correctly. 2017-06-27 16:13:49 -04:00
Aaron Traas
2781413fa9 100% coverage of cheat.c 2017-06-27 16:13:49 -04:00
Aaron Traas
0a30176a8c Allow cheat to generate save files with bogus numbers.
Also remove pre-built save file for resumefail.log
2017-06-27 16:13:49 -04:00
Aaron Traas
7392603b7d "cheat" now has command-line arguments for generating cheat files
-d number of deaths. Signed integer value
-s number of saves. Signed integer value
-o file name of save game to write
2017-06-27 16:13:49 -04:00
Eric S. Raymond
894b3de949 Travel tables are all done from YAML now.
Leaves only Section 4 from asventure.text still relevant.
2017-06-27 16:11:13 -04:00
Eric S. Raymond
4ff3d497b6 This looks like it gets the terminators right. 2017-06-27 13:23:30 -04:00
Eric S. Raymond
d53bc1c54c travel is correct except for position of terminators. 2017-06-27 12:22:01 -04:00
Jason S. Ninneman
37373c5277 Documentation polishing. 2017-06-26 22:27:44 -07:00
Eric S. Raymond
20a645bdf4 Move the travel rule documentation to newdungeon.py. 2017-06-27 01:18:34 -04:00
Jason S. Ninneman
57a8e6f19a Update linenoise from upstream. 2017-06-26 22:08:29 -07:00
Jason S. Ninneman
7dc8839249 Abolish VOCWRD().
Action word mnemonics are now enums from adventure.yaml.
2017-06-26 22:07:24 -07:00
Jason S. Ninneman
2aa5f1dd61 Remove actspk[]. 2017-06-26 22:04:02 -07:00
Jason S. Ninneman
004fe76917 Clean up missed actspk[] references. 2017-06-26 22:03:42 -07:00
Jason S. Ninneman
a76cbeccbb Use actions[].message instead of actspk[]. 2017-06-26 22:01:23 -07:00
Jason S. Ninneman
c080ea85bb Add missing declaration. 2017-06-26 22:01:13 -07:00
Jason S. Ninneman
4d21247643 Express actions[] in newdb.[ch]. 2017-06-26 21:53:24 -07:00
Jason S. Ninneman
6d123b3fb1 Combine actspk and the action words into a single structure. 2017-06-26 21:36:24 -07:00
Eric S. Raymond
64959e4bce This version of newdungeon.py can exactly recover Section 3...
...from the YAML data. Next, to pack the recovered data the way
dungeon.c does and wite it in.
2017-06-26 22:41:57 -04:00
Jason S. Ninneman
f9edfc5151 Reexpress the motion words in adventure.yaml. 2017-06-26 22:22:51 -04:00
Eric S. Raymond
4b2472fb16 First cut at compiling travel rules from YAML.
Not fully wired in yet.
2017-06-26 22:15:05 -04:00
Eric S. Raymond
6b86811fbc Repair variois problems in travel YAML. 2017-06-26 22:13:22 -04:00
Eric S. Raymond
0fad8a25ba Repair a missing travel element it YAML.
Got left off due to an edge condition in travel.py.
2017-06-26 17:31:04 -04:00
Jason S. Ninneman
70bfd3f5a3 Update cheat.c to unbreak the build. 2017-06-26 13:40:38 -07:00
Eric S. Raymond
d6cb6f0d8d Create a cheater to test strange save/resume cases.
Patch due to Aaron Traas, but needed modification because of code
drift since submission.
2017-06-26 15:07:09 -04:00
Jason S. Ninneman
5581175840 Jettison some disused macros. 2017-06-26 11:30:46 -07:00
Jason S. Ninneman
6ac098170c Use enums for object number mnemonics instead of VOCWRD() calls. 2017-06-26 11:27:27 -07:00
Jason S. Ninneman
0bab67e106 Fold object vocab words into the objects[] structure. 2017-06-26 10:25:01 -07:00
Jason S. Ninneman
2fac8d1aef object_descriptions[] is now objects[]. 2017-06-26 09:43:11 -07:00
Jason S. Ninneman
d40085ce6f Add vocab length define to newdb. 2017-06-26 09:43:11 -07:00
Eric S. Raymond
fe46e5ab0c Squash a compiler warning. 2017-06-26 12:15:55 -04:00
Eric S. Raymond
d612b0e6ca Change the name of the KEY array to avoid an upcoming macro clash. 2017-06-26 10:44:19 -04:00
Eric S. Raymond
59243cf8bc Take FORTRANish upper-case function names to C-style lowercase...
...except for a few we're planning to get rid of.  This will avoid some
upcoming collisions with macros defined from YAML.
2017-06-26 10:19:33 -04:00
Eric S. Raymond
b626371b6c Wire Section 8 YAML to runtime. 2017-06-26 00:09:50 -04:00
Eric S. Raymond
3025388932 Subsume Section 8 into YAML. 2017-06-25 23:41:36 -04:00
Jason S. Ninneman
1503be7567 Remove duped const keywords. 2017-06-25 20:22:38 -07:00
Jason S. Ninneman
4f6bc949bd Fix typo and type mismatch. 2017-06-25 20:20:44 -07:00
Jason S. Ninneman
4ac41aa148 Expose a vocabulary[] array in newdb.c. 2017-06-25 20:18:39 -07:00
Jason S. Ninneman
7ee571d832 Inline the hint messages. 2017-06-25 18:50:47 -07:00
Eric S. Raymond
e424588682 Unsnarl the motion code some more. 2017-06-25 20:50:41 -04:00
Eric S. Raymond
0c54875118 Begin toounsnarl the way the TRAVEL array is used. 2017-06-25 19:22:46 -04:00
Eric S. Raymond
6d571c18b8 Magic-number elimination. 2017-06-25 19:22:46 -04:00
Eric S. Raymond
f165aabad8 Capture Section 3 in YAML.
The temporary script travel.py emitted this YAML from the Section 3 data.
It will be removed when the compilation from YAML to an initializer is done.
2017-06-25 19:22:46 -04:00
Eric S. Raymond
bbfc8eb57a A step forward in definining YAML for the travel array. 2017-06-25 19:22:46 -04:00
Jason S. Ninneman
9301a4f419 Deal with some compiler warnings. 2017-06-25 12:54:22 -07:00
Eric S. Raymond
4821aeff60 Comment polishing. 2017-06-25 13:54:07 -04:00
Eric S. Raymond
81be19238c Fix a report of conpile-time error. 2017-06-25 13:31:19 -04:00
Eric S. Raymond
d809974479 Dix off-by-one errors induced by tightening some array bounds. 2017-06-25 13:17:35 -04:00
Eric S. Raymond
8a3757df59 Change structure of vocabulary YAML to cope with multiply-loaded words. 2017-06-25 12:36:40 -04:00
Eric S. Raymond
cfb43fcf44 Add some sanity checking to newdungeon.py. 2017-06-25 09:25:44 -04:00
Eric S. Raymond
23680e3441 Comment polishing in adventure.yaml. 2017-06-25 08:18:06 -04:00
Eric S. Raymond
71ebe01af7 Vocabulary (adventure.txt section 4) is now in YAML...
...but no code to use that structure yet.
2017-06-25 08:08:25 -04:00
Eric S. Raymond
f8b30c1ec6 Proof of concept for Section 3 report generator. 2017-06-25 07:12:05 -04:00
Eric S. Raymond
8a6e6aae7d Fully subsume section 7 into YAML. 2017-06-24 20:28:22 -04:00
Eric S. Raymond
39eed7d678 Remove unused error codes. 2017-06-24 12:59:08 -04:00
Eric S. Raymond
2755eed5a2 Move the description of string escapes to where the strings now live. 2017-06-24 12:49:25 -04:00
Eric S. Raymond
e9e747cffb Remove unused code. 2017-06-24 12:43:31 -04:00
Eric S. Raymond
1ec3ef3855 Section 13 is now all YAML, so objsound.py can go. 2017-06-24 12:24:56 -04:00
Eric S. Raymond
5ba7973ca7 Improve comments, eliminate magic numbers. 2017-06-24 12:22:25 -04:00
Eric S. Raymond
3e19c39f57 Give generate constant arrays the const specifier.
Also, move the adventure.txt format documentation to dungeon.c to be
removed when that file is.
2017-06-24 11:07:07 -04:00
Eric S. Raymond
c3a2816821 Replace magic MINTRS/MAXTRS with a treasure attribute in YAML. 2017-06-24 10:47:59 -04:00
Eric S. Raymond
25077d0b4e LOCSIZ -> NLOCATIONS, finishing limit-name cleanup. 2017-06-24 10:20:36 -04:00
Eric S. Raymond
64035d0026 More fixed limits (NOBJECTS, LOCSIZ) stop being fixed. 2017-06-24 10:18:33 -04:00
Eric S. Raymond
985137d9c7 Rationalize names of structure array sizes.
Everything that camn be #define become one, in all caps to signify that
it's a constant.
2017-06-24 09:55:32 -04:00
Eric S. Raymond
07207420a2 Elimination of OBJTXT.
This means eveything in Section 13 of adventure.text has moved to YAML.
2017-06-24 09:41:39 -04:00
Eric S. Raymond
0c2803638f Correct buggy behavior of sign in endgame. Add a test for this. 2017-06-24 09:30:15 -04:00
Eric S. Raymond
2c9c9076b1 Extend test coverage. read sign in endgame. 2017-06-24 09:15:40 -04:00
Eric S. Raymond
3a93b2b5f0 Elimination of OBJSND. 2017-06-24 09:08:48 -04:00
Eric S. Raymond
606b590c1e Extend test coverage of vending-machine actions. 2017-06-24 08:06:42 -04:00
Eric S. Raymond
e8e84a24a6 Improve test coverage. 2017-06-23 23:30:17 -04:00
Eric S. Raymond
ea70341cfe Eliminate setting of OBJTXT sell for oyster - OBJTXT is now static.
A necessary step towards getting rid of it.
2017-06-23 15:50:15 -04:00
Eric S. Raymond
15b7c00e0a Abolish unclean operation on OBJSOUND - it's now static.
Save/Restore no longer needs to treat it specially.
2017-06-23 15:13:47 -04:00
Eric S. Raymond
ecff53d3a8 Name the lamp, grate, and bird states. 2017-06-23 14:59:32 -04:00
Eric S. Raymond
2848494a01 Proof of cobcept for state defines.
It is now possible in the YAML to declare defines for all state values
associated with an object.  This are visible in the C code and can be used
to replace magic numbers.
2017-06-23 14:07:44 -04:00
Eric S. Raymond
6bd1c356e2 Documentation polishing. 2017-06-23 11:27:20 -04:00
Eric S. Raymond
1e8c3a4a1d Support loud locations. 2017-06-23 11:16:37 -04:00
Eric S. Raymond
f47dc9f447 Location sounds are now declared by YAML. 2017-06-23 10:10:48 -04:00
Eric S. Raymond
98b7434b0b objsound.py: add a (temporary) YAML transformer for translating Section 13.
This will go away after it's applied/
2017-06-23 09:19:50 -04:00
Eric S. Raymond
8dd70624d1 Add YAML markup for location sounds. 2017-06-23 07:54:49 -04:00
Eric S. Raymond
44abab29e3 Toss unused parts of dungeon.c and init.c 2017-06-22 22:33:24 -04:00
Eric S. Raymond
6c6c72f327 Replace macros with condition bits. 2017-06-22 18:41:25 -04:00
Eric S. Raymond
51494657fd Give the FORCED property a real cond bit. Delete some unused code. 2017-06-22 17:49:06 -04:00
Eric S. Raymond
7f7f49b739 Switch fully over to YAML generation of condition bits. COND is gone. 2017-06-22 17:28:39 -04:00
Eric S. Raymond
537c4511e2 Generate initializer from YAML for Section 9 bits. 2017-06-22 16:45:38 -04:00
Eric S. Raymond
94d1aa5183 Use YAML references to tie hints to locations.
This change makes locbit.py obsolete; it's deleted.
2017-06-22 14:27:22 -04:00
Jason S. Ninneman
3215930f64 Fixups to the adventure.yaml commentary. 2017-06-22 14:16:33 -04:00
Eric S. Raymond
e4b2877733 Location YAML now has conditions.
COND initionalization doesn't use these yet. That's the next step.
2017-06-22 11:59:41 -04:00
Eric S. Raymond
3f7a25cdf2 locbit.py: Can't set a FORCED attribute in the YAML...
...it has to be computed from the travel arrays.
2017-06-22 11:24:00 -04:00
Eric S. Raymond
b8c240f4b1 Repair a check file. 2017-06-22 11:14:42 -04:00
Eric S. Raymond
4aa006368d Check in the tool for folding Section 9 COND bits into YAML.
Needs to be in the repo history for reference, though it won't
be manifest after the conversion.

We shouldn't actually apply this until the murk around FORCED has been
dispelled.
2017-06-22 09:46:09 -04:00
Eric S. Raymond
9c7c23b75a Improve namespace hygiene. 2017-06-22 08:58:11 -04:00
Eric S. Raymond
6277b45d6b Patch around non-working pillo bug fix. 2017-06-22 07:24:45 -04:00
Jason S. Ninneman
97241e87d7 Quick-fix the 'pillo bug'.
Once parsing no longer depends on text being broken up into
5-char tokens, the ugly hack to adventure.yaml must go away.
2017-06-21 22:43:16 -07:00
Eric S. Raymond
433e787de8 Simple fix for GitLab issue #14: Behaviour of magic words changed
Say "Nothing happens" on "foo" not in Giant Room, rather than "What's
the matter, can't you read?  Now you'd best start over." which only
makes sense there.

It would be funnier to say something like "Well, that was remarkably
pointless." Maybe later.
2017-06-21 17:23:28 -04:00
Eric S. Raymond
fd6da15373 Fix GitLab issue #13 - The "eat" command exhibits strange behavior
The problem wasn't actually with "eat" but with "grate".  Processing
of any two-word command with an object of "grate", when given at certain
locations including the start, inappropriately jumped directly
to the movement code (ignoring the verb).

There was a similar bug in the ancestral 2.5, though it manifested slightly
differently.
2017-06-21 16:54:10 -04:00
Eric S. Raymond
6dbe6f081c Revert "Test coverage - Almost all of score.c". It's breaking tests. 2017-06-21 16:43:27 -04:00
Eric S. Raymond
7ed1e95441 Revert "Test coverage - 100% score.c". It's breaking tests. 2017-06-21 16:37:59 -04:00
Aaron Traas
f4d3f6def9 Test coverage - 100% score.c 2017-06-21 15:12:53 -04:00
Aaron Traas
236abc8cab Test coverage - Almost all of score.c 2017-06-21 15:04:41 -04:00
Aaron Traas
3c8530663d xstrdup() not called anywhere in source. Removed. 2017-06-21 13:50:13 -04:00
Jason S. Ninneman
79ffdb36f0 Switch to 0-indexing for hint handling code. 2017-06-21 10:26:23 -07:00
Jason S. Ninneman
c8f6ff3701 Abolish HNTMAX and HNTSIZ in favor of HINT_COUNT.
This change necessitated include guards on newdb.h.
2017-06-21 10:25:12 -07:00
Peje Nilsson
deb61e3dcd Replace SETPRM/[PR]SPEAK with variadic [pr]speak
Rename/rewrite old speak to vspeak and take a va_list
Add new speak that takes variadic parameters

Remove SETPRM & PARMS[]
2017-06-21 13:14:53 -04:00
David James Sherman
82f162dc32 Resolve GitLab issue #3. Applies MISRA and CERT guidelines.
MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case

MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
literal suffix

CERT DCL16-C. - Use "L," not "l," to indicate a long value

CERT DCL16-CPP. - Use "L," not "l," to indicate a long value

CERT, DCL50-J. - Use visually distinct identifiers
2017-06-21 13:14:53 -04:00
Aaron Traas
67ed99b29c Test Coverage -- lots of new pieces of actions.c 2017-06-21 12:14:24 -04:00
Eric S. Raymond
22613f06fa Documentation polishing. 2017-06-21 11:58:58 -04:00
Eric S. Raymond
c3a71f6db6 Documentation and polishing. 2017-06-21 11:45:16 -04:00
Eric S. Raymond
ddb0df85b3 YAMLify section 11 (hints). 2017-06-21 11:22:18 -04:00
Eric S. Raymond
b37f9f4b2d Document the YAML, remove some dead code, fix typos. 2017-06-21 07:39:10 -04:00
Eric S. Raymond
f6373dd32e Section 10 (class thresholds) is now parsed entirely from YAML. 2017-06-21 06:17:20 -04:00
Eric S. Raymond
e798355e80 Further code simplification. 2017-06-20 20:44:21 -04:00
Eric S. Raymond
237f1a876f Code simplification. 2017-06-20 20:39:45 -04:00
Eric S. Raymond
358fdd437b Chage read handler argument to by-value.
This (sort of) documents the fact that, unlike say() and attack(),
read() never scribbles on the interpreter's command block.

What those other functions are doing is unclean - though less so than
fully exposed globals. I don't see a way to fix it that isn't pretty
intrusive, alas.
2017-06-20 20:24:30 -04:00
Eric S. Raymond
9437ccca36 WD* globals abolished. They're now members of the command block. 2017-06-20 20:06:32 -04:00
Jason S. Ninneman
9714c9fc2a Fix another ob1 error. 2017-06-20 19:26:55 -04:00
Jason S. Ninneman
1e59d6b476 Clean out some disused variables. 2017-06-20 19:26:55 -04:00
Jason S. Ninneman
acc07e1287 Fix off-by-one error. 2017-06-20 19:26:55 -04:00
Jason S. Ninneman
d029b08ad1 Refactor how turn threshold penalties are accounted for. 2017-06-20 19:26:55 -04:00
Aaron Traas
89de4e4602 Test coverage -- more corner cases in actions.c 2017-06-20 18:43:19 -04:00
Eric S. Raymond
7a3f3ec7a6 Introduce command encapsulation structure. 2017-06-20 17:40:41 -04:00
Jason S. Ninneman
6c4f140333 Refactored dungeon generator. 2017-06-20 14:31:35 -07:00
Jason S. Ninneman
4f042d0ca4 Clean up adventure.yaml. 2017-06-20 14:30:56 -07:00
Jason S. Ninneman
9cda8ad2e2 Don't exit on EOF from get_input(). 2017-06-20 13:43:46 -04:00
Aaron Traas
53fd6348b9 Test coverage - more corner cases in actions.c 2017-06-20 13:39:42 -04:00
Eric S. Raymond
e37f858b08 Comment polishing. 2017-06-20 13:38:11 -04:00
Eric S. Raymond
f50e984cec Add test for "cage bird". 2017-06-20 09:32:35 -04:00
Eric S. Raymond
521033165b Polish help text. 2017-06-20 08:41:06 -04:00
Eric S. Raymond
73f3831294 Add -l to coverage testing. 2017-06-20 08:34:01 -04:00
Eric S. Raymond
62ab37d3e9 Documentation update. 2017-06-20 08:20:34 -04:00
Eric S. Raymond
018ca9ae37 Fix off-by-one error that enabled the fuzzer to find a crash hole.
One has to allocate space for the trailing NUL, too.
2017-06-20 07:20:03 -04:00
Eric S. Raymond
d747d43429 Test logic for lamp dimming triggering battery replacement. 2017-06-20 06:52:52 -04:00
Peje Nilsson
4b93fb327a Merge branch 'master' into magic-number 2017-06-20 00:06:49 +02:00
Jason S. Ninneman
6ecd001093 Fix typo and compiler warning. 2017-06-19 14:49:15 -07:00
Jason S. Ninneman
ba64c57eb0 Add token_to_packed() utility function. 2017-06-19 14:45:32 -07:00
Peje Nilsson
c84d370918 Merge branch 'master' into magic-number 2017-06-19 23:44:48 +02:00
Peje Nilsson
f9be57a9f9 Cleanup Arithmetic on message number 2017-06-19 23:44:03 +02:00
Aaron Traas
9c88649cd4 Test coverage More misuse of transitive verbs 2017-06-19 17:33:32 -04:00
Aaron Traas
7ae0782b25 Test coverage - failure to fill 2017-06-19 17:33:32 -04:00
Aaron Traas
08c0524ee3 Test coverage -- intransitive carry when one object is present 2017-06-19 17:33:32 -04:00
Aaron Traas
7753ad3134 Test coverage - drink with no valid object 2017-06-19 17:33:32 -04:00
Eric S. Raymond
a678b68b39 Mostly confine assumptions about what token_t is to misc.c
The token_t things like WD* are presently longs and will someday be
char[6].  By introducing some trivial functions - wordeq(),
wordempty(), and wordclear() - we mostly hide the difference.

All runtime knowledge about packing now lives only in misc.c and the
list of magic WORD_* defines in advent.h.  Outside this, literals are
now accessed through #define names that could expand to either longs
or strings.

Still to be done: WD* values are sometiimes compated to zero in
ways implying they can be negative. Must figure out wat thus means.
2017-06-19 17:21:45 -04:00
Eric S. Raymond
87961483a2 Concentrate all magic-number values for packed-string constants in one place. 2017-06-19 16:53:55 -04:00
Eric S. Raymond
79f5701e07 More semantic typing - a step towards eliminating packing. 2017-06-19 14:20:45 -04:00
Aaron Traas
f4ac82b9f8 Really 100% test coverage for saveresume.c 2017-06-19 13:55:04 -04:00
Aaron Traas
43247f995b Should have 100% coverage on saveresume.c now 2017-06-19 13:55:04 -04:00
Eric S. Raymond
ef100a3102 Publish more things on the website. 2017-06-19 13:21:15 -04:00
Eric S. Raymond
0eb85f233a Boolify some logical variables. 2017-06-19 13:21:15 -04:00
NHOrus
e9aff2568f Even less magic 2017-06-19 20:18:20 +03:00
Aaron Traas
18a9be501f Save/resume fail test coverage -- test works in Docker now 2017-06-19 13:09:15 -04:00
NHOrus
a8a7c50691 -r doesn't show with NOSAVE build 2017-06-19 19:29:00 +03:00
NHOrus
93a76e9d2f No need to tease with excluded options 2017-06-19 19:11:07 +03:00
Eric S. Raymond
f84c5033e9 Revert "Improved test coverage -- save/resume fail"
Fails in GitLab CI - looks like /dev/badfilename can actually be opened there.
2017-06-19 11:37:03 -04:00
Aaron Traas
e5b6f71d7a Improved test coverage -- save/resume fail 2017-06-19 11:24:46 -04:00
Eric S. Raymond
4c100261c4 Magic-number elimination. 2017-06-19 11:09:24 -04:00
Eric S. Raymond
d46407d327 Magic-number elimination. Fix possible glitch in troll-bridge death. 2017-06-19 11:00:23 -04:00
Eric S. Raymond
28f9fd59bb Add axeorama log, extending test coverage. 2017-06-19 10:32:58 -04:00
Eric S. Raymond
0b91efc9eb Restructure some code. 2017-06-19 09:46:04 -04:00
Eric S. Raymond
10e53a419e L12 is gone again. Magic numbers have been almost eliminated. 2017-06-19 08:43:51 -04:00
Eric S. Raymond
98b02eeeb1 Magic number elimination, repair some careless replace damage. 2017-06-19 08:37:19 -04:00
Eric S. Raymond
df86aa283b Documentation tweak. 2017-06-19 07:41:59 -04:00
Peje Nilsson
2fe36df4e2 Remove goto L12 - take two
On't know if you let me near this code again but here is a second
stab at removing "goto L12"

Previous attempt failed because of trying to continue the outer
do{}while(false)
Adding an extra for(;;) loop where the only repeat is the former
"goto L12" is replaced by continue. All other exits are returns
and a break;
2017-06-19 07:33:40 -04:00
Eric S. Raymond
c2df849dad Improve test coverage. 2017-06-19 07:33:40 -04:00
Jason S. Ninneman
0f3d3f735f Reorganize debug build options.
* 'make advent' by itself can be considered the 'release' build.
* 'make debug' now does 'make linty'.
2017-06-18 21:11:06 -07:00
Eric S. Raymond
d250b51030 Get usage message into coverage tests. 2017-06-18 23:31:59 -04:00
Jason S. Ninneman
06e8d5a83e Abolish MAXDIE in favor of maximum_deaths. 2017-06-18 20:02:03 -07:00
Jason S. Ninneman
803d2b6ef9 Clean old obit messages from adventure.yaml. 2017-06-18 19:59:43 -07:00
Jason S. Ninneman
fecc48e6e5 Remove message pointer math in croak(). 2017-06-18 19:54:48 -07:00
Jason S. Ninneman
624ba16aad Change YES() to take const char* arguments. 2017-06-18 19:51:59 -07:00
Jason S. Ninneman
9229fdf2a3 Give obituary messages their own data structure. 2017-06-18 19:44:35 -07:00
Eric S. Raymond
bba2af13d5 Typo fix. 2017-06-18 22:35:03 -04:00
Eric S. Raymond
7675b52562 More repairs on search-replace results. 2017-06-18 22:31:58 -04:00
Eric S. Raymond
962054cc26 Fix search-and-replace error. 2017-06-18 22:24:16 -04:00
Eric S. Raymond
fa9b6d317f No longer restricted to 6-character FORTRAN identifiers. 2017-06-18 21:17:57 -04:00
Eric S. Raymond
83ff9d0c0e Attempt to deconfuse the coverage analyzer. 2017-06-18 20:33:36 -04:00
Eric S. Raymond
fd02259c7f Reindent and cleanup. 2017-06-18 20:24:37 -04:00
Eric S. Raymond
5341a3e2ee Add project logo. It'll have to do until we find an image of a miner's lamp. 2017-06-18 20:09:39 -04:00
Bob Little
04eca720d9 magic numbers, show usage, fixed linty warnings
Show usage when using bad parameter with ./advent
Converted magic numbers to enums for BUG().  Also bug now shows
stringify'ed version of bug enumeration (not just a number).
2017-06-18 19:33:21 -04:00
Jason S. Ninneman
65e2e472dd Fix bug that made YES() case-sensitive.
Also fix a related memory leak.
2017-06-18 14:14:13 -07:00
Jason S. Ninneman
550734fd3f Gut and rebuild YES() with cleaner approach that doesn't rely on packing.
The new support functions get_input() and echo_input() (and others not made yet) will eventually replace GETIN() and MAPLIN().
2017-06-18 13:39:59 -07:00
Eric S. Raymond
0dd961701f This should get test coverage to 93%. 2017-06-18 16:39:01 -04:00
Eric S. Raymond
2622a9835a Improve test coverage. 2017-06-18 16:27:12 -04:00
Eric S. Raymond
00514b0793 Improve test coverage. 2017-06-18 16:08:09 -04:00
Eric S. Raymond
83330fc0fd Improve test coverage 2017-06-18 15:50:52 -04:00
Eric S. Raymond
67bf87eda0 Repair plover teleport and add a test for it. 2017-06-18 15:05:17 -04:00
Eric S. Raymond
2b89225ecd Extent test coverage to plover room access. 2017-06-18 14:15:54 -04:00
Eric S. Raymond
409ffe4a86 Code simplification. 2017-06-18 14:02:24 -04:00
Eric S. Raymond
ba5c7dacb5 Remove unused code. 2017-06-18 13:20:04 -04:00
Jason S. Ninneman
672ef17d4c Rename newspeak() to speak(). 2017-06-18 10:06:14 -07:00
Eric S. Raymond
704b86afbb Refactor scoring so score() does not conditionally exit. 2017-06-18 12:51:05 -04:00
Eric S. Raymond
f66cb0cdae Improve test coverage. 2017-06-18 11:55:10 -04:00
Eric S. Raymond
957c78d0c2 Improve test coverage. 2017-06-18 11:36:03 -04:00
Eric S. Raymond
23cc7b45be Improve test coverage. 2017-06-18 11:14:44 -04:00
Eric S. Raymond
f862f9f1d5 Improve test coverage. 2017-06-18 10:55:09 -04:00
Eric S. Raymond
35a1aff8dc Improve test coverage. 2017-06-18 10:03:40 -04:00
Eric S. Raymond
937714f31d Magic-number limination. Improve test coverage. 2017-06-18 09:44:34 -04:00
Eric S. Raymond
d363a5c564 Trying again to repair tests. 2017-06-18 09:13:35 -04:00
Eric S. Raymond
8371a5d5a1 Repair tests. 2017-06-18 09:08:55 -04:00
Eric S. Raymond
6333544efb Simplify code, improve test coverage. 2017-06-18 08:57:08 -04:00
Eric S. Raymond
9e1143e780 Improve test coverage. 2017-06-18 07:41:40 -04:00
Eric S. Raymond
f704580d89 Improve test coverage. 2017-06-18 07:26:59 -04:00
Eric S. Raymond
c8dbb241e8 Rxtend test coverage, remove magic numbers. 2017-06-18 07:11:20 -04:00
Eric S. Raymond
ff7db8b0c8 Improve test coverage, simplify code. 2017-06-18 06:41:16 -04:00
Eric S. Raymond
b3057f038b Re-format to consistent indent style with "make indent". 2017-06-18 06:18:51 -04:00
NHOrus
a37e578f63 Compile switch to disable save and restore 2017-06-18 10:37:51 +03:00
Bob Little
d844c2a391 Added 'linty' target for make
"make linty" does lots of error checking while compiling.
Simplified the standard make's CFLAGS.
Cleaned up code to eliminate resulting warnings generated by "make linty".
2017-06-17 22:28:40 -04:00
Eric S. Raymond
d92da99106 Improve test coverage. 2017-06-17 20:43:23 -04:00
Eric S. Raymond
516980dc6e Test two defeat cases. 2017-06-17 20:02:41 -04:00
Eric S. Raymond
900822d38f Magic-number elimination. 2017-06-17 19:39:25 -04:00
Bob Little
a3485d2a41 Move a few prototypes and static'ed a few functions
Moved prototypes for initialise() and action() from main.c to advent.h
Made the following functions static, so they wouldn't require prototypes:
   sig_handler (main.c)
   spotted_by_pirate (main.c)
   light (actions.c)
2017-06-17 18:19:09 -04:00
Eric S. Raymond
14c83ede8e Tweak formatting. 2017-06-17 12:13:20 -04:00
Eric S. Raymond
d587a5951b Experiment with reindenting. 2017-06-17 12:04:26 -04:00
Eric S. Raymond
13f2e85535 Correct a message. 2017-06-17 11:09:55 -04:00
NHOrus
a0a35d8c7b Improved docs, fixed identation 2017-06-17 11:09:55 -04:00
NHOrus
32fdd08d9b Little cleanup of variable names 2017-06-17 17:48:12 +03:00
NHOrus
300d246179 Resume from file on startup 2017-06-17 09:20:42 +03:00
Eric S. Raymond
51a88bec4d Address GitLab issue #11: trivial patch for macports/osx requirements 2017-06-17 01:22:08 -04:00
Bob Little
a73620cca5 Added dependency to newdb.h to make 'make -j' work 2017-06-16 22:17:40 -04:00
Eric S. Raymond
880d17042c Typo fix. 2017-06-16 16:20:36 -04:00
Eric S. Raymond
1596e6d81e Code simplification. 2017-06-16 15:58:51 -04:00
Eric S. Raymond
851f90cdf7 Improve test coverage. 2017-06-16 15:40:46 -04:00
Eric S. Raymond
0d373a6b87 Improve test coverage. 2017-06-16 15:27:25 -04:00
Eric S. Raymond
59a558b762 Code simplification. 2017-06-16 15:08:21 -04:00
Peje Nilsson
a6feda5307 Split saveresume to reduce complexity
Fixed a bug where current time was printed as version of advent
when loading an old savegame.
2017-06-16 14:16:02 -04:00
Peje Nilsson
adbbd1df25 Merge branch 'master' into actions-arithmetic 2017-06-16 17:43:14 +02:00
Eric S. Raymond
d7bb3f61eb Test coverage of -s and -l options. 2017-06-16 09:54:10 -04:00
Eric S. Raymond
3939cd4f96 Fix the mazehint log so it works. 2017-06-16 09:38:54 -04:00
Eric S. Raymond
349c51793c Improve test coverage. 2017-06-16 09:31:37 -04:00
Eric S. Raymond
efe898d783 Test throwing axe at bear. 2017-06-16 09:16:01 -04:00
Eric S. Raymond
4403d0b721 Improve test coverage. 2017-06-16 09:05:20 -04:00
Eric S. Raymond
d97574d35c Magic-number elimination. 2017-06-16 08:55:53 -04:00
Eric S. Raymond
1329da1087 Remove total-ordering assumption. 2017-06-16 08:39:01 -04:00
Eric S. Raymond
a57d93ce35 Magic-number elimination. 2017-06-16 07:00:57 -04:00
Eric S. Raymond
1b5ab6c808 Code simplification. 2017-06-16 06:44:22 -04:00
Peje Nilsson
d4fc7a88b4 Merge branch 'master' into actions-arithmetic 2017-06-16 10:10:38 +02:00
Peje Nilsson
9a32f4c770 Fix more arithmetic on locations & messages 2017-06-16 10:06:01 +02:00
Eric S. Raymond
7ccef92f7f Reduce verbosity. 2017-06-15 21:36:06 -04:00
Eric S. Raymond
eaee02aa09 Squasgh -Wextra warnings. 2017-06-15 19:39:43 -04:00
Eric S. Raymond
2182dc23ff Documentation polishing. 2017-06-15 17:58:52 -04:00
Eric S. Raymond
e34bd8acf6 Documentation polishing. 2017-06-15 17:39:53 -04:00
Eric S. Raymond
ec031b0417 Name another magic number. 2017-06-15 17:34:06 -04:00
Eric S. Raymond
d2b226b34c Add regression test for seed crash bug. 2017-06-15 16:58:48 -04:00
Eric S. Raymond
fc7f52f83f Don't do dwarf moves after a fallback command.
Avoids a crash bug.
2017-06-15 16:54:29 -04:00
Eric S. Raymond
0d5f9064c7 Comment fix. 2017-06-15 12:20:49 -04:00
Eric S. Raymond
14486d67d4 Magic-numnber elimination. 2017-06-15 12:19:06 -04:00
Peje Nilsson
a86c67c2ab Merge branch 'master' into actions-arithmetic 2017-06-15 17:33:15 +02:00
Eric S. Raymond
49edca485d More use of manifeat constants. 2017-06-15 11:15:45 -04:00
Peje Nilsson
29121a82f8 Fix arithmetic on message number 2017-06-15 17:01:10 +02:00
Eric S. Raymond
0dc78b4221 More use of manifest constants. 2017-06-15 10:59:43 -04:00
Eric S. Raymond
1896e0f886 Use symbolic shortnames for locations. 2017-06-15 10:31:26 -04:00
NHOrus
f1f7cfd4e9 Localizing variables 2017-06-15 16:16:21 +03:00
Eric S. Raymond
e5f9c4fbea Use LOC_* constants for locations. Clean up some ARB_* constants. 2017-06-15 08:49:47 -04:00
Eric S. Raymond
a141f021d5 Meaningful shortnames for RSPEAK messages. 2017-06-15 07:35:03 -04:00
Eric S. Raymond
1d37262a16 More ARB tagging. 2017-06-15 07:16:39 -04:00
NHOrus
98bf1bfcdd Improve test coverage 2017-06-15 09:49:29 +03:00
Bob Little
c4c28e10db dungeon now outputs just database.h
Added macro DEFINE_GLOBALS_FROM_INCLUDES to main.c
Makefile no longer has to deal with database.c and database.o
2017-06-14 21:54:49 -04:00
Jason S. Ninneman
1322a347ae Put the long and short location descriptions into a 'locations' data structure.
They're renamed 'small' and 'big' to avoid colliding with C reserved words.
2017-06-14 16:45:49 -07:00
Eric S. Raymond
da883d53c0 Clean up remnant magic labels. 2017-06-14 17:41:01 -04:00
Eric S. Raymond
fef9657e3e Move from random message numbers to ARB_* symbols generate from YAML. 2017-06-14 17:36:30 -04:00
Eric S. Raymond
f38f286f39 Document build-time dependencies. 2017-06-14 17:12:00 -04:00
Eric S. Raymond
08cf3065ea Repair a checkfile. 2017-06-14 17:03:06 -04:00
Jason S. Ninneman
be2ada4d93 Fix some Makefile glitches. 2017-06-14 13:54:37 -07:00
Jason S. Ninneman
73c9b59507 Use Python 3's pip. 2017-06-14 13:54:37 -07:00
Jason S. Ninneman
37197a800a Update pipeline for python3 and PyYAML. 2017-06-14 13:54:37 -07:00
Jason S. Ninneman
79926f7cfc git-ignore newdb.[ch]. 2017-06-14 13:54:37 -07:00
Jason S. Ninneman
88da6e72a5 Run python3 explicitly at build. 2017-06-14 13:54:37 -07:00
Jason S. Ninneman
60126c3dac Generate newdb.[ch] at build time, parallel with database.[ch].
Having two data compile jobs is a temporary situation. Eventually newdb.[ch] will supersede database.[ch].
2017-06-14 13:54:37 -07:00
Jason S. Ninneman
178c7ff983 Remove newdb.[ch] from version control. 2017-06-14 13:54:37 -07:00
Jason S. Ninneman
0e9e45f1b7 New dungeon compiler to gradually replace the existing one. 2017-06-14 13:54:37 -07:00
Eric S. Raymond
c818a10f28 Add test for feeding ogre. 2017-06-14 16:53:45 -04:00
Eric S. Raymond
a48d75b999 Improve test coverage. 2017-06-14 16:35:10 -04:00
NHOrus
46bb20deb3 Lowering the scope And cleaning up some warnings from static analysis 2017-06-14 15:17:02 -04:00
Eric S. Raymond
7c9a0bfb36 Fix handling of intransitive "say". 2017-06-14 15:15:00 -04:00
Eric S. Raymond
6c6498b797 Eliminate magic return value. 2017-06-14 13:35:06 -04:00
Eric S. Raymond
4993be4c08 Include LCG state in game saves. 2017-06-14 13:00:28 -04:00
Eric S. Raymond
fdd72c6417 Fix a minor memory leak. 2017-06-14 08:50:41 -04:00
Eric S. Raymond
cad701f54d Add statistic on coverage extent. 2017-06-14 08:47:24 -04:00
Peje Nilsson
b6db1731ed Run the rm in the same subshell 2017-06-14 08:32:06 -04:00
Eric S. Raymond
7af0c7b059 Repair and simplify complicated pirare-robbery logic.
I think we previously mistranslated this in a way that didn't show up
because it would only manifest if you found the penultimare treasure
without encountering the pirate.

This version is much easier to understand.
2017-06-14 08:26:49 -04:00
Eric S. Raymond
d0f943f4fb Extend test coverage to novice mode. 2017-06-14 06:41:04 -04:00
Eric S. Raymond
b24670f4bc Increase test coverage. 2017-06-14 06:34:43 -04:00
Eric S. Raymond
5d8275c147 Increase test coverage. 2017-06-14 06:02:42 -04:00
Eric S. Raymond
a6657a53e9 Improve test coverage. 2017-06-14 05:44:45 -04:00
Eric S. Raymond
9344b8b329 De-FORTRANize the code. 2017-06-14 05:36:55 -04:00
Eric S. Raymond
473bdfaa2a Code simplification. 2017-06-13 20:06:07 -04:00
Eric S. Raymond
c3453db345 Use more C-like naming conventions for variables. 2017-06-13 19:17:24 -04:00
Eric S. Raymond
dc6a5751ed Magic-number elimination. 2017-06-13 18:54:53 -04:00
Eric S. Raymond
d61cab352e Makere magic numbers for cond bits into symbols. 2017-06-13 18:38:04 -04:00
Eric S. Raymond
70b5b191fd More tests of nonsense in the forest. 2017-06-13 17:48:05 -04:00
Eric S. Raymond
dcf4d5f1d3 Correct a typo, and a test for the affected verb. 2017-06-13 17:32:07 -04:00
Eric S. Raymond
8718a6c1da Typo fix. 2017-06-13 17:13:38 -04:00
Eric S. Raymond
c5d2d9ddb5 Add test for urn actions. 2017-06-13 17:02:52 -04:00
Eric S. Raymond
bd35d47139 Fix compiler warnings. 2017-06-13 14:33:19 -04:00
Jason S. Ninneman
bfa06be62d Fix all the simple compiler warnings. 2017-06-13 11:19:58 -07:00
Jason S. Ninneman
34621b054a Max out compiler warnings, and rearrange the debug build recipe. 2017-06-13 11:19:58 -07:00
NHOrus
2d1e089caf Remove shadowing of variable 2017-06-13 21:12:16 +03:00
NHOrus
a52f6b4d47 Test for regression from before localizing SPK 2017-06-13 20:49:01 +03:00
Eric S. Raymond
7493b26e6c Improve test coverage. 2017-06-13 13:36:27 -04:00
Eric S. Raymond
e07cedf332 Documentation improvements. 2017-06-13 13:13:30 -04:00
Eric S. Raymond
1a12a3acf2 Move awqy from FORTRANISH conditionals. 2017-06-13 12:47:34 -04:00
Eric S. Raymond
34db08ce06 Typo fixes. 2017-06-13 12:25:19 -04:00
Eric S. Raymond
fa74e8054b Explain the prompting logic more fully. 2017-06-13 12:18:46 -04:00
Eric S. Raymond
9a2618963f Fix a minor bug in -l operation. Explain the input logic. 2017-06-13 11:59:49 -04:00
Eric S. Raymond
6166d687b9 Code simplification. 2017-06-13 11:28:53 -04:00
Eric S. Raymond
c9abf8243c Code simplification. 2017-06-13 11:12:38 -04:00
Eric S. Raymond
95e8752252 More test coverage. 2017-06-13 10:57:03 -04:00
Eric S. Raymond
897fe621ec More test coverage of odd cases. 2017-06-13 10:43:06 -04:00
Eric S. Raymond
a3c14ba077 Abolish setup check, there's no possibility of restart.
Note, this silently breaks old saves.
2017-06-13 10:20:15 -04:00
Eric S. Raymond
593b8e3caa Add woods hint and hint display to test coverage. 2017-06-13 10:05:48 -04:00
Eric S. Raymond
6c1eadcd67 Arrange test coverage of reincarnation code. 2017-06-13 09:48:32 -04:00
Eric S. Raymond
760e2e3282 Remove more unused code. 2017-06-13 09:42:18 -04:00
Peje Nilsson
89829f45be Speling misstakes 2017-06-13 09:40:11 -04:00
Eric S. Raymond
fb93f9d67e Remove now-unused code. 2017-06-13 09:35:39 -04:00
Peje Nilsson
b373ba447d Cleanup leftover comments 2017-06-13 13:27:44 +00:00
Eric S. Raymond
cbf027c28b Further increase test coverage. 2017-06-13 09:26:54 -04:00
Eric S. Raymond
7018354e22 Improve regression-test coverage. 2017-06-13 09:18:24 -04:00
Eric S. Raymond
8a46a60c8c Documentation update. 2017-06-13 08:37:36 -04:00
Eric S. Raymond
43f0c07f1a Update docs to track Peje's latest patch. 2017-06-13 08:30:49 -04:00
Peje Nilsson
169c683e45 Refactor part of dwarfmove to remove goto jumpout 2017-06-13 14:18:06 +02:00
Eric S. Raymond
60ab7a63dc Comment polishing. 2017-06-13 08:15:01 -04:00
Eric S. Raymond
6a6d9ca14e Address GitLab issue #10: Spurious '>' characters appearing in console output
The prompt logic has become unpleasantly complicated.
2017-06-13 08:03:27 -04:00
Eric S. Raymond
9e08cba63e Adjust for Peje Add Peje Nilsson to credits. 2017-06-13 07:49:53 -04:00
Peje Nilsson
a7c0f331d1 Remove L19999 2017-06-13 07:41:08 -04:00
Eric S. Raymond
3bdab31a0d Improve slightly on Peje's L12 patch, changing documentation to match. 2017-06-13 07:36:57 -04:00
Eric S. Raymond
804e60ccff More documentation updates. 2017-06-13 07:20:05 -04:00
Peje Nilsson
c366ddb733 Relocate L12
With a bit of code duplication the L12 label can be moved outside
the loop.
2017-06-13 07:41:09 +02:00
Eric S. Raymond
1b167e5e72 New notes.adoc file; major documentation update. 2017-06-12 22:05:44 -04:00
Jason S. Ninneman
bc1dd279e2 Don't output disused dungeon data. 2017-06-12 14:44:33 -07:00
Jason S. Ninneman
6b75d87797 Remove some hard-coded array dimensions. Generate CLSSES at compile time.
(How did this ever even work without 'extern'?)
2017-06-12 21:36:07 +00:00
Jason S. Ninneman
90b9b84797 Clean up function argument. 2017-06-12 21:36:06 +00:00
Jason S. Ninneman
ca0e042952 Use strdup() instead of strncpy(). 2017-06-12 21:36:06 +00:00
Eric S. Raymond
a044f10411 Turn MOD from function to macro.
I experimented with expanding it to ((N % M) everywhere, but in context
the MOD(N, M) notation seems easier to read.
2017-06-12 17:33:21 -04:00
Eric S. Raymond
66c22301ed Add -s option.
Re-enables pasting multiline sequences to the > prompt (for making checkfiles).
2017-06-12 16:51:35 -04:00
Eric S. Raymond
a02b387999 FORTRAN line numbers returned from action() become action symbols. 2017-06-12 14:42:04 -04:00
Eric S. Raymond
d85ef403af Refactor main command loop to eliminate L2000. 2017-06-12 09:42:43 -04:00
Eric S. Raymond
1c4097314a Eliminare L8 label. 2017-06-12 09:28:11 -04:00
Eric S. Raymond
b560b0f597 Eliminate L8 label. 2017-06-12 09:24:11 -04:00
Eric S. Raymond
57f2dfb28f Factor out logic for listing objects at present location. 2017-06-12 09:01:21 -04:00
Eric S. Raymond
d7ae7efd30 Refactor hinting logic to pull more code out of mainline. 2017-06-12 08:31:32 -04:00
Eric S. Raymond
bd6e402512 Closing-time check factored out. 2017-06-12 08:15:58 -04:00
Eric S. Raymond
73d5310839 Reformat for readability. 2017-06-12 08:07:49 -04:00
Eric S. Raymond
b0eb54b125 More goto elimination. 2017-06-12 08:03:10 -04:00
Eric S. Raymond
c04fa7e446 Goto elimination. 2017-06-12 07:58:24 -04:00
Eric S. Raymond
696779d337 K successfully localized. 2017-06-12 06:47:10 -04:00
Eric S. Raymond
95f1548a10 Allow direct object to persist across turns. 2017-06-12 06:26:58 -04:00
Eric S. Raymond
c0a450c4d6 Localize K. 2017-06-12 06:13:00 -04:00
Eric S. Raymond
5535c509eb Narrow scope of K. 2017-06-12 06:09:34 -04:00
Eric S. Raymond
cfcb1a6ec6 Fix uninitialized-variable warning. 2017-06-12 05:28:28 -04:00
Eric S. Raymond
e723b7e462 SPK is abolished. 2017-06-12 02:10:14 -04:00
Eric S. Raymond
ac88b9c7e1 More SPK localization. 2017-06-12 01:45:01 -04:00
Eric S. Raymond
a101fc8679 SPK localization. 2017-06-12 01:28:20 -04:00
Eric S. Raymond
d80abbce02 K localization. 2017-06-12 00:30:45 -04:00
Eric S. Raymond
80c0c10221 Localize K to main.c 2017-06-12 00:21:14 -04:00
Eric S. Raymond
1f7a1bc8fd Localization moves for K. 2017-06-12 00:10:07 -04:00
Eric S. Raymond
04db837075 Update TODO. 2017-06-11 22:07:12 -04:00
Eric S. Raymond
a062d43079 SPK is no longer global. 2017-06-11 22:04:14 -04:00
Eric S. Raymond
e2ebc24114 Continue localization of SPK (not yet complete). 2017-06-11 21:58:21 -04:00
Eric S. Raymond
7485a8a1e1 Limit visibility of ugly globals. 2017-06-11 21:07:53 -04:00
Eric S. Raymond
32b04f190e Clean up compiler warnings. 2017-06-11 18:57:07 -04:00
Jason S. Ninneman
4ae8585802 Massive whitespace update to the test output.
(With one minor exception: the 'pillow' problem.)
2017-06-11 15:43:38 -07:00
Jason S. Ninneman
5ed0cc0fe9 Change 'drop pillow' to 'drop pillo' to make the test pass while we sort out a minor bug. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
bcfecca1a1 Fix broken unpacking algorithm.
Also trim trailing whitespace.
2017-06-11 15:42:25 -07:00
Jason S. Ninneman
a2e0c55fb4 Abolish SPEAK(). 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
8a18f2f19f Fix spacing problem. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
e81bd6de8f Add missing function prototypes. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
25d98f6dab Working first draft of newspeak(). 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
f715091db6 Get plural replacement working. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
5de9c7132d Partially-working newspeak(). 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
15ff262d17 More retrofitting. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
3178f5d994 Retrofit main.c for the new database and newspeak(). 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
c7ca4ee73c Retrofit RSPEAK() and PSPEAK(). 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
291ec54462 Check in dropped file. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
43032763cd Compile in the new (partial) database. 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
cdf6993a51 First crude version of newspeak(). 2017-06-11 15:42:25 -07:00
Jason S. Ninneman
639eff8b0b Remove handlers for disused advent format specifiers. 2017-06-11 15:42:25 -07:00
Eric S. Raymond
d6c707f6ac Test for the "break" verb. 2017-06-11 18:24:35 -04:00
Eric S. Raymond
b9eccc7aa2 Increase test coverage. 2017-06-11 17:41:29 -04:00
Eric S. Raymond
5a33ce3937 More test coverage. 2017-06-11 16:50:55 -04:00
Eric S. Raymond
1a4bf3abcd Improved test coverage. 2017-06-11 16:18:03 -04:00
Eric S. Raymond
e1f44a09fa Yet more goto elimination. 2017-06-11 15:19:49 -04:00
Eric S. Raymond
2576613759 Readability tweak. 2017-06-11 11:28:30 -04:00
Eric S. Raymond
bfda14305a Abolish 18999 return from actions(). 2017-06-11 11:25:31 -04:00
Eric S. Raymond
093415efc8 Abolish 2009 return. 2017-06-11 11:13:31 -04:00
Eric S. Raymond
c3222aef27 Abolish L2010. 2017-06-11 11:06:54 -04:00
Eric S. Raymond
8cdbf034a2 Code simplifications based on abolishing 2011. 2017-06-11 10:59:33 -04:00
Eric S. Raymond
5e5ad6b1aa Abolish 2011 return from actions. A step towards localizing SPK. 2017-06-11 10:12:58 -04:00
Eric S. Raymond
55610bb1de Questions for the future. 2017-06-11 09:24:52 -04:00
Eric S. Raymond
0dcd87202a More goto elimination. 2017-06-11 08:33:30 -04:00
Eric S. Raymond
3c78ff879b Clean up dummy macro arguments. 2017-06-11 07:29:29 -04:00
Eric S. Raymond
925aeab51b Yet more goto eliminations. 2017-06-11 07:24:42 -04:00
Eric S. Raymond
9b9eab70d8 Two goto eliminations. 2017-06-11 07:24:42 -04:00
Eric S. Raymond
9d072a8c44 One more goto-label pair gone. 2017-06-11 07:24:42 -04:00
Eric S. Raymond
9fbf52ff7e Six more gotoectomies. 2017-06-11 07:24:42 -04:00
Jason S. Ninneman
3ed8b91eb7 More SPEAK() hardening. 2017-06-10 19:00:54 -07:00
Jason S. Ninneman
7ce9f7270f Replace some spaces with tabs per the database spec. 2017-06-10 19:00:54 -07:00
Eric S. Raymond
39c1b4db81 Resolve a goto. 2017-06-10 21:09:14 -04:00
Jason S. Ninneman
a4da53086b Zero-index the lookup tables and the code that references them. 2017-06-10 15:34:21 -07:00
Jason S. Ninneman
e7906b4ca3 Replace advent character constants with lookups. 2017-06-10 15:27:38 -07:00
Jason S. Ninneman
b905b5fb0f Keep ascii_to_advent[] numeric. Using char literals was misleading. 2017-06-10 14:31:50 -07:00
Jason S. Ninneman
e586f7c61f Add missing common.c. 2017-06-10 13:52:50 -07:00
Jason S. Ninneman
1173a9a265 Use a header/source set common to both advent and the dungeon builder. 2017-06-10 13:37:26 -07:00
Eric S. Raymond
0e160a665e Documentaion polishing. 2017-06-10 14:55:48 -04:00
Eric S. Raymond
dd2a949730 Structuring move. 2017-06-10 14:24:34 -04:00
Eric S. Raymond
d3e84846d3 Readability fix. 2017-06-10 13:58:18 -04:00
Eric S. Raymond
b92fb66c44 Last goto removed from actions.c 2017-06-10 13:43:17 -04:00
Eric S. Raymond
f6da31f689 Just one label left in actions.c. 2017-06-10 13:31:48 -04:00
Eric S. Raymond
e6f183ba7f Use C idioms for increment/decrement. 2017-06-10 12:38:40 -04:00
Eric S. Raymond
d8e30c69c7 Date typo fix. 2017-06-10 07:20:26 -04:00
Eric S. Raymond
62e1fddd1d Cosmetic fix: blank line before filename prompt...
...in the style of the original.
2017-06-10 07:19:26 -04:00
Eric S. Raymond
9e8e0893dc Rewrite save/resume in idiomatic C. Savefile version bumped to 26. 2017-06-10 07:13:23 -04:00
Eric S. Raymond
3af993abca Isolate the grotty save/resume code. Most of it will soon go away. 2017-06-10 05:38:47 -04:00
Eric S. Raymond
4c5474121f Unbreak the tests.
linenoise doesn't eco its prompt to stdout, which messed them up.
2017-06-10 05:35:35 -04:00
Eric S. Raymond
63e971fc4c Enable input editing with the linenoise library. 2017-06-10 05:11:29 -04:00
Eric S. Raymond
037f1df7dd Change NAPLIN signature - prepration for linenoise. 2017-06-10 01:42:53 -04:00
Eric S. Raymond
9bac28878d Replace magic linenumbers with a clearer enum. 2017-06-10 00:23:28 -04:00
Eric S. Raymond
b22d6a65b9 More goto eliminations. 2017-06-09 17:22:20 -04:00
Eric S. Raymond
6319d27481 Whitespace fixes. 2017-06-09 17:14:18 -04:00
Eric S. Raymond
058e566e60 Whuirespace-only change. 2017-06-09 16:53:15 -04:00
Eric S. Raymond
b425de4f28 Continuing gotoicide. 2017-06-09 14:18:09 -04:00
Eric S. Raymond
c8ebabdf3b Still more gotoicides. 2017-06-09 13:49:19 -04:00
Eric S. Raymond
3c053367a5 Factor out player movement logic. 2017-06-09 13:36:39 -04:00
Eric S. Raymond
6862a92650 Another gotoicide. 2017-06-09 13:36:39 -04:00
Eric S. Raymond
d23235e902 Another gotoicide. 2017-06-09 13:36:39 -04:00
Jason S. Ninneman
bea58f2682 Render the ascii<->advent character code mappings to lookup tables. 2017-06-09 09:16:35 -07:00
Eric S. Raymond
2c33a29cf1 Replace an unstructured goto with a two-level break. 2017-06-09 12:09:47 -04:00
Eric S. Raymond
733312bdc7 Label and global-variable elimination. 2017-06-09 12:04:45 -04:00
Eric S. Raymond
64897f132e Abolish global variable I. 2017-06-09 11:53:02 -04:00
Eric S. Raymond
fd2155b2f2 Localize I. 2017-06-09 11:47:55 -04:00
Eric S. Raymond
db8dc40b84 Abolish a silly layer of macros. 2017-06-09 11:36:49 -04:00
Eric S. Raymond
b1fafc4d4d Eliminate an unused global. 2017-06-09 11:23:04 -04:00
Eric S. Raymond
0a4325ce45 Eliminate a global variable. 2017-06-09 11:19:47 -04:00
Eric S. Raymond
42b339a1b6 Abolish global variable L. 2017-06-09 11:14:04 -04:00
Eric S. Raymond
4df8fac952 Abolish global variable J. 2017-06-09 11:13:03 -04:00
Eric S. Raymond
2606284916 Remove objectioonable uses of global variables. 2017-06-09 10:39:12 -04:00
Eric S. Raymond
37117f20e0 Eliminate objectionable use of global. 2017-06-09 10:17:13 -04:00
Eric S. Raymond
9ecbfa2ca8 Reformat actions.c, no code changes. 2017-06-09 10:00:28 -04:00
Eric S. Raymond
54d22714d9 Suspend/resume handler. 2017-06-09 09:54:23 -04:00
Eric S. Raymond
652e4ed733 Mass goto removal. Switch now calls handlers directly. 2017-06-09 09:04:26 -04:00
Eric S. Raymond
dd9bbe1f00 Because (almost) everything is done in handlers now, merge the action files. 2017-06-09 08:54:03 -04:00
Eric S. Raymond
2abc833504 read() and reservoir() handlers. 2017-06-09 08:38:11 -04:00
Eric S. Raymond
f47745a7c4 Yet more action handlers. 2017-06-09 08:21:14 -04:00
Eric S. Raymond
08ed2af230 Action handler light(). 2017-06-09 07:55:55 -04:00
Eric S. Raymond
21adfe0807 More vocabulary handlers. 2017-06-09 02:12:59 -04:00
Eric S. Raymond
ff66456cb0 Add lock() handler. 2017-06-09 02:04:01 -04:00
Eric S. Raymond
50b30d0144 Handler for transitive extinguish. 2017-06-09 01:39:41 -04:00
John Boyle
dbe2acd864 Reassure compiler ("control may reach end of non-void function") 2017-06-08 22:50:48 -04:00
John Boyle
c8a2312755 Correct the definition of SETBIT.
The semantics were first changed in aef60929 (technically broken
in that commit as well).  Luckily, it seems not to be used much.
2017-06-08 22:50:48 -04:00
Eric S. Raymond
ebfe3e49fa Prepare for large goto elimination - whitesoace-only change. 2017-06-08 22:48:05 -04:00
Eric S. Raymond
e1176dbf9c Handler for SAY. 2017-06-08 18:49:36 -04:00
Eric S. Raymond
db29f53a9a More action handlers. 2017-06-08 18:24:15 -04:00
Eric S. Raymond
e7451b543d More handler refactoring. 2017-06-08 17:14:00 -04:00
Eric S. Raymond
ee20cd0861 More action handlers. Use consistent VO order. 2017-06-08 16:18:21 -04:00
Eric S. Raymond
1ca74bfc39 Beginning of actions1.c refactor. 2017-06-08 15:27:05 -04:00
Eric S. Raymond
7abe1c1784 Remove one last goto from actions2.c 2017-06-08 09:21:45 -04:00
Peje Nilsson
2ae280befb De-gotoified actions2.c functions. 2017-06-08 09:13:34 -04:00
Peje Nilsson
da76563f40 De-gotoize throw(). 2017-06-08 09:09:48 -04:00
Eric S. Raymond
e7576855df One more goto gone. 2017-06-08 08:26:10 -04:00
Eric S. Raymond
ecc6caab4e Factor out the croak() function for player death. 2017-06-08 08:15:35 -04:00
Eric S. Raymond
d48001d64c Yet more gotoectomy. 2017-06-08 08:02:55 -04:00
Eric S. Raymond
c9cc36c681 De-gotoize hint machine. 2017-06-08 07:49:27 -04:00
Eric S. Raymond
fc0c48f0f2 Factor out the state machine for hints. 2017-06-08 07:19:44 -04:00
Eric S. Raymond
75c2aa57aa Resolve a particularly gnarly foto in dwarfmove. 2017-06-08 06:44:25 -04:00
Eric S. Raymond
e3f3c86d1d Refactor of dwarfmove logic. 2017-06-08 06:25:52 -04:00
Eric S. Raymond
af453777d4 More gotoectomies. 2017-06-08 06:15:08 -04:00
Eric S. Raymond
897bb2cdb5 Clean up dwarfmove() 2017-06-08 05:52:32 -04:00
Eric S. Raymond
86e75219e3 Gotoectomy. 2017-06-08 05:21:20 -04:00
Eric S. Raymond
a8e8967814 More main.c cleanup. 2017-06-08 05:11:52 -04:00
Eric S. Raymond
30ac7894e7 De-gotoifying main.c 2017-06-08 05:01:51 -04:00
Eric S. Raymond
8bf31a9c19 Localize V1 and V2 in main.c 2017-06-08 04:31:06 -04:00
Eric S. Raymond
46cd836df0 Abolish funcs.h. 2017-06-08 04:25:20 -04:00
Eric S. Raymond
44639a9799 Repair linenoise build, add guidance to Makefile on getting it. 2017-06-08 03:38:18 -04:00
Jason S. Ninneman
2039192f05 Update the save/resume tests for linenoise. 2017-06-08 00:15:03 -07:00
Jason S. Ninneman
0f65f14b36 Remove .adv files with make clean. 2017-06-08 00:15:03 -07:00
Jason S. Ninneman
5bcb04b86d git-ignore .adv files. 2017-06-08 00:15:03 -07:00
Jason S. Ninneman
7e1ef875fc Use linenoise to get the save file name. 2017-06-08 00:15:03 -07:00
Jason S. Ninneman
955032bd24 Add database.o to the linker list. 2017-06-08 00:15:03 -07:00
Eric S. Raymond
b29678956e Localize K in fill(). 2017-06-08 03:12:07 -04:00
Eric S. Raymond
7e4753b23a De-gotoify feed(). 2017-06-08 03:03:00 -04:00
Eric S. Raymond
1386d2b157 De-gotoify carry(). 2017-06-08 02:43:40 -04:00
Eric S. Raymond
764ed291af Goto removal in actions2.c. 2017-06-08 02:33:03 -04:00
Eric S. Raymond
430b8e7d53 De-gotoify fill(). 2017-06-08 01:57:12 -04:00
Eric S. Raymond
a418ebb38c misc.c is goto-free. 2017-06-08 01:35:50 -04:00
Jason S. Ninneman
3674588968 Fix Makefile issue that broke 'make dist'. 2017-06-07 20:20:52 -07:00
Jason S. Ninneman
3d9885d24d The nuclear option. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
f840f39361 Getting desperate now. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
0b3fad94ca Fix YAML syntax. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
68ab090f17 Fix YAML syntax. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
cc92705891 Fix YAML syntax. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
82e134fdb0 Fix YAML syntax. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
9ab8b0d271 Another workaround. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
776fac4281 Use a workaround of Gitlab issue 2148.wq 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
5fda630380 Tell Gitlab to grab git submodules. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
41265e020c Update Makefile for linenoise. 2017-06-07 20:19:24 -07:00
Jason S. Ninneman
1b6a10e097 Submodularize the linenoise library. 2017-06-07 20:19:24 -07:00
Eric S. Raymond
d657db5f4b Yet another parallel make attempt.
Credit to Bob Little.
2017-06-07 23:04:44 -04:00
Eric S. Raymond
3425c712c7 Yet more gotoectomy. 2017-06-07 22:59:55 -04:00
Eric S. Raymond
680788eb97 The continuing cleanup of misc.c 2017-06-07 22:34:06 -04:00
Eric S. Raymond
ff36dff18f Attempt to repair GitLab build breakage. 2017-06-07 21:26:45 -04:00
Eric S. Raymond
a45f297dc7 Still more gotoectomy. 2017-06-07 19:22:41 -04:00
Eric S. Raymond
19b3ac4ccd More goto removal. 2017-06-07 19:10:39 -04:00
Eric S. Raymond
da5976dc8c More goto elimination in misc.c 2017-06-07 18:34:08 -04:00
Eric S. Raymond
7fa8757ad4 More misc.c cleanup. 2017-06-07 18:00:12 -04:00
Eric S. Raymond
beac8d7f41 Continuing cleanup of misc.c. 2017-06-07 16:39:59 -04:00
Eric S. Raymond
1d3a087c39 Partial misc.c gotoectomy. 2017-06-07 16:30:51 -04:00
Eric S. Raymond
ed80d6dd2f Move MAXDIE computation to dungeonmaker. 2017-06-07 15:33:22 -04:00
Eric S. Raymond
fa2fb48436 Localize K in score.c. 2017-06-07 15:20:19 -04:00
Eric S. Raymond
16d90e4c28 init.c is now real C. 2017-06-07 15:12:21 -04:00
Eric S. Raymond
1b59175d8d Scoring code is fully translated to C. 2017-06-07 15:00:16 -04:00
Eric S. Raymond
db4b972fc7 Reformat score.c like normal C, since it now almost is.
Still two gotos to get rid of.
2017-06-07 14:50:45 -04:00
Eric S. Raymond
7555eb7de3 Global-variable elimination. 2017-06-07 14:45:30 -04:00
Eric S. Raymond
73e8d7fd87 score.c begins to resemble actual C. 2017-06-07 14:39:51 -04:00
Eric S. Raymond
78f606c879 Goto elimination. 2017-06-07 14:26:46 -04:00
Eric S. Raymond
14fee6b979 Eliminate globals. 2017-06-07 14:03:33 -04:00
Eric S. Raymond
2deb1b9f7f Localize TK. 2017-06-07 10:38:18 -04:00
Eric S. Raymond
8a256a6e37 Narrow the scope of IGO. 2017-06-07 10:33:38 -04:00
Eric S. Raymond
48363ba536 Localize K2. 2017-06-07 10:25:59 -04:00
Eric S. Raymond
dad1df9796 Localize KK. 2017-06-07 10:23:06 -04:00
Eric S. Raymond
8d90b03ee4 Fully localize VERB. 2017-06-07 10:06:14 -04:00
Eric S. Raymond
0e3456069f Further narrow the scope of VERB. 2017-06-07 09:57:23 -04:00
Eric S. Raymond
cc618146e8 Localize a variable. 2017-06-07 09:46:25 -04:00
Eric S. Raymond
57104237ed Narrow the scope of VERB. 2017-06-07 09:39:04 -04:00
Eric S. Raymond
844cb05619 Prevent confusion between dungeonmaker and runtime variables. 2017-06-07 09:21:05 -04:00
Eric S. Raymond
b2c85b36f8 OBJ is completely localized. 2017-06-07 09:03:14 -04:00
Eric S. Raymond
aba35733e7 OBJ has become local in actions1.c and diesn't have to be saved. 2017-06-07 08:59:50 -04:00
Eric S. Raymond
f01cb89a76 Complete OBJ localization in actions2.c 2017-06-07 08:48:12 -04:00
Eric S. Raymond
df83a345a2 Continuing OBJ localization. 2017-06-07 08:41:46 -04:00
Eric S. Raymond
8f661598bc Yet more OBJ localization. 2017-06-07 08:39:12 -04:00
Eric S. Raymond
3079ebda95 Yet more OBJ localization. 2017-06-07 08:34:42 -04:00
Eric S. Raymond
f20b7f56fd Localize OBJ in throw(). 2017-06-07 08:32:06 -04:00
Eric S. Raymond
a5cef5208f Begin localizing OBJ. 2017-06-07 08:29:30 -04:00
Eric S. Raymond
4fe6286cc6 LOC pulled into game structure block. 2017-06-07 07:50:09 -04:00
Eric S. Raymond
a6432a4ed4 Fix allcapsed comment. 2017-06-07 07:40:44 -04:00
Eric S. Raymond
a38b61638c Global LL becomes local to command interpreter toplevel...
...and doesn't have to be saved.
2017-06-07 07:30:56 -04:00
Eric S. Raymond
2d95c3f4f5 Finish moving state arrays into game structure block. 2017-06-07 07:10:07 -04:00
Eric S. Raymond
3ba084480a Change name of dungeon maker - dual use of "compile" was confusing. 2017-06-07 06:47:01 -04:00
Eric S. Raymond
0b02763bf0 More collecting of globals. 2017-06-07 06:38:40 -04:00
Eric S. Raymond
c1f1f2f79f Magic-number cleanup. 2017-06-07 06:24:18 -04:00
Peje Nilsson
60a3a6d1fe Split init loop into separate loops based on size. 2017-06-07 06:18:25 -04:00
Eric S. Raymond
461575ef4c Bite the bullet - size siymbols have to be shared.
Otherwise we end up duplicating magic sizes and tey can drift apart.
2017-06-07 05:45:51 -04:00
Eric S. Raymond
7f4cff1188 Bring SETUP variable into game state block
Saved separately because the kogic around this variable looks
a bit dubious and may need review.
2017-06-07 05:24:48 -04:00
Eric S. Raymond
dda636bbc1 Pull more globals into the game state block. 2017-06-07 05:10:20 -04:00
Eric S. Raymond
91ad0185ff Move more globals into the game state block. 2017-06-07 01:12:49 -04:00
Eric S. Raymond
62ee15c892 Pack more globals into the game block structure. 2017-06-07 00:41:51 -04:00
Eric S. Raymond
bb78ca96ce Capture clock variables into the game-state block. 2017-06-07 00:15:31 -04:00
Eric S. Raymond
c68b92d9da More magic-number elimination, and some information hiding. 2017-06-07 00:05:03 -04:00
Eric S. Raymond
924157fa9f Information hiding. 2017-06-06 23:49:10 -04:00
Eric S. Raymond
ab04fe4d41 More more globals into the game state block. 2017-06-06 21:46:17 -04:00
Eric S. Raymond
07c0020a7a First step in game state encapsulation: the dwarf & pirate locations. 2017-06-06 21:34:11 -04:00
Eric S. Raymond
3b8122ae3a Magic-number elimination. 2017-06-06 21:06:16 -04:00
Eric S. Raymond
e4f8218d9c Gotoectomy+. 2017-06-06 20:32:00 -04:00
Eric S. Raymond
d8e8bc8e89 Gotoectomy. 2017-06-06 20:01:01 -04:00
Eric S. Raymond
4e1ab63322 Semantic types. 2017-06-06 18:22:24 -04:00
Eric S. Raymond
19553e69fc Goto elimination. 2017-06-06 14:41:03 -04:00
Eric S. Raymond
c1ee521f73 Begin to split undifferentiated longs into semantic types. 2017-06-06 14:28:27 -04:00
Eric S. Raymond
75bf848ecd Typo fix. 2017-06-06 13:52:08 -04:00
Eric S. Raymond
978168523a Magic-number elimination. 2017-06-06 11:12:00 -04:00
Eric S. Raymond
fd10d380df Abstract out NOBJECTS (formerly magic number 100). 2017-06-06 10:44:25 -04:00
Eric S. Raymond
00c0da471d Translate some loops out of FORTRAN. 2017-06-06 09:55:30 -04:00
Eric S. Raymond
4d6078d8a8 Replace homebrew IABS() with C kubrary labs(3). 2017-06-06 09:21:46 -04:00
Eric S. Raymond
1445c7ebcc MAPLIN is no longer called during setup phase. 2017-06-06 07:52:07 -04:00
Eric S. Raymond
0105b04ac2 More test coverage improvements. 2017-06-06 06:59:39 -04:00
Eric S. Raymond
31ecc4a8e3 Fix for parallel make. 2017-06-06 06:34:46 -04:00
Eric S. Raymond
738504d280 Properly include tests directory - must use find, not ls. 2017-06-06 06:18:09 -04:00
Eric S. Raymond
54eb0ac2cb Another test coverage extension. 2017-06-06 06:00:08 -04:00
Eric S. Raymond
456aa3d7b6 Should have been committee along with last change to illformed.log. 2017-06-06 05:44:35 -04:00
Eric S. Raymond
8003c6166c Note a dropped stitch. 2017-06-06 05:40:20 -04:00
Eric S. Raymond
3da812fdf6 Address GitLab issue #8: make check breaks.
Include tests in the generated tarball.
2017-06-06 05:38:24 -04:00
Eric S. Raymond
98a67dd50b Further extend test coverage. 2017-06-06 05:36:39 -04:00
Eric S. Raymond
7130265578 In tests, exercise the "go back" code. 2017-06-06 00:54:56 -04:00
Eric S. Raymond
7118f25d5a Add a small tool for making logs from checkfiles.
Useful because the context in checkfiles makes them easier to edit
than plain logfiles are.
2017-06-06 00:52:04 -04:00
Jason S. Ninneman
78f5cc9e6a Update the tests README. 2017-06-05 19:33:35 -07:00
Jason S. Ninneman
b2c774afeb Alphabetically sort the test file list.
This ensures that appropriately-named tests run in sequence. E.g., test.1.log, test.2.log, etc.
2017-06-05 19:21:08 -07:00
Jason S. Ninneman
990be32ac6 Add simple tests of save and resume. 2017-06-05 19:20:39 -07:00
Jason S. Ninneman
acc08b8a5c Get rid of tarballs with 'make clean'. 2017-06-05 14:06:30 -07:00
Jason S. Ninneman
5e85d65c79 git-ignore MANIFEST. 2017-06-05 14:06:14 -07:00
Eric S. Raymond
e50d41561c Add a bug warning. 2017-06-05 16:22:35 -04:00
Eric S. Raymond
b34aee7979 More hints. 2017-06-05 16:08:42 -04:00
Eric S. Raymond
bc33b1f554 Prevent spurious pipeline failure on GitLab. 2017-06-05 15:22:59 -04:00
Eric S. Raymond
1944e4c7ba Typo fix. 2017-06-05 14:57:38 -04:00
Eric S. Raymond
61c9a89d23 Re-spin 1.0: same code, repaired website. 2017-06-05 14:56:16 -04:00
Eric S. Raymond
4c9bf00c91 Project name consistency. 2017-06-05 14:43:04 -04:00
Eric S. Raymond
1b391ed6cc Restore Makefile productions needed for CI pipeline. 2017-06-05 14:27:58 -04:00
Eric S. Raymond
3e3dd13025 Release 1.0. 2017-06-05 14:08:12 -04:00
Eric S. Raymond
d1231f3953 Release preparation. 2017-06-05 14:06:39 -04:00
Jason S. Ninneman
8c56bbe91a Create the public directory first. 2017-06-05 10:47:15 -07:00
Jason S. Ninneman
06368fe091 Stop publishing anything to Gitlab Pages (except coverage). 2017-06-05 10:43:46 -07:00
Jason S. Ninneman
afba06504a Update the pipeline to produce a tarball of the source upon every commit.
Unfortunately, it's not possible to preserve previous tarballs from run to run.
2017-06-04 17:13:28 -07:00
Eric S. Raymond
2f9d798574 Simplification. 2017-06-04 18:54:33 -04:00
Eric S. Raymond
fadb722c59 Typo fix. 2017-06-04 18:53:30 -04:00
Eric S. Raymond
a6b2602b83 Deal wuth GNU tar not being available in Alpine Linux. 2017-06-04 18:40:38 -04:00
Eric S. Raymond
b0fa3ad81c Removed bogus depenency of .h on .h. 2017-06-04 16:45:03 -04:00
Eric S. Raymond
495f4afbe0 Fix a slightly incorrect deoendency. 2017-06-04 16:40:35 -04:00
Eric S. Raymond
9b66a6511b Remove database.h from SOURCES list, it's generated. 2017-06-04 16:26:02 -04:00
Eric S. Raymond
fbe3f90ad9 Fix dropped stitch in last commit. 2017-06-04 16:08:19 -04:00
Eric S. Raymond
5b28397739 Make it possible to pass options to advent from within regression-test loads. 2017-06-04 16:06:21 -04:00
Jason S. Ninneman
3a1a3eb774 Actually return a value from SETBIT(). 2017-06-04 09:47:49 -07:00
Jason S. Ninneman
83048ee832 Remove a disused function, thereby upping the code coverage. 2017-06-04 08:58:43 -07:00
Eric S. Raymond
b88d77bea2 More history of non-influence. 2017-06-04 08:57:52 -04:00
Eric S. Raymond
87779b71ef More history. 2017-06-04 08:41:11 -04:00
Eric S. Raymond
720146740b Note some non-influences. 2017-06-04 08:00:58 -04:00
Eric S. Raymond
fa63a56f18 Test coverage improvement. 2017-06-04 07:30:21 -04:00
Eric S. Raymond
8da6c9e4de Typo fix. 2017-06-04 06:42:29 -04:00
Eric S. Raymond
488f6ed7f0 Attempt YAML repair. 2017-06-04 06:29:30 -04:00
Eric S. Raymond
0692b8a6ef Makefile and CI recipe YML rework. 2017-06-04 06:16:46 -04:00
Rémi Verschelde
51e868f591 Honor external CCFLAGS and LDFLAGS 2017-06-04 05:50:39 -04:00
Eric S. Raymond
0b4f19db45 Repair dist slightly broken by previous commit. 2017-06-04 05:50:39 -04:00
Rémi Verschelde
beb762735d Fix Makefile dist target. 2017-06-04 05:50:39 -04:00
Jason S. Ninneman
5145170a76 Unpolished but working 'package' job to collect artifacts for a release. 2017-06-03 21:04:50 -07:00
Jason S. Ninneman
beb80ff521 Reconfigure the CI pipeline to deploy more static HTML content. 2017-06-03 17:55:57 -07:00
Eric S. Raymond
43aef9ceb1 Add html production for convenience generating the website. 2017-06-03 19:55:13 -04:00
Eric S. Raymond
c0537670c0 More documentation polishing. 2017-06-03 19:44:25 -04:00
Eric S. Raymond
0f126b0cb5 Fix HTML rules and input. 2017-06-03 19:27:03 -04:00
Eric S. Raymond
25645fc01e Make git ignore all HTML. 2017-06-03 19:19:34 -04:00
Eric S. Raymond
c0f5c36d93 Ignore coverage files. 2017-06-03 15:21:49 -04:00
Eric S. Raymond
35b4c4156b Create website iindex and hints pages. 2017-06-03 14:57:39 -04:00
Eric S. Raymond
9dca58699f Address GitLab issue #7: History note about Crowther's version 2017-06-03 14:57:39 -04:00
Jason S. Ninneman
7c0a690a1c Sync compile.c with misc.c. 2017-06-03 11:41:33 -07:00
Jason S. Ninneman
4babd6d058 Rescope and retype a variable. 2017-06-03 11:30:56 -07:00
Jason S. Ninneman
ab46b5261b Make GETTXT() a bit closer to actual C. 2017-06-03 11:30:56 -07:00
Eric S. Raymond
681ecd9a4f Use "adoc" extension for asciidoc, it's the GitLab convention. 2017-06-03 14:29:44 -04:00
Eric S. Raymond
3f59708933 Attempt to use GitLab's asciidic grinder for README. 2017-06-03 14:20:20 -04:00
Eric S. Raymond
3e82eeda27 Documentation polishing. 2017-06-03 13:04:46 -04:00
Eric S. Raymond
6f17b31b85 Test for more unusual cases. 2017-06-03 11:27:24 -04:00
Eric S. Raymond
4874fce5c7 Add some tests that increase test coverage to add cases.
Proof of concept. More could be added in illformed.log.
2017-06-03 06:28:00 -04:00
Jason S. Ninneman
900f8d9df5 Do code coverage analysis, and publish the results to GitLab Pages. 2017-06-02 15:52:52 -07:00
Eric S. Raymond
aef609291d Simplify bitmask test/set from FORTRANish to actual C. 2017-06-02 16:40:29 -04:00
Eric S. Raymond
63f53c026d Macro elimination - easy cases first. No logic changes. 2017-06-02 16:20:40 -04:00
Eric S. Raymond
d402e09411 Header consolidation - main.h, misc.h, and share.h merge to advent.h.
For a project this small size with a small type ontology, it's better
C style to have one header where all the assumptions about types and
structures are immediately visible.

This is a first step towards turning all that global state into a handful
of structures - probably just two, one saveable as a binary game state.
2017-06-02 15:06:33 -04:00
Jason S. Ninneman
4209b82c5a Fix typo in COPYING. 2017-06-02 18:13:56 +00:00
Eric S. Raymond
e0ae1b84b8 Walktrough is accomplished. 2017-06-02 14:06:43 -04:00
Peje Nilsson
5632f5eba4 Untangle gotos
Some LXXXX refactored as functions with more meaningful names
Remove unused globals
2017-06-02 08:45:50 -04:00
Michael Jarvis
467a255653 Add explicit rule for compile to use CCFLAGS instead of CFLAGS (take two) 2017-06-02 08:44:40 -04:00
Michael Jarvis
c14c5952a7 Revert "Add explicit rule for compile to use CCFLAGS instead of CFLAGS"
This reverts commit c29e30d25c.
2017-06-02 08:44:40 -04:00
Michael Jarvis
44c444d638 added braces around initialization of subobjects for clarity 2017-06-02 08:44:40 -04:00
Michael Jarvis
092f478790 Cast size_t to long to silence warning 2017-06-02 08:44:40 -04:00
Michael Jarvis
2620bf922f Add explicit rule for compile to use CCFLAGS instead of CFLAGS 2017-06-02 08:44:40 -04:00
Eric S. Raymond
f373d87ba7 Hand merge of MR !31: Update the CI infrastructure to be faster 2017-06-02 06:42:35 -04:00
Eric S. Raymond
67d8c99e53 Added 428-point walkthrough to regression tests. 2017-06-02 06:38:59 -04:00
Michael Jarvis
40ccd3d80d use char, not signed char 2017-06-01 17:45:29 -05:00
Eric S. Raymond
dbe02a31a2 Add a walkthrough that foes nearly to endgame. 2017-06-01 14:36:16 -04:00
Jason S. Ninneman
2483a23690 Test to ensure that the turn count penalties occur. 2017-05-31 13:36:36 -07:00
Eric S. Raymond
2e5c6cf810 Simplify inclusion computation so it's BSD-friendly. 2017-05-31 14:53:01 -04:00
Eric S. Raymond
b2c0107fed Metadata update. 2017-05-31 14:34:32 -04:00
Jason S. Ninneman
80bf70f0a6 Fix dependencies so parallel make works (issue #4). 2017-05-31 10:52:46 -07:00
Eric S. Raymond
aacd3a5f8d Add a missing dependency. 2017-05-31 13:08:23 -04:00
Eric S. Raymond
77d2a1e5dd Add another test. 2017-05-31 06:37:56 -04:00
Jason S. Ninneman
c9ba5831c9 Remove erroneous comment about PRNG usage. 2017-05-30 17:19:01 -07:00
Eric S. Raymond
6a6670e3ca Fix things so seed doesn't cost clock time. 2017-05-30 20:08:55 -04:00
Eric S. Raymond
6b6cfa37f1 Remove inventory commands from the pirare log - more hope of completing it. 2017-05-30 19:59:38 -04:00
Eric S. Raymond
edc11a1f04 Replace 161-point partial walktgrough with 219-point (same base). 2017-05-30 18:27:25 -04:00
Jason S. Ninneman
71fcc814f8 Launder seed generation through rand() to ensure seed diversity.
This doesn't affect reproducibility because a) the seed value written to logs is the output of this process, and b) the argument to the seed command *doesn't* get laundered.
2017-05-30 14:58:55 -07:00
Eric S. Raymond
dfe04a58b6 Don's account of differences from the original. 2017-05-30 17:55:15 -04:00
Eric S. Raymond
2858334845 History clarification. 2017-05-30 17:55:15 -04:00
David James Sherman
5c8276e2cb Advent doesn't need automake 2017-05-30 22:24:21 +02:00
David James Sherman
6b8c994876 Add .gitlab-ci.yml 2017-05-30 16:36:10 +00:00
Jason S. Ninneman
b3d6df3a8d Update reservoir test to reflect the magic word fix. 2017-05-29 14:41:15 -07:00
Jason S. Ninneman
650575394f Fix a bug in RNDVOC() that prevented the reservoir magic word for working.
To do this, I first had to refactor the code into proper C, just so I could understand it. Then I found another layer of encryption around the value itself. Finally, I discovered that the line to actually set the new magic word was placed such that it was using a global index instead of the local one.
2017-05-29 14:22:52 -07:00
Jason S. Ninneman
18eac9f55d Make RNDVOC() into better C. 2017-05-29 13:59:06 -07:00
Jason S. Ninneman
fda1abed97 Remove an obfuscation scheme for the reservoir magic word. 2017-05-29 13:34:34 -07:00
Jason S. Ninneman
1c74e6b22d gitignore the database compilation products. 2017-05-29 10:58:17 -07:00
Jason S. Ninneman
f5302b3b46 Don't build with two -std options. 2017-05-29 10:57:47 -07:00
Jason S. Ninneman
519d8f07e6 Really mean it about strict C99 compliance. 2017-05-29 09:30:37 -07:00
Eric S. Raymond
4beb21e08f Add a qualification. 2017-05-29 12:01:28 -04:00
Eric S. Raymond
878aa0e455 The ADVENTURE variable is no more. 2017-05-29 12:00:44 -04:00
Eric S. Raymond
270ecf8f02 Minor build tweaks. 2017-05-29 11:39:19 -04:00
Warren Melnick
7555c5354a Move the if for GCC 4 to an elseif so it does not interfere with MacOS 2017-05-29 10:52:51 -04:00
Warren Melnick
ae3c34084f Test for >= gcc 4, and change to g99 -std=gnu99 for the compiler if it is found. 2017-05-29 10:42:37 -04:00
Eric S. Raymond
bf0f604e34 Typo fixes. 2017-05-29 09:14:56 -04:00
Eric S. Raymond
24912b237c Update history.txt. 2017-05-29 09:08:44 -04:00
Eric S. Raymond
779a1cceae Don't assume gcc. 2017-05-29 09:02:12 -04:00
Eric S. Raymond
6facfe1588 MacOS port fix. 2017-05-29 09:02:12 -04:00
Jason S. Ninneman
d2ad61cbe1 Remove 'compile' upon 'make clean'.
Also remove a disused rule.
2017-05-28 22:53:03 -07:00
Eric S. Raymond
5ae76995d2 Simplify build: nested makefiles considered harmful. 2017-05-29 01:33:59 -04:00
Eric S. Raymond
7e82c2f910 Begin "Functional Changes" section. 2017-05-29 01:16:08 -04:00
Jason S. Ninneman
f0528b0ded Move database compilation out into its own tool (for now). 2017-05-28 21:46:54 -07:00
Jason S. Ninneman
d6b59a1c12 Apply further polish and add in a couple of missing size variables. 2017-05-28 17:21:04 -07:00
Jason S. Ninneman
df46df6979 Factor out handling of variables populated from the database.
This reorganization is a first step toward handling database compilation separately.
2017-05-28 15:42:05 -07:00
Eric S. Raymond
e0f160d313 Remove debris from the Makefile. 2017-05-28 13:55:41 -04:00
Eric S. Raymond
113a2a3e94 Add regression test that gets to reservoir.
This allows reproduction of the magic-word bug.
2017-05-28 13:53:59 -04:00
Jason S. Ninneman
1ea2c86641 Restory working seed value for dwarf.log. 2017-05-27 09:23:52 -07:00
Eric S. Raymond
c15a470a56 Restore regression tests. 2017-05-27 10:51:43 -04:00
Eric S. Raymond
4ab32f98a6 More Makefile simplification. 2017-05-27 10:32:11 -04:00
Eric S. Raymond
708d728bb5 Simplify the test makefile. 2017-05-27 10:31:16 -04:00
Eric S. Raymond
67b8d38f53 Correct a dependency. 2017-05-27 10:24:34 -04:00
Eric S. Raymond
6fdf1deccc Update the list of changes. 2017-05-27 10:17:18 -04:00
Jason S. Ninneman
f9eca41f3a Ensure the ZZZZ magic word is reproducible.
This happens by making the SEED command also regenerate the magic word.
2017-05-26 16:34:16 -07:00
Eric S. Raymond
f2043034e5 Use C99 moode of compiler. 2017-05-26 14:03:17 -04:00
Jason S. Ninneman
2270c6ad12 Just say no to encrypting internal state. 2017-05-26 10:21:19 -07:00
Eric S. Raymond
5c4fdc35eb Flush log on interrupt, just for convenience. 2017-05-26 07:22:24 -04:00
Eric S. Raymond
f5cd343fc6 Case correction. 2017-05-26 06:33:44 -04:00
Eric S. Raymond
e4f6bfc109 Death by dwarf test. 2017-05-26 06:16:16 -04:00
Eric S. Raymond
d2643712dd Fix bug that led to comments bnot being ignored. 2017-05-26 05:14:18 -04:00
NHOrus
df23b58032 Different, correct fix of tests
Now without caching .data and extended cleanup
2017-05-26 09:41:54 +03:00
Eric S. Raymond
196a9e1a49 Document test comment format. 2017-05-26 00:40:35 -04:00
Eric S. Raymond
53074fb1ea Regression-test machinery is now documented. 2017-05-26 00:37:24 -04:00
Eric S. Raymond
894724d1c8 First version of regression tests.
Only one test so far but the framework for more is in place.
2017-05-26 00:22:51 -04:00
Eric S. Raymond
7763e1aa22 Repeatable seeding is working. 2017-05-25 18:52:39 -04:00
Eric S. Raymond
79ef3e38c2 Implement fallback handler that looks at the raw command buffer.
With database cinpilation not broken this time...
2017-05-25 18:21:38 -04:00
Eric S. Raymond
76527321b5 Repair CentOS 6 build (fails due to clock_gettime() being undefined)
GitLab issue #2.
2017-05-25 09:09:11 -04:00
Jason S. Ninneman
580565e254 Stop command-logging from non-stdin sources. 2017-05-24 22:31:26 -07:00
Eric S. Raymond
6ba9a7de7f Once again, take srand()/random() out of the initialization chain.
They have exactly the wrong kind of randomness for this job - not
returning consistent sequences across different platforms or C library
versions, and because pseodorandom not really better than sampling
the clock.
2017-05-24 23:36:25 -04:00
Eric S. Raymond
6146406990 Re-enable skipping of #-led comments. 2017-05-24 23:05:19 -04:00
Eric S. Raymond
3a2c0ca199 Reapply "Clean up logic for exiting input loop and scoring." 2017-05-24 22:51:36 -04:00
Jason S. Ninneman
ba1369310d Remove disused label. 2017-05-24 15:43:34 -07:00
Eric S. Raymond
e3e01af7fa Remove cached data on clean.
We've had two instances now of database compilation getting silently
broken and that not noticed because of the caching. Attempt to
forestall this.
2017-05-24 18:29:26 -04:00
Eric S. Raymond
31837249f8 Revert SEED handling and comment orocessing. It broke database compilation.
This code is remarkably like the game it implements - a maze of twisty
little FORTRANisms, all alike.  Very easy to get lost.
2017-05-24 18:24:09 -04:00
Eric S. Raymond
44e7ddc2ed Take srand()/rand() out of the initialization chain...
...they're not guatanteed to produce consistent across platforms or
libc versions.
2017-05-24 11:57:53 -04:00
Eric S. Raymond
c703bd78d9 Clean up logic for exiting input loop and scoring. 2017-05-24 11:16:59 -04:00
Eric S. Raymond
263b5ac3ba Allow comments in logfiles. 2017-05-24 10:07:05 -04:00
Eric S. Raymond
cf219e920b Seed command fully implemented but apparently buggy.
Dwarf appearance is not yet reproducible.
2017-05-24 09:06:41 -04:00
Eric S. Raymond
65c081a0ac Implement stub handler for SEED command. Not hooked up to PRNG yet. 2017-05-24 08:30:06 -04:00
Jason S. Ninneman
627144354c Remove a bad use of tv_nsec. 2017-05-23 23:46:20 -07:00
Jason S. Ninneman
61031ce55c Move a line that got out of place. 2017-05-23 23:42:54 -07:00
Jason S. Ninneman
8a8770375e Add seedable PRNG using an adaptation the original LCG algorithm. 2017-05-23 23:37:56 -07:00
Eric S. Raymond
2bc887c84e Fix the slightly broken prompt test. 2017-05-24 00:28:38 -04:00
Eric S. Raymond
484ca4e9fd Revert structurization changes, they broke database compilation...
...bug showing only if adventure.data was absent.  We'll need to sneak up
on this more carefully.
2017-05-24 00:17:19 -04:00
Eric S. Raymond
7e5448e974 More switch reformatting. 2017-05-23 23:17:57 -04:00
Eric S. Raymond
1e2e24f4d5 Reformat a switch statement for readability. No logic changes. 2017-05-23 23:01:34 -04:00
Eric S. Raymond
f9eb6383f1 Revert a variable name previously changed to be out of the way.
Also, make output from replays easier to interpret by adding prompts.
2017-05-23 22:29:24 -04:00
Eric S. Raymond
f72141fbe3 More structurization. 2017-05-23 20:59:21 -04:00
Eric S. Raymond
8d0587b0ec Echo commands to stdout when replaying...
...makes check loads full transcripts abd more readable.
2017-05-23 20:38:46 -04:00
Eric S. Raymond
f68f3a1205 More globals to the game structure. 2017-05-23 20:34:53 -04:00
Eric S. Raymond
c3add5c206 More global-to-structure moves. 2017-05-23 20:22:35 -04:00
Eric S. Raymond
50ed247042 More comment cleanup. 2017-05-23 19:49:49 -04:00
Eric S. Raymond
bbe68abd30 Fixed case in a comment. 2017-05-23 19:45:18 -04:00
Eric S. Raymond
fa1f859162 Move more globals into the state structure. 2017-05-23 19:40:34 -04:00
Eric S. Raymond
42189d79d7 Begin gathering saveable game state into a structure. Not yet complete.
No logic changes.  A bunch of globals turn into fields (with the same names
except for lowercasing) in struct game_t.

Eventually this will allow drastic simplification of the save/load logic.
2017-05-23 18:47:04 -04:00
Eric S. Raymond
dc9d9e467b Input source is parametrized all the way down.
This means that, potentially, do_command() could be called on any text file
pointer and the right thing would happen.
2017-05-23 15:57:38 -04:00
Eric S. Raymond
c6867b374a Begin factoring out the command interpreter. 2017-05-23 14:48:41 -04:00
Eric S. Raymond
609b308ed1 Documentation polishing. 2017-05-23 14:04:42 -04:00
Eric S. Raymond
0599a20f1f Update for TODO items accomplished. 2017-05-23 13:22:18 -04:00
Eric S. Raymond
0388d294d4 Fix command synopsis on the manual page. 2017-05-23 11:31:10 -04:00
268 changed files with 168439 additions and 6233 deletions

16
.gitignore vendored
View file

@ -1,3 +1,17 @@
# SPDX-FileCopyrightText: (C) Eric S. Raymond
# SPDX-License-Identifier: BSD-2-Clause
advent
*.gcda
*.gcno
*.o
adventure.data
*.html
dungeon.h
dungeon.c
advent.6
*.tar.gz
MANIFEST
*.adv
.*~
cheat
advent.info
coverage/*

104
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,104 @@
# SPDX-FileCopyrightText: (C) Eric S. Raymond
# SPDX-License-Identifier: BSD-2-Clause
stages:
- ci-build
- build
- test
- deploy
default:
image: $CI_REGISTRY_IMAGE:ci
# build and push Docker image to be used in subsequent steps
ci-build:
stage: ci-build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.ci --destination $CI_REGISTRY_IMAGE:ci --cache=true
# build advent itself
binary:debug:
stage: build
script:
- make debug
artifacts:
paths:
- advent
- cheat
- "*.o"
- dungeon.c
- dungeon.h
binary:release:
stage: build
script:
- make advent cheat
artifacts:
paths:
- advent
- cheat
- "*.o"
- dungeon.c
- dungeon.h
manpage:
stage: build
script:
- make advent.6
artifacts:
paths:
- advent.6
html:
stage: build
script:
- make html
artifacts:
paths:
- "*.html"
dist:
stage: build
script:
- export VERS=${CI_COMMIT_REF_NAME}
- make dist -e
artifacts:
paths:
- "*.tar.gz"
# run tests using the binary built before
test:debug:
stage: test
script:
- make coverage
artifacts:
paths:
- coverage
dependencies:
- binary:debug
test:release:
stage: test
script:
- cd tests
- make
- cd ..
dependencies:
- binary:release
pages:
stage: deploy
script:
- mkdir public
- mv coverage public
artifacts:
paths:
- public
only:
- master
dependencies:
- test:debug

5
.shipper Normal file
View file

@ -0,0 +1,5 @@
#SPDX-FileCopyrightText: (C) Eric S. Raymond
#SPDX-License-Identifier: BSD-2-Clause
extralines="""
<p>There is a <a href="http://esr.gitlab.io/open-adventure/coverage/">code coverage analysis</a> and a <a href="http://esr.gitlab.io/open-adventure/coverage/adventure.yaml.html">symbol coverage analysis</p>
"""

View file

@ -1,7 +1,4 @@
BSD LICENSE
Copyright (c) 1977, 2005 by Will Crowther and Don Woods
Copytright (c) 2017 by Eric S. Raymond
BSD 2-Clause LICENSE
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are

12
Dockerfile.ci Normal file
View file

@ -0,0 +1,12 @@
# This image is built by the Gitlab CI pipeline to be used in subsequent
# pipeline steps.
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
FROM ubuntu
# tell apt not to ask for any user input
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install --yes --no-install-recommends make gcc libedit-dev libasan6 libubsan1 python3 python3-yaml lcov asciidoctor libxslt1.1 pkg-config docbook-xml xsltproc

27
INSTALL.adoc Normal file
View file

@ -0,0 +1,27 @@
= Installing Open Adventure =
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
Installation now requires Python3 due to a security issue
with the YAML library.
1. Install libedit from http://thrysoee.dk/editline/ (aka: editline)
on your system.
+
On Debian and Ubuntu: `apt-get install libedit-dev`.
+
On Fedora: `dnf install libedit-devel`.
+
You can also use pip to install PyYAML: `pip3 install PyYAML`.
2. Change to the top-level directory of the source code (e.g., `cd open-adventure`).
3. Build with `make`.
4. Optionally run a regression test on the code with `make check`.
5. Run `./advent` to play.
6. If you want to buld the documentation you will need asciidoctor.
7. Running the regression tests requires batchspell

166
Makefile
View file

@ -1,43 +1,161 @@
# Makefile for the open-source release of adventure 2.5
OBJS=main.o init.o actions1.o actions2.o score.o misc.o
SOURCES=$(OBJS:.o=.c) COPYING NEWS README TODO advent.text control
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# To build with save/resume disabled, pass CFLAGS="-DADVENT_NOSAVE"
# To build with auto-save/resume enabled, pass CFLAGS="-DADVENT_AUTOSAVE"
VERS=$(shell sed -n <NEWS.adoc '/^[0-9]/s/:.*//p' | head -1)
.PHONY: debug indent release refresh dist linty html clean
.PHONY: check coverage
CC?=gcc
CCFLAGS+=-std=c99 -Wall -Wextra -D_DEFAULT_SOURCE -DVERSION=\"$(VERS)\" -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all $(CFLAGS) -g $(EXTRA)
LIBS=$(shell pkg-config --libs libedit)
INC+=$(shell pkg-config --cflags libedit)
# LLVM/Clang on macOS seems to need -ledit flag for linking
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LIBS += -ledit
endif
OBJS=main.o init.o actions.o score.o misc.o saveresume.o
CHEAT_OBJS=cheat.o init.o actions.o score.o misc.o saveresume.o
SOURCES=$(OBJS:.o=.c) advent.h adventure.yaml Makefile control make_dungeon.py templates/*.tpl
.c.o:
gcc -O $(DBX) -c $<
$(CC) $(CCFLAGS) $(INC) $(DBX) -c $<
advent: $(OBJS)
gcc -O $(DBX) -o advent $(OBJS)
advent: $(OBJS) dungeon.o
$(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) dungeon.o $(LDFLAGS) $(LIBS)
main.o: misc.h funcs.h
main.o: advent.h dungeon.h
init.o: misc.h main.h share.h funcs.h
init.o: advent.h dungeon.h
actions1.o: misc.h main.h share.h funcs.h
actions.o: advent.h dungeon.h
actions2.o: misc.h main.h share.h funcs.h
score.o: advent.h dungeon.h
score.o: misc.h main.h share.h
misc.o: advent.h dungeon.h
misc.o: misc.h main.h
cheat.o: advent.h dungeon.h
saveresume.o: advent.h dungeon.h
dungeon.o: dungeon.c dungeon.h
$(CC) $(CCFLAGS) $(DBX) -c dungeon.c
dungeon.c dungeon.h: make_dungeon.py adventure.yaml advent.h templates/*.tpl
./make_dungeon.py
clean:
rm -f *.o advent advent.html advent.6
rm -f *.o advent cheat *.html *.gcno *.gcda
rm -f dungeon.c dungeon.h
rm -f README advent.6 MANIFEST *.tar.gz
rm -f *~
rm -f .*~
rm -rf coverage advent.info
cd tests; $(MAKE) --quiet clean
# Requires asciidoc and xsltproc/docbook stylesheets.
.asc.6:
a2x --doctype manpage --format manpage $<
.asc.html:
a2x --doctype manpage --format xhtml -D . $<
rm -f docbook-xsl.css
advent-$(VERS).tar.gz: $(SOURCES) advent.6
tar --transform='s:^:advent-$(VERS)/:' --show-transformed-names -cvzf advent-$(VERS).tar.gz $(SOURCES) advent.6
cheat: $(CHEAT_OBJS) dungeon.o
$(CC) $(CCFLAGS) $(DBX) -o cheat $(CHEAT_OBJS) dungeon.o $(LDFLAGS) $(LIBS)
CSUPPRESSIONS = --suppress=missingIncludeSystem --suppress=invalidscanf
cppcheck:
@-cppcheck -I. --quiet --template gcc -UOBJECT_SET_SEEN --enable=all $(CSUPPRESSIONS) *.[ch]
pylint:
@-pylint --score=n *.py */*.py
check: advent cheat pylint cppcheck spellcheck
cd tests; $(MAKE) --quiet
spellcheck:
@batchspell adventure.yaml advent.adoc
reflow:
@clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
@black --quiet *.py
# Requires gcov, lcov, libasan6, and libubsan1
# The last two are Ubuntu names, might vary on other distributions.
# After this, run your browser on coverage/open-adventure/index.html
# to see coverage results. Browse coverage/adventure.yaml.html
# to see symbol coverage over the YAML file.
coverage: clean debug
cd tests; $(MAKE) coverage --quiet
# Note: to suppress the footers with timestamps being generated in HTML,
# we use "-a nofooter".
# To debug asciidoc problems, you may need to run "xmllint --nonet --noout --valid"
# on the intermediate XML that throws an error.
.SUFFIXES: .html .adoc .6
.adoc.6:
asciidoctor -D. -a nofooter -b manpage $<
.adoc.html:
asciidoctor -D. -a nofooter -a webfonts! $<
html: advent.html history.html hints.html
# README.adoc exists because that filename is magic on GitLab.
DOCS=COPYING NEWS.adoc README.adoc advent.adoc history.adoc notes.adoc hints.adoc advent.6 INSTALL.adoc
TESTFILES=tests/*.log tests/*.chk tests/README tests/decheck tests/Makefile
# 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)
@find $(SOURCES) $(DOCS) $(TESTFILES) -print | sed s:^:advent-$(VERS)/: >MANIFEST
@(ln -s . advent-$(VERS))
(tar -T MANIFEST -czvf advent-$(VERS).tar.gz)
@(rm advent-$(VERS))
release: advent-$(VERS).tar.gz advent.html history.html hints.html notes.html
shipper version=$(VERS) | sh -e -x
refresh: advent.html notes.html history.html
shipper -N -w version=$(VERS) | sh -e -x
dist: advent-$(VERS).tar.gz
release: advent-$(VERS).tar.gz advent.html
shipper version=$(VERS) | sh -e -x
linty: CCFLAGS += -W
linty: CCFLAGS += -Wall
linty: CCFLAGS += -Wextra
linty: CCGLAGS += -Wpedantic
linty: CCFLAGS += -Wundef
linty: CCFLAGS += -Wstrict-prototypes
linty: CCFLAGS += -Wmissing-prototypes
linty: CCFLAGS += -Wmissing-declarations
linty: CCFLAGS += -Wshadow
linty: CCFLAGS += -Wnull-dereference
linty: CCFLAGS += -Wjump-misses-init
linty: CCFLAGS += -Wfloat-equal
linty: CCFLAGS += -Wcast-align
linty: CCFLAGS += -Wwrite-strings
linty: CCFLAGS += -Waggregate-return
linty: CCFLAGS += -Wcast-qual
linty: CCFLAGS += -Wswitch-enum
linty: CCFLAGS += -Wwrite-strings
linty: CCFLAGS += -Wunreachable-code
linty: CCFLAGS += -Winit-self
linty: CCFLAGS += -Wpointer-arith
linty: advent cheat
# These seem to be more modern options for enabling coverage testing.
# Documenting them here in case a future version bump disables --coverage.
#debug: CCFLAGS += -ftest-coverage
#debug: CCFLAGS += -fprofile-arcs
debug: CCFLAGS += -O0
debug: CCFLAGS += --coverage
debug: CCFLAGS += -ggdb
debug: CCFLAGS += -U_FORTIFY_SOURCE
debug: CCFLAGS += -fsanitize=address
debug: CCFLAGS += -fsanitize=undefined
debug: linty
refresh: advent.html
shipper -N -w version=$(VERS) | sh -e -x

7
NEWS
View file

@ -1,7 +0,0 @@
= OpenAdventure project news =
Repository head::
Forward port of Crowther & Woods's 430-point Adventure 2.5.
Added -l option for logging.
Added command prompt; -o suppresses this.

90
NEWS.adoc Normal file
View file

@ -0,0 +1,90 @@
= Open Adventure project news =
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
1.20: 2024-09-23::
Make oldstyle correctly suppress line editing.
1.19: 2024-06-27::
Ensore that the KNIVES_VANISH message can't issue twice.
1.18: 2024-02-15::
Bring the manual page fully up to date.
1.17: 2024-01-02::
Saying Z'ZZZ at reservoir no longer causes the waters to part and crash.
1.16: 2023-04-15::
Savefiles now have an identifying magic cookie at the front.
Resume detects if a save has incompatible endianness.
1.15: 2023-04-03::
Commands in magic-word sequence now interrupt it, as in original.
Bug fix for bird not starting caged in endgame.
1.14: 2023-03-09::
Added -a option for BBS door systems.
-o reverts to the old message on some failed magic words.
Typo fixes and documentation polishing.
1.13: 2023-02-28::
Fixed slightly buggy emission of end-of-game messages on a win.
1.12: 2023-02-06::
The bug and todo list has been cleared; project declared finished.
Correctness has been systematically tested against the 1995 code.
Typo fixes and documentation polishing.
1.11: 2022-04-14::
Restore 100% test coverage.
Use TAP reporting for tests.
1.10: 2022-04-06::
Fixed a bug that manifested after two "fly rug" commands - third one fails.
Fix some glitches in processing fee fie foe foo.
Correct some object start states and reading-related glitches in the endgame.
1.9: 2020-08-27::
Update the dungeon maker to avoid a deprecation due to security issues
1.8: 2019-04-19::
Minor typo and capitalization glitches in user-visible text fixed & documented.
Save format has changed.
1.7: 2018-12-03::
Python 3 and OS X port fixes.
1.6: 2018-11-15::
Split commands with verbless objects now pick up a preceding verb correctly.
1.5: 2018-11-11::
Fix for a minor bug in inventory handling.
Handle a bare numeric token on the command line a bit more gracefully.
1.4: 2017-08-07::
Repair packaging error (omitted templates.)
Minor improvements in odd grammar cases.
1.3: 2017-08-01::
Split commands with objectless transitive verbs are handled correctly.
Test suite has 100% code coverage.
1.2: 2017-07-11::
Under oldstyle, new-school single-letter command synonyms are ignored.
Switched from linenoise to editline for new-style line input.
The -s option is no longer required to paste command input; it is removed.
1.1: 2017-06-29::
There is a 'version' command.
Include tests directory in generated tarball.
Support command-line editing with arrow keys and Emacs keystrokes.
Save format has changed.
1.0: 2017-06-05::
Forward port of Crowther & Woods's 430-point Adventure 2.5.
Added -l option for logging.
Game logs are now fully reproducible via the "seed" command.
Added regression-test suite using seed, with coverage checking.
Added command prompt; -o suppresses this. Otherwise no gameplay changes.
Fixed bug that caused reservoir word not to be randomized.
Makefile does parallel builds.

16
README
View file

@ -1,16 +0,0 @@
= README for Open Adventure =
This code is a forward-port of the Crowther/Woods Adventure 2.5 from
1995, last version in the main line of Colossal Cave Adventure
development written by the original authors. The authors have given
permission and encouragement to this release.
The file history.txt contains a more detailed history of this game
and its ancestors.
This project is called "Open Adventure" because it's not at all clear
to number Adventure past 2.5 without misleading or causing collisions
or both. See the history file for discussion. The original 6-character
name on the PDP-10 has been reverted to in order to avoid a collision
with the BSD games port of the ancestral 196 version.

41
README.adoc Normal file
View file

@ -0,0 +1,41 @@
= README for Open Adventure =
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
If you are reading this anywhere but at http://www.catb.org/~esr/open-adventure
you can go there for tarball downloads and other resources.
This code is a forward-port of the Crowther/Woods Adventure 2.5 from
1995, last version in the main line of Colossal Cave Adventure
development written by the original authors. The authors have given
permission and encouragement for this release; it obsolesces all
the 350-point versions and previous 2.x (430-point) ports.
The file history.adoc contains a more detailed history of this game
and its ancestors. The file notes.adoc is the maintainer's notes,
describing project goals and recent changes.
This project is called "Open Adventure" because it's not at all clear
how to number Adventure past 2.5 without misleading or causing
collisions or both. See the history file for discussion. The
original 6-character name on the PDP-10 has been reverted to for the
executable in order to avoid a collision with the BSD games port of
the ancestral 1977 version.
Please see INSTALL.adoc for build info.
Extreme care has been taken to not silently change gameplay. By
policy, all user-visible changes from 2.5 that are not bugs or typos
are revertible with the -o (oldstyle) command-line option.
If you encounter a bug (not likely; this code is old and well tested)
please try to make a test log that reproduces it, using the -l option,
and ship it to the maintainers.
If you find this code useful or amusing, please
https://www.patreon.com/esr[support me on Patreon.]
// end

17
TODO
View file

@ -1,17 +0,0 @@
= Open Adventure TODO =
* Use a real pseudorandom-number generator with a seed rather than just
time-sampling.
* Add command logging and command log replay. Note that the replay log
needs to begin with the random-number seed.
* Use that feature to make regression tests from walkthroughs.
* Add command-line option to disable all extension features. First
extension features: (1) Command prompt, (2) initial resource-allocation
number display suppressed.
* Translate the FORTRANish mess to actual C.
* Inline the database so the code doesn't need an external file.

1659
actions.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,586 +0,0 @@
#include <stdlib.h>
#include <stdbool.h>
#include "misc.h"
#include "main.h"
#include "share.h"
#include "funcs.h"
/* This stuff was broken off as part of an effort to get the main program
* to compile without running out of memory. We're called with a number
* that says what label the caller wanted to "goto", and we return a
* similar label number for the caller to "goto".
*/
/* Analyse a verb. Remember what it was, go back for object if second word
* unless verb is "say", which snarfs arbitrary second word. */
int action(long STARTAT) {
switch(STARTAT) {
case 4000: goto L4000;
case 4090: goto L4090;
case 5000: goto L5000;
}
BUG(99);
L4000: VERB=K;
SPK=ACTSPK[VERB];
if(WD2 > 0 && VERB != SAY) return(2800);
if(VERB == SAY)OBJ=WD2;
if(OBJ > 0) goto L4090;
/* Analyse an intransitive verb (ie, no object given yet). */
switch (VERB-1) { case 0: goto L8010; case 1: return(8000); case 2:
return(8000); case 3: goto L8040; case 4: return(2009); case 5: goto L8040;
case 6: goto L8070; case 7: goto L8080; case 8: return(8000); case
9: return(8000); case 10: return(2011); case 11: goto L9120; case 12:
goto L9130; case 13: goto L8140; case 14: goto L9150; case 15:
return(8000); case 16: return(8000); case 17: goto L8180; case 18:
return(8000); case 19: goto L8200; case 20: return(8000); case 21:
goto L9220; case 22: goto L9230; case 23: goto L8240; case 24:
goto L8250; case 25: goto L8260; case 26: goto L8270; case 27:
return(8000); case 28: return(8000); case 29: goto L8300; case 30:
goto L8310; case 31: goto L8320; case 32: goto L8330; case 33:
goto L8340; }
/* TAKE DROP SAY OPEN NOTH LOCK ON OFF WAVE CALM
* WALK KILL POUR EAT DRNK RUB TOSS QUIT FIND INVN
* FEED FILL BLST SCOR FOO BRF READ BREK WAKE SUSP
* RESU FLY LSTN ZZZZ */
BUG(23);
/* Analyse a transitive verb. */
L4090: switch (VERB-1) { case 0: goto L9010; case 1: goto L9020; case 2: goto
L9030; case 3: goto L9040; case 4: return(2009); case 5: goto L9040;
case 6: goto L9070; case 7: goto L9080; case 8: goto L9090; case
9: return(2011); case 10: return(2011); case 11: goto L9120; case 12:
goto L9130; case 13: goto L9140; case 14: goto L9150; case 15:
goto L9160; case 16: goto L9170; case 17: return(2011); case 18:
goto L9190; case 19: goto L9190; case 20: goto L9210; case 21:
goto L9220; case 22: goto L9230; case 23: return(2011); case 24:
return(2011); case 25: return(2011); case 26: goto L9270; case 27:
goto L9280; case 28: goto L9290; case 29: return(2011); case 30:
return(2011); case 31: goto L9320; case 32: return(2011); case 33:
goto L8340; }
/* TAKE DROP SAY OPEN NOTH LOCK ON OFF WAVE CALM
* WALK KILL POUR EAT DRNK RUB TOSS QUIT FIND INVN
* FEED FILL BLST SCOR FOO BRF READ BREK WAKE SUSP
* RESU FLY LSTN ZZZZ */
BUG(24);
/* Analyse an object word. See if the thing is here, whether we've got a verb
* yet, and so on. Object must be here unless verb is "find" or "invent(ory)"
* (and no new verb yet to be analysed). Water and oil are also funny, since
* they are never actually dropped at any location, but might be here inside
* the bottle or urn or as a feature of the location. */
L5000: OBJ=K;
if(!HERE(K)) goto L5100;
L5010: if(WD2 > 0) return(2800);
if(VERB != 0) goto L4090;
SETPRM(1,WD1,WD1X);
RSPEAK(255);
return(2600);
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) return(8);
L5110: if(K == DWARF && ATDWRF(LOC) > 0) goto L5010;
if((LIQ(0) == K && HERE(BOTTLE)) || K == LIQLOC(LOC)) goto L5010;
if(OBJ != OIL || !HERE(URN) || PROP[URN] == 0) goto L5120;
OBJ=URN;
goto L5010;
L5120: 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;
return(2011);
L5140: if(OBJ != ROD || !HERE(ROD2)) goto L5190;
OBJ=ROD2;
goto L5010;
L5190: if((VERB == FIND || VERB == INVENT) && WD2 <= 0) goto L5010;
SETPRM(1,WD1,WD1X);
RSPEAK(256);
return(2012);
/* Routines for performing the various action verbs */
/* Statement numbers in this section are 8000 for intransitive verbs, 9000 for
* transitive, plus ten times the verb number. Many intransitive verbs use the
* transitive code, and some verbs use code for other verbs, as noted below. */
/* Carry, no object given yet. OK if only one object present. */
L8010: if(ATLOC[LOC] == 0 || LINK[ATLOC[LOC]] != 0 || ATDWRF(LOC) > 0) return(8000);
OBJ=ATLOC[LOC];
/* Transitive carry/drop are in separate file. */
L9010: return(carry());
L9020: return(discard(false));
/* SAY. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */
L9030: SETPRM(1,WD2,WD2X);
if(WD2 <= 0)SETPRM(1,WD1,WD1X);
if(WD2 > 0)WD1=WD2;
I=VOCAB(WD1,-1);
if(I == 62 || I == 65 || I == 71 || I == 2025 || I == 2034) goto L9035;
RSPEAK(258);
return(2012);
L9035: WD2=0;
OBJ=0;
return(2630);
/* Lock, unlock, no object given. Assume various things if present. */
L8040: 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)) return(8000);
if(HERE(CHAIN))OBJ=CHAIN;
if(OBJ == 0) return(2011);
/* Lock, unlock object. Special stuff for opening clam/oyster and for chain. */
L9040: if(OBJ == CLAM || OBJ == OYSTER) goto L9046;
if(OBJ == DOOR)SPK=111;
if(OBJ == DOOR && PROP[DOOR] == 1)SPK=54;
if(OBJ == CAGE)SPK=32;
if(OBJ == KEYS)SPK=55;
if(OBJ == GRATE || OBJ == CHAIN)SPK=31;
if(SPK != 31 || !HERE(KEYS)) return(2011);
if(OBJ == CHAIN) goto L9048;
if(!CLOSNG) goto L9043;
K=130;
if(!PANIC)CLOCK2=15;
PANIC=true;
return(2010);
L9043: K=34+PROP[GRATE];
PROP[GRATE]=1;
if(VERB == LOCK)PROP[GRATE]=0;
K=K+2*PROP[GRATE];
return(2010);
/* Clam/Oyster. */
L9046: K=0;
if(OBJ == OYSTER)K=1;
SPK=124+K;
if(TOTING(OBJ))SPK=120+K;
if(!TOTING(TRIDNT))SPK=122+K;
if(VERB == LOCK)SPK=61;
if(SPK != 124) return(2011);
DSTROY(CLAM);
DROP(OYSTER,LOC);
DROP(PEARL,105);
return(2011);
/* Chain. */
L9048: if(VERB == LOCK) goto L9049;
SPK=171;
if(PROP[BEAR] == 0)SPK=41;
if(PROP[CHAIN] == 0)SPK=37;
if(SPK != 171) return(2011);
PROP[CHAIN]=0;
FIXED[CHAIN]=0;
if(PROP[BEAR] != 3)PROP[BEAR]=2;
FIXED[BEAR]=2-PROP[BEAR];
return(2011);
L9049: SPK=172;
if(PROP[CHAIN] != 0)SPK=34;
if(LOC != PLAC[CHAIN])SPK=173;
if(SPK != 172) return(2011);
PROP[CHAIN]=2;
if(TOTING(CHAIN))DROP(CHAIN,LOC);
FIXED[CHAIN]= -1;
return(2011);
/* Light. Applicable only to lamp and urn. */
L8070: if(HERE(LAMP) && PROP[LAMP] == 0 && LIMIT >= 0)OBJ=LAMP;
if(HERE(URN) && PROP[URN] == 1)OBJ=OBJ*100+URN;
if(OBJ == 0 || OBJ > 100) return(8000);
L9070: if(OBJ == URN) goto L9073;
if(OBJ != LAMP) return(2011);
SPK=184;
if(LIMIT < 0) return(2011);
PROP[LAMP]=1;
RSPEAK(39);
if(WZDARK) return(2000);
return(2012);
L9073: SPK=38;
if(PROP[URN] == 0) return(2011);
SPK=209;
PROP[URN]=2;
return(2011);
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
L8080: if(HERE(LAMP) && PROP[LAMP] == 1)OBJ=LAMP;
if(HERE(URN) && PROP[URN] == 2)OBJ=OBJ*100+URN;
if(OBJ == 0 || OBJ > 100) return(8000);
L9080: if(OBJ == URN) goto L9083;
if(OBJ == LAMP) goto L9086;
if(OBJ == DRAGON || OBJ == VOLCAN)SPK=146;
return(2011);
L9083: PROP[URN]=PROP[URN]/2;
SPK=210;
return(2011);
L9086: PROP[LAMP]=0;
RSPEAK(40);
if(DARK(0))RSPEAK(16);
return(2012);
/* Wave. No effect unless waving rod at fissure or at bird. */
L9090: if((!TOTING(OBJ)) && (OBJ != ROD || !TOTING(ROD2)))SPK=29;
if(OBJ != ROD || !TOTING(OBJ) || (!HERE(BIRD) && (CLOSNG || !AT(FISSUR))))
return(2011);
if(HERE(BIRD))SPK=206+MOD(PROP[BIRD],2);
if(SPK == 206 && LOC == PLACE[STEPS] && PROP[JADE] < 0) goto L9094;
if(CLOSED) return(18999);
if(CLOSNG || !AT(FISSUR)) return(2011);
if(HERE(BIRD))RSPEAK(SPK);
PROP[FISSUR]=1-PROP[FISSUR];
PSPEAK(FISSUR,2-PROP[FISSUR]);
return(2012);
L9094: DROP(JADE,LOC);
PROP[JADE]=0;
TALLY=TALLY-1;
SPK=208;
return(2011);
/* Attack also moved into separate module. */
L9120: return(attack());
/* Pour. If no object, or object is bottle, assume contents of bottle.
* special tests for pouring water or oil on plant or rusty door. */
L9130: if(OBJ == BOTTLE || OBJ == 0)OBJ=LIQ(0);
if(OBJ == 0) return(8000);
if(!TOTING(OBJ)) return(2011);
SPK=78;
if(OBJ != OIL && OBJ != WATER) return(2011);
if(HERE(URN) && PROP[URN] == 0) goto L9134;
PROP[BOTTLE]=1;
PLACE[OBJ]=0;
SPK=77;
if(!(AT(PLANT) || AT(DOOR))) return(2011);
if(AT(DOOR)) goto L9132;
SPK=112;
if(OBJ != WATER) return(2011);
PSPEAK(PLANT,PROP[PLANT]+3);
PROP[PLANT]=MOD(PROP[PLANT]+1,3);
PROP[PLANT2]=PROP[PLANT];
K=NUL;
return(8);
L9132: PROP[DOOR]=0;
if(OBJ == OIL)PROP[DOOR]=1;
SPK=113+PROP[DOOR];
return(2011);
L9134: OBJ=URN;
goto L9220;
/* Eat. Intransitive: assume food if present, else ask what. Transitive: food
* ok, some things lose appetite, rest are ridiculous. */
L8140: if(!HERE(FOOD)) return(8000);
L8142: DSTROY(FOOD);
SPK=72;
return(2011);
L9140: if(OBJ == FOOD) goto L8142;
if(OBJ == BIRD || OBJ == SNAKE || OBJ == CLAM || OBJ == OYSTER || OBJ ==
DWARF || OBJ == DRAGON || OBJ == TROLL || OBJ == BEAR || OBJ ==
OGRE)SPK=71;
return(2011);
/* Drink. If no object, assume water and look for it here. If water is in
* the bottle, drink that, else must be at a water loc, so drink stream. */
L9150: if(OBJ == 0 && LIQLOC(LOC) != WATER && (LIQ(0) != WATER || !HERE(BOTTLE)))
return(8000);
if(OBJ == BLOOD) goto L9153;
if(OBJ != 0 && OBJ != WATER)SPK=110;
if(SPK == 110 || LIQ(0) != WATER || !HERE(BOTTLE)) return(2011);
PROP[BOTTLE]=1;
PLACE[WATER]=0;
SPK=74;
return(2011);
L9153: DSTROY(BLOOD);
PROP[DRAGON]=2;
OBJSND[BIRD]=OBJSND[BIRD]+3;
SPK=240;
return(2011);
/* Rub. Yields various snide remarks except for lit urn. */
L9160: if(OBJ != LAMP)SPK=76;
if(OBJ != URN || PROP[URN] != 2) return(2011);
DSTROY(URN);
DROP(AMBER,LOC);
PROP[AMBER]=1;
TALLY=TALLY-1;
DROP(CAVITY,LOC);
SPK=216;
return(2011);
/* Throw moved into separate module. */
L9170: return(throw());
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
L8180: if(YES(22,54,54)) score(1);
return(2012);
/* Find. Might be carrying it, or it might be here. Else give caveat. */
L9190: if(AT(OBJ) || (LIQ(0) == OBJ && AT(BOTTLE)) || K == LIQLOC(LOC) || (OBJ ==
DWARF && ATDWRF(LOC) > 0))SPK=94;
if(CLOSED)SPK=138;
if(TOTING(OBJ))SPK=24;
return(2011);
/* Inventory. If object, treat same as find. Else report on current burden. */
L8200: SPK=98;
/* 8201 */ for (I=1; I<=100; I++) {
if(I == BEAR || !TOTING(I)) goto L8201;
if(SPK == 98)RSPEAK(99);
BLKLIN=false;
PSPEAK(I,-1);
BLKLIN=true;
SPK=0;
L8201: /*etc*/ ;
} /* end loop */
if(TOTING(BEAR))SPK=141;
return(2011);
/* Feed/fill are in the other module. */
L9210: return(feed());
L9220: return(fill());
/* Blast. No effect unless you've got dynamite, which is a neat trick! */
L9230: if(PROP[ROD2] < 0 || !CLOSED) return(2011);
BONUS=133;
if(LOC == 115)BONUS=134;
if(HERE(ROD2))BONUS=135;
RSPEAK(BONUS);
score(0);
/* Score. Call scoring routine but tell it to return. */
L8240: score(-1);
SETPRM(1,SCORE,MXSCOR);
SETPRM(3,TURNS,TURNS);
RSPEAK(259);
return(2012);
/* FEE FIE FOE FOO (AND FUM). ADVANCE TO NEXT STATE IF GIVEN IN PROPER ORDER.
* LOOK UP WD1 IN SECTION 3 OF VOCAB TO DETERMINE WHICH WORD WE'VE GOT. LAST
* WORD ZIPS THE EGGS BACK TO THE GIANT ROOM (UNLESS ALREADY THERE). */
L8250: K=VOCAB(WD1,3);
SPK=42;
if(FOOBAR == 1-K) goto L8252;
if(FOOBAR != 0)SPK=151;
return(2011);
L8252: FOOBAR=K;
if(K != 4) return(2009);
FOOBAR=0;
if(PLACE[EGGS] == PLAC[EGGS] || (TOTING(EGGS) && LOC == PLAC[EGGS]))
return(2011);
/* Bring back troll if we steal the eggs back from him before crossing. */
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);
return(2012);
/* Brief. Intransitive only. Suppress long descriptions after first time. */
L8260: SPK=156;
ABBNUM=10000;
DETAIL=3;
return(2011);
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
L8270: for (I=1; I<=100; I++) {
if(HERE(I) && OBJTXT[I] != 0 && PROP[I] >= 0)OBJ=OBJ*100+I;
} /* end loop */
if(OBJ > 100 || OBJ == 0 || DARK(0)) return(8000);
L9270: if(DARK(0)) goto L5190;
if(OBJTXT[OBJ] == 0 || PROP[OBJ] < 0) return(2011);
if(OBJ == OYSTER && !CLSHNT) goto L9275;
PSPEAK(OBJ,OBJTXT[OBJ]+PROP[OBJ]);
return(2012);
L9275: CLSHNT=YES(192,193,54);
return(2012);
/* Break. Only works for mirror in repository and, of course, the vase. */
L9280: if(OBJ == MIRROR)SPK=148;
if(OBJ == VASE && PROP[VASE] == 0) goto L9282;
if(OBJ != MIRROR || !CLOSED) return(2011);
SPK=197;
return(18999);
L9282: SPK=198;
if(TOTING(VASE))DROP(VASE,LOC);
PROP[VASE]=2;
FIXED[VASE]= -1;
return(2011);
/* Wake. Only use is to disturb the dwarves. */
L9290: if(OBJ != DWARF || !CLOSED) return(2011);
SPK=199;
return(18999);
/* Suspend. Offer to save things in a file, but charging some points (so
* can't win by using saved games to retry battles or to start over after
* learning zzword). */
L8300: SPK=201;
RSPEAK(260);
if(!YES(200,54,54)) return(2012);
SAVED=SAVED+5;
KK= -1;
/* This next part is shared with the "resume" code. The two cases are
* distinguished by the value of kk (-1 for suspend, +1 for resume). */
L8305: DATIME(I,K);
K=I+650*K;
SAVWRD(KK,K);
K=VRSION;
SAVWRD(0,K);
if(K != VRSION) goto L8312;
/* Herewith are all the variables whose values can change during a game,
* omitting a few (such as I, J, ATTACK) whose values between turns are
* irrelevant and some whose values when a game is
* suspended or resumed are guaranteed to match. If unsure whether a value
* needs to be saved, include it. Overkill can't hurt. Pad the last savwds
* with junk variables to bring it up to 7 values. */
SAVWDS(ABBNUM,BLKLIN,BONUS,CLOCK1,CLOCK2,CLOSED,CLOSNG);
SAVWDS(DETAIL,DFLAG,DKILL,DTOTAL,FOOBAR,HOLDNG,IWEST);
SAVWDS(KNFLOC,LIMIT,LL,LMWARN,LOC,NEWLOC,NUMDIE);
SAVWDS(OBJ,OLDLC2,OLDLOC,OLDOBJ,PANIC,SAVED,SETUP);
SAVWDS(SPK,TALLY,THRESH,TRNDEX,TRNLUZ,TURNS,OBJTXT[OYSTER]);
SAVWDS(VERB,WD1,WD1X,WD2,WZDARK,ZZWORD,OBJSND[BIRD]);
SAVWDS(OBJTXT[SIGN],CLSHNT,NOVICE,K,K,K,K);
SAVARR(ABB,LOCSIZ);
SAVARR(ATLOC,LOCSIZ);
SAVARR(DLOC,6);
SAVARR(DSEEN,6);
SAVARR(FIXED,100);
SAVARR(HINTED,HNTSIZ);
SAVARR(HINTLC,HNTSIZ);
SAVARR(LINK,200);
SAVARR(ODLOC,6);
SAVARR(PLACE,100);
SAVARR(PROP,100);
SAVWRD(KK,K);
if(K != 0) goto L8318;
K=NUL;
ZZWORD=RNDVOC(3,ZZWORD-MESH*2)+MESH*2;
if(KK > 0) return(8);
RSPEAK(266);
exit(0);
/* Resume. Read a suspended game back from a file. */
L8310: KK=1;
if(LOC == 1 && ABB[1] == 1) goto L8305;
RSPEAK(268);
if(!YES(200,54,54)) return(2012);
goto L8305;
L8312: SETPRM(1,K/10,MOD(K,10));
SETPRM(3,VRSION/10,MOD(VRSION,10));
RSPEAK(269);
return(2000);
L8318: RSPEAK(270);
exit(0);
/* Fly. Snide remarks unless hovering rug is here. */
L8320: if(PROP[RUG] != 2)SPK=224;
if(!HERE(RUG))SPK=225;
if(SPK/2 == 112) return(2011);
OBJ=RUG;
L9320: if(OBJ != RUG) return(2011);
SPK=223;
if(PROP[RUG] != 2) return(2011);
OLDLC2=OLDLOC;
OLDLOC=LOC;
NEWLOC=PLACE[RUG]+FIXED[RUG]-LOC;
SPK=226;
if(PROP[SAPPH] >= 0)SPK=227;
RSPEAK(SPK);
return(2);
/* Listen. Intransitive only. Print stuff based on objsnd/locsnd. */
L8330: SPK=228;
K=LOCSND[LOC];
if(K == 0) goto L8332;
RSPEAK(IABS(K));
if(K < 0) return(2012);
SPK=0;
L8332: SETPRM(1,ZZWORD-MESH*2,0);
/* 8335 */ for (I=1; I<=100; I++) {
if(!HERE(I) || OBJSND[I] == 0 || PROP[I] < 0) goto L8335;
PSPEAK(I,OBJSND[I]+PROP[I]);
SPK=0;
if(I == BIRD && OBJSND[I]+PROP[I] == 8)DSTROY(BIRD);
L8335: /*etc*/ ;
} /* end loop */
return(2011);
/* Z'ZZZ (word gets recomputed at startup; different each game). */
L8340: if(!AT(RESER) && LOC != FIXED[RESER]-1) return(2011);
PSPEAK(RESER,PROP[RESER]+1);
PROP[RESER]=1-PROP[RESER];
if(AT(RESER)) return(2012);
OLDLC2=LOC;
NEWLOC=0;
RSPEAK(241);
return(2);
}

View file

@ -1,349 +0,0 @@
#include "misc.h"
#include "main.h"
#include "share.h"
#include "funcs.h"
/* Carry an object. Special cases for bird and cage (if bird in cage, can't
* take one without the other). Liquids also special, since they depend on
* status of bottle. Also various side effects, etc. */
int carry(void) {
if(TOTING(OBJ)) return(2011);
SPK=25;
if(OBJ == PLANT && PROP[PLANT] <= 0)SPK=115;
if(OBJ == BEAR && PROP[BEAR] == 1)SPK=169;
if(OBJ == CHAIN && PROP[BEAR] != 0)SPK=170;
if(OBJ == URN)SPK=215;
if(OBJ == CAVITY)SPK=217;
if(OBJ == BLOOD)SPK=239;
if(OBJ == RUG && PROP[RUG] == 2)SPK=222;
if(OBJ == SIGN)SPK=196;
if(OBJ != MESSAG) goto L9011;
SPK=190;
DSTROY(MESSAG);
L9011: if(FIXED[OBJ] != 0) return(2011);
if(OBJ != WATER && OBJ != OIL) goto L9017;
K=OBJ;
OBJ=BOTTLE;
if(HERE(BOTTLE) && LIQ(0) == K) goto L9017;
if(TOTING(BOTTLE) && PROP[BOTTLE] == 1) return(fill());
if(PROP[BOTTLE] != 1)SPK=105;
if(!TOTING(BOTTLE))SPK=104;
return(2011);
L9017: SPK=92;
if(HOLDNG >= 7) return(2011);
if(OBJ != BIRD || PROP[BIRD] == 1 || -1-PROP[BIRD] == 1) goto L9014;
if(PROP[BIRD] == 2) goto L9015;
if(!TOTING(CAGE))SPK=27;
if(TOTING(ROD))SPK=26;
if(SPK/2 == 13) return(2011);
PROP[BIRD]=1;
L9014: if((OBJ == BIRD || OBJ == CAGE) && (PROP[BIRD] == 1 || -1-PROP[BIRD] ==
1))CARRY(BIRD+CAGE-OBJ,LOC);
CARRY(OBJ,LOC);
K=LIQ(0);
if(OBJ == BOTTLE && K != 0)PLACE[K]= -1;
if(!GSTONE(OBJ) || PROP[OBJ] == 0) return(2009);
PROP[OBJ]=0;
PROP[CAVITY]=1;
return(2009);
L9015: SPK=238;
DSTROY(BIRD);
return(2011);
}
/* Discard object. "Throw" also comes here for most objects. Special cases for
* bird (might attack snake or dragon) and cage (might contain bird) and vase.
* Drop coins at vending machine for extra batteries. */
int discard(bool just_do_it) {
if(just_do_it) goto L9021;
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
if(!TOTING(OBJ)) return(2011);
if(OBJ != BIRD || !HERE(SNAKE)) goto L9023;
RSPEAK(30);
if(CLOSED) return(19000);
DSTROY(SNAKE);
/* SET PROP FOR USE BY TRAVEL OPTIONS */
PROP[SNAKE]=1;
L9021: K=LIQ(0);
if(K == OBJ)OBJ=BOTTLE;
if(OBJ == BOTTLE && K != 0)PLACE[K]=0;
if(OBJ == CAGE && PROP[BIRD] == 1)DROP(BIRD,LOC);
DROP(OBJ,LOC);
if(OBJ != BIRD) return(2012);
PROP[BIRD]=0;
if(FOREST(LOC))PROP[BIRD]=2;
return(2012);
L9023: if(!(GSTONE(OBJ) && AT(CAVITY) && PROP[CAVITY] != 0)) goto L9024;
RSPEAK(218);
PROP[OBJ]=1;
PROP[CAVITY]=0;
if(!HERE(RUG) || !((OBJ == EMRALD && PROP[RUG] != 2) || (OBJ == RUBY &&
PROP[RUG] == 2))) goto L9021;
SPK=219;
if(TOTING(RUG))SPK=220;
if(OBJ == RUBY)SPK=221;
RSPEAK(SPK);
if(SPK == 220) goto L9021;
K=2-PROP[RUG];
PROP[RUG]=K;
if(K == 2)K=PLAC[SAPPH];
MOVE(RUG+100,K);
goto L9021;
L9024: if(OBJ != COINS || !HERE(VEND)) goto L9025;
DSTROY(COINS);
DROP(BATTER,LOC);
PSPEAK(BATTER,0);
return(2012);
L9025: if(OBJ != BIRD || !AT(DRAGON) || PROP[DRAGON] != 0) goto L9026;
RSPEAK(154);
DSTROY(BIRD);
PROP[BIRD]=0;
return(2012);
L9026: if(OBJ != BEAR || !AT(TROLL)) goto L9027;
RSPEAK(163);
MOVE(TROLL,0);
MOVE(TROLL+100,0);
MOVE(TROLL2,PLAC[TROLL]);
MOVE(TROLL2+100,FIXD[TROLL]);
JUGGLE(CHASM);
PROP[TROLL]=2;
goto L9021;
L9027: if(OBJ == VASE && LOC != PLAC[PILLOW]) goto L9028;
RSPEAK(54);
goto L9021;
L9028: PROP[VASE]=2;
if(AT(PILLOW))PROP[VASE]=0;
PSPEAK(VASE,PROP[VASE]+1);
if(PROP[VASE] != 0)FIXED[VASE]= -1;
goto L9021;
}
/* Attack. Assume target if unambiguous. "Throw" also links here. Attackable
* objects fall into two categories: enemies (snake, dwarf, etc.) and others
* (bird, clam, machine). Ambiguous if 2 enemies, or no enemies but 2 others. */
int attack() {
I=ATDWRF(LOC);
if(OBJ != 0) goto L9124;
if(I > 0)OBJ=DWARF;
if(HERE(SNAKE))OBJ=OBJ*100+SNAKE;
if(AT(DRAGON) && PROP[DRAGON] == 0)OBJ=OBJ*100+DRAGON;
if(AT(TROLL))OBJ=OBJ*100+TROLL;
if(AT(OGRE))OBJ=OBJ*100+OGRE;
if(HERE(BEAR) && PROP[BEAR] == 0)OBJ=OBJ*100+BEAR;
if(OBJ > 100) return(8000);
if(OBJ != 0) goto L9124;
/* CAN'T ATTACK BIRD OR MACHINE BY THROWING AXE. */
if(HERE(BIRD) && VERB != THROW)OBJ=BIRD;
if(HERE(VEND) && VERB != THROW)OBJ=OBJ*100+VEND;
/* CLAM AND OYSTER BOTH TREATED AS CLAM FOR INTRANSITIVE CASE; NO HARM DONE. */
if(HERE(CLAM) || HERE(OYSTER))OBJ=100*OBJ+CLAM;
if(OBJ > 100) return(8000);
L9124: if(OBJ != BIRD) goto L9125;
SPK=137;
if(CLOSED) return(2011);
DSTROY(BIRD);
PROP[BIRD]=0;
SPK=45;
L9125: if(OBJ != VEND) goto L9126;
PSPEAK(VEND,PROP[VEND]+2);
PROP[VEND]=3-PROP[VEND];
return(2012);
L9126: if(OBJ == 0)SPK=44;
if(OBJ == CLAM || OBJ == OYSTER)SPK=150;
if(OBJ == SNAKE)SPK=46;
if(OBJ == DWARF)SPK=49;
if(OBJ == DWARF && CLOSED) return(19000);
if(OBJ == DRAGON)SPK=167;
if(OBJ == TROLL)SPK=157;
if(OBJ == OGRE)SPK=203;
if(OBJ == OGRE && I > 0) goto L9128;
if(OBJ == BEAR)SPK=165+(PROP[BEAR]+1)/2;
if(OBJ != DRAGON || PROP[DRAGON] != 0) return(2011);
/* Fun stuff for dragon. If he insists on attacking it, win! Set PROP to dead,
* move dragon to central loc (still fixed), move rug there (not fixed), and
* move him there, too. Then do a null motion to get new description. */
RSPEAK(49);
VERB=0;
OBJ=0;
GETIN(WD1,WD1X,WD2,WD2X);
if(WD1 != MAKEWD(25) && WD1 != MAKEWD(250519)) return(2607);
PSPEAK(DRAGON,3);
PROP[DRAGON]=1;
PROP[RUG]=0;
K=(PLAC[DRAGON]+FIXD[DRAGON])/2;
MOVE(DRAGON+100,-1);
MOVE(RUG+100,0);
MOVE(DRAGON,K);
MOVE(RUG,K);
DROP(BLOOD,K);
for (OBJ=1; OBJ<=100; OBJ++) {
if(PLACE[OBJ] == PLAC[DRAGON] || PLACE[OBJ] == FIXD[DRAGON])MOVE(OBJ,K);
/*etc*/ ;
} /* end loop */
LOC=K;
K=NUL;
return(8);
L9128: RSPEAK(SPK);
RSPEAK(6);
DSTROY(OGRE);
K=0;
/* 9129 */ for (I=1; I<=5; I++) {
if(DLOC[I] != LOC) goto L9129;
K=K+1;
DLOC[I]=61;
DSEEN[I]=false;
L9129: /*etc*/ ;
} /* end loop */
SPK=SPK+1+1/K;
return(2011);
}
/* Throw. Same as discard unless axe. Then same as attack except ignore bird,
* and if dwarf is present then one might be killed. (Only way to do so!)
* Axe also special for dragon, bear, and troll. Treasures special for troll. */
int throw() {
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
if(!TOTING(OBJ)) return(2011);
if(OBJ >= 50 && OBJ <= MAXTRS && AT(TROLL)) goto L9178;
if(OBJ == FOOD && HERE(BEAR)) goto L9177;
if(OBJ != AXE) return(discard(false));
I=ATDWRF(LOC);
if(I > 0) goto L9172;
SPK=152;
if(AT(DRAGON) && PROP[DRAGON] == 0) goto L9175;
SPK=158;
if(AT(TROLL)) goto L9175;
SPK=203;
if(AT(OGRE)) goto L9175;
if(HERE(BEAR) && PROP[BEAR] == 0) goto L9176;
OBJ=0;
return(attack());
L9172: SPK=48;
if(RAN(7) < DFLAG) goto L9175;
DSEEN[I]=false;
DLOC[I]=0;
SPK=47;
DKILL=DKILL+1;
if(DKILL == 1)SPK=149;
L9175: RSPEAK(SPK);
DROP(AXE,LOC);
K=NUL;
return(8);
/* This'll teach him to throw the axe at the bear! */
L9176: SPK=164;
DROP(AXE,LOC);
FIXED[AXE]= -1;
PROP[AXE]=1;
JUGGLE(BEAR);
return(2011);
/* But throwing food is another story. */
L9177: OBJ=BEAR;
return(feed());
L9178: SPK=159;
/* Snarf a treasure for the troll. */
DROP(OBJ,0);
MOVE(TROLL,0);
MOVE(TROLL+100,0);
DROP(TROLL2,PLAC[TROLL]);
DROP(TROLL2+100,FIXD[TROLL]);
JUGGLE(CHASM);
return(2011);
}
/* Feed. If bird, no seed. Snake, dragon, troll: quip. If dwarf, make him
* mad. Bear, special. */
int feed() {
if(OBJ != BIRD) goto L9212;
SPK=100;
return(2011);
L9212: if(OBJ != SNAKE && OBJ != DRAGON && OBJ != TROLL) goto L9213;
SPK=102;
if(OBJ == DRAGON && PROP[DRAGON] != 0)SPK=110;
if(OBJ == TROLL)SPK=182;
if(OBJ != SNAKE || CLOSED || !HERE(BIRD)) return(2011);
SPK=101;
DSTROY(BIRD);
PROP[BIRD]=0;
return(2011);
L9213: if(OBJ != DWARF) goto L9214;
if(!HERE(FOOD)) return(2011);
SPK=103;
DFLAG=DFLAG+2;
return(2011);
L9214: if(OBJ != BEAR) goto L9215;
if(PROP[BEAR] == 0)SPK=102;
if(PROP[BEAR] == 3)SPK=110;
if(!HERE(FOOD)) return(2011);
DSTROY(FOOD);
PROP[BEAR]=1;
FIXED[AXE]=0;
PROP[AXE]=0;
SPK=168;
return(2011);
L9215: if(OBJ != OGRE) goto L9216;
if(HERE(FOOD))SPK=202;
return(2011);
L9216: SPK=14;
return(2011);
}
/* Fill. Bottle or urn must be empty, and liquid available. (Vase is nasty.) */
int fill() {
if(OBJ == VASE) goto L9222;
if(OBJ == URN) goto L9224;
if(OBJ != 0 && OBJ != BOTTLE) return(2011);
if(OBJ == 0 && !HERE(BOTTLE)) return(8000);
SPK=107;
if(LIQLOC(LOC) == 0)SPK=106;
if(HERE(URN) && PROP[URN] != 0)SPK=214;
if(LIQ(0) != 0)SPK=105;
if(SPK != 107) return(2011);
PROP[BOTTLE]=MOD(COND[LOC],4)/2*2;
K=LIQ(0);
if(TOTING(BOTTLE))PLACE[K]= -1;
if(K == OIL)SPK=108;
return(2011);
L9222: SPK=29;
if(LIQLOC(LOC) == 0)SPK=144;
if(LIQLOC(LOC) == 0 || !TOTING(VASE)) return(2011);
RSPEAK(145);
PROP[VASE]=2;
FIXED[VASE]= -1;
return(discard(true));
L9224: SPK=213;
if(PROP[URN] != 0) return(2011);
SPK=144;
K=LIQ(0);
if(K == 0 || !HERE(BOTTLE)) return(2011);
PLACE[K]=0;
PROP[BOTTLE]=1;
if(K == OIL)PROP[URN]=1;
SPK=211+PROP[URN];
return(2011);
}

93
advent.adoc Normal file
View file

@ -0,0 +1,93 @@
= advent(6) =
:doctype: manpage
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
// batchspell: add advent logfile savefile roleplaying Gillogly PDP Ctrl-D
// batchspell: add EOF autosave endianness wumpus zork nethack
== NAME ==
advent - Colossal Cave Adventure
== SYNOPSIS ==
*advent* [-l logfile] [-o] [-r savefile] [-a savefile] [script...]
== DESCRIPTION ==
The original Colossal Cave Adventure from 1976-1977 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
authors, in 1995. It has been known as "adventure 2.5" and "430-point
adventure". To learn more about the changes since the 350-point
original, type 'news' at the command prompt.
There is an 'adventure' in the BSD games package that is a C port by
Jim Gillogly of the 1977 version. To avoid a name collision, this game
builds as 'advent', reflecting the fact that the PDP-10 on which the
game originally ran limited filenames to 6 characters.
This version is released as open source with the permission and
encouragement of the original authors.
Unlike the original, this version has a command prompt and supports
use of your arrow keys to edit your command line in place. Basic
Emacs keystrokes are supported, and your up/down arrows access a
command history.
Some minor bugs and message typos have been fixed. Otherwise, the
"version" command is almost the only way to tell you're not running
Don's 1977 version until you get to the new cave sections added for
2.5.
To exit the game, type Ctrl-D (EOF).
There have been no gameplay changes.
== OPTIONS ==
-l:: Log commands to specified file.
-r:: Restore game from specified save file
-a:: Load from specified save file and autosave to it on exit or signal.
-o:: Old-style. Reverts some minor cosmetic fixes in game
messages. Restores original interface, no prompt or line editing.
Also ignores new-school one-letter commands l, x, g, z, i. Also
case-smashes and truncates unrecognized text when echoed.
Normally, game input is taken from standard input. If script file
arguments are given, input is taken from them instead. A script file
argument of '-' is taken as a directive to read from standard input.
== BUGS ==
The binary save file format is fragile, dependent on your machine's
endianness, and unlikely to survive through version bumps. There are
version and endianness checks when attempting to restore from a save.
The input parser was the first attempt *ever* at natural-language
parsing in a game and has some known deficiencies. While later text
adventures distinguished between transitive and intransitive verbs,
Adventure's grammar distinguishes only between motion and action
verbs. Motions are always immediate in their behavior, so both ACTION
MOTION and MOTION ACTION (and even MOTION NOUN and MOTION MOTION) are
invariably equivalent to MOTION (thus GO NORTH means NORTH and JUMP
DOWN means JUMP). Whereas, with actions and nouns, the parser collects
words until it's seen one of each, and then dispatches; if it reaches
the end of the command without seeing a noun, it'll dispatch an
"intransitive" action. This makes ACTION1 ACTION2 equivalent to
ACTION2 (thus TAKE INVENTORY means INVENTORY), and NOUN ACTION
equivalent to ACTION NOUN.
Thus you get anomalies like "eat building" interpreted as a command
to move to the building. These should not be reported as bugs; instead,
consider them historical curiosities.
== REPORTING BUGS ==
Report bugs to Eric S. Raymond <esr@thyrsus.com>. The project page is
at http://catb.org/~esr/open-adventure
== SEE ALSO ==
wumpus(6), adventure(6), zork(6), rogue(6), nethack(6).

10
advent.desktop Normal file
View file

@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
[Desktop Entry]
Type=Application
Name=Open Adventure
Comment=Colossal Cave Adventure, the 1995 430-point version
Icon=advent
Exec=advent
Terminal=true
Categories=Game;AdventureGame;ConsoleOnly

359
advent.h Normal file
View file

@ -0,0 +1,359 @@
/*
* Dungeon types and macros.
*
* SPDX-FileCopyrightText: (C) 1977, 2005 by Will Crowther and Don Woods
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <inttypes.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "dungeon.h"
/* LCG PRNG parameters tested against
* Knuth vol. 2. by the original authors */
#define LCG_A 1093L
#define LCG_C 221587L
#define LCG_M 1048576L
#define LINESIZE 1024
#define TOKLEN 5 // # outputting characters in a token */
#define PIRATE NDWARVES // must be NDWARVES-1 when zero-origin
#define DALTLC LOC_NUGGET // alternate dwarf location
#define INVLIMIT 7 // inventory limit (# of objects)
#define INTRANSITIVE -1 // illegal object number
#define GAMELIMIT 330 // base limit of turns
#define NOVICELIMIT 1000 // limit of turns for novice
#define WARNTIME 30 // late game starts at game.limit-this
#define FLASHTIME 50 // turns from first warning till blinding flash
#define PANICTIME 15 // time left after closing
#define BATTERYLIFE 2500 // turn limit increment from batteries
#define WORD_NOT_FOUND \
-1 // "Word not found" flag value for the vocab hash functions.
#define WORD_EMPTY 0 // "Word empty" flag value for the vocab hash functions
#define PIT_KILL_PROB 35 // Percentage probability of dying from fall in pit.
#define CARRIED -1 // Player is toting it
#define READ_MODE "rb" // b is not needed for POSIX but harmless
#define WRITE_MODE "wb" // b is not needed for POSIX but harmless
/* Special object-state values - integers > 0 are object-specific */
#define STATE_NOTFOUND -1 // 'Not found" state of treasures
#define STATE_FOUND 0 // After discovered, before messed with
#define STATE_IN_CAVITY 1 // State value common to all gemstones
/* Special fixed object-state values - integers > 0 are location */
#define IS_FIXED -1
#define IS_FREE 0
/* (ESR) It is fitting that translation of the original ADVENT should
* have left us a maze of twisty little conditionals that resists all
* understanding. Setting and use of what is now the per-object state
* member (which used to be an array of its own) is our mystery. This
* state tangles together information about whether the object is a
* treasure, whether the player has seen it yet, and its activation
* state.
*
* Things we think we know:
*
* STATE_NOTFOUND is only set on treasures. Non-treasures start the
* game in STATE_FOUND.
*
* PROP_STASHIFY is supposed to map a state property value to a
* negative range, where the object cannot be picked up but the value
* can be recovered later. Various objects get this property when
* the cave starts to close. Only seems to be significant for the bird
* and readable objects, notably the clam/oyster - but the code around
* those tests is difficult to read.
*
* All tests of the prop member are done with either these macros or ==.
*/
#define OBJECT_IS_NOTFOUND(obj) (game.objects[obj].prop == STATE_NOTFOUND)
#define OBJECT_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
#define OBJECT_SET_FOUND(obj) (game.objects[obj].prop = STATE_FOUND)
#define OBJECT_SET_NOT_FOUND(obj) (game.objects[obj].prop = STATE_NOTFOUND)
#define OBJECT_IS_NOTFOUND2(g, o) (g.objects[o].prop == STATE_NOTFOUND)
#define PROP_IS_INVALID(val) (val < -MAX_STATE - 1 || val > MAX_STATE)
#define PROP_STASHIFY(n) (-1 - (n))
#define OBJECT_STASHIFY(obj, pval) game.objects[obj].prop = PROP_STASHIFY(pval)
#define OBJECT_IS_STASHED(obj) (game.objects[obj].prop < STATE_NOTFOUND)
#define OBJECT_STATE_EQUALS(obj, pval) \
((game.objects[obj].prop == pval) || \
(game.objects[obj].prop == PROP_STASHIFY(pval)))
#define PROMPT "> "
/*
* DESTROY(N) = Get rid of an item by putting it in LOC_NOWHERE
* MOD(N,M) = Arithmetic modulus
* TOTING(OBJ) = true if the OBJ is being carried
* AT(OBJ) = true if on either side of two-placed object
* HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
* CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
* LIQUID() = object number of liquid in bottle
* LIQLOC(LOC) = object number of liquid (if any) at LOC
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
* IS_DARK_HERE() = true if location "LOC" is dark
* PCT(N) = true N% of the time (N integer from 0 to 100)
* GSTONE(OBJ) = true if OBJ is a gemstone
* FOREST(LOC) = true if LOC is part of the forest
* OUTSIDE(LOC) = true if location not in the cave
* INSIDE(LOC) = true if location is in the cave or the building at the
* beginning of the game
* INDEEP(LOC) = true if location is in the Hall of Mists or deeper
* BUG(X) = report bug and exit
*/
#define DESTROY(N) move(N, LOC_NOWHERE)
#define MOD(N, M) ((N) % (M))
#define TOTING(OBJ) (game.objects[OBJ].place == CARRIED)
#define AT(OBJ) \
(game.objects[OBJ].place == game.loc || \
game.objects[OBJ].fixed == game.loc)
#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
#define CNDBIT(L, N) (tstbit(conditions[L], N))
#define LIQUID() \
(game.objects[BOTTLE].prop == WATER_BOTTLE ? WATER \
: game.objects[BOTTLE].prop == OIL_BOTTLE ? OIL \
: NO_OBJECT)
#define LIQLOC(LOC) \
(CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \
: NO_OBJECT)
#define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
#define IS_DARK_HERE() \
(!CNDBIT(game.loc, COND_LIT) && \
(game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP)))
#define PCT(N) (randrange(100) < (N))
#define GSTONE(OBJ) \
((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
#define FOREST(LOC) CNDBIT(LOC, COND_FOREST)
#define OUTSIDE(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC))
#define INSIDE(LOC) (!OUTSIDE(LOC) || LOC == LOC_BUILDING)
#define INDEEP(LOC) CNDBIT((LOC), COND_DEEP)
#define BUG(x) bug(x, #x)
enum bugtype {
SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST,
VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3,
INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST,
TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST,
CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION,
LOCATION_HAS_NO_TRAVEL_ENTRIES,
HINT_NUMBER_EXCEEDS_GOTO_LIST,
SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN,
ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH,
};
enum speaktype { touch, look, hear, study, change };
enum termination { endgame, quitgame, scoregame };
enum speechpart { unknown, intransitive, transitive };
typedef enum { NO_WORD_TYPE, MOTION, OBJECT, ACTION, NUMERIC } word_type_t;
typedef enum scorebonus { none, splatter, defeat, victory } score_t;
/* Phase codes for action returns.
* These were at one time FORTRAN line numbers.
*/
typedef enum {
GO_TERMINATE,
GO_MOVE,
GO_TOP,
GO_CLEAROBJ,
GO_CHECKHINT,
GO_WORD2,
GO_UNKNOWN,
GO_DWARFWAKE,
} phase_codes_t;
/* Use fixed-lwength types to make the save format moore portable */
typedef int32_t vocab_t; // index into a vocabulary array */
typedef int32_t verb_t; // index into an actions array */
typedef int32_t obj_t; // index into the object array */
typedef int32_t loc_t; // index into the locations array */
typedef int32_t turn_t; // turn counter or threshold */
typedef int32_t bool32_t; // turn counter or threshold */
struct game_t {
int32_t lcg_x;
int32_t abbnum; // How often to print int descriptions
score_t bonus; // What kind of finishing bonus we are getting
loc_t chloc; // pirate chest location
loc_t chloc2; // pirate chest alternate location
turn_t clock1; // # turns from finding last treasure to close
turn_t clock2; // # turns from warning till blinding flash
bool32_t clshnt; // has player read the clue in the endgame?
bool32_t closed; // whether we're all the way closed
bool32_t closng; // whether it's closing time yet
bool32_t lmwarn; // has player been warned about lamp going dim?
bool32_t novice; // asked for instructions at start-up?
bool32_t panic; // has player found out he's trapped?
bool32_t wzdark; // whether the loc he's leaving was dark
bool32_t blooded; // has player drunk of dragon's blood?
int32_t conds; // min value for cond[loc] if loc has any hints
int32_t detail; // level of detail in descriptions
/* dflag controls the level of activation of dwarves:
* 0 No dwarf stuff yet (wait until reaches Hall Of Mists)
* 1 Reached Hall Of Mists, but hasn't met first dwarf
* 2 Met 1t dwarf, others start moving, no knives thrown yet
* 3 A knife has been thrown (first set always misses) 3+
* Dwarves are mad (increases their accuracy) */
int32_t dflag;
int32_t dkill; // dwarves killed
int32_t dtotal; // total dwarves (including pirate) in loc
int32_t foobar; // progress in saying "FEE FIE FOE FOO".
int32_t holdng; // number of objects being carried
int32_t igo; // # uses of "go" instead of a direction
int32_t iwest; // # times he's said "west" instead of "w"
loc_t knfloc; // knife location; LOC_NOWERE if none, -1 after caveat
turn_t limit; // lifetime of lamp
loc_t loc; // where player is now
loc_t newloc; // where player is going
turn_t numdie; // number of times killed so far
loc_t oldloc; // where player was
loc_t oldlc2; // where player was two moves ago
obj_t oldobj; // last object player handled
int32_t saved; // point penalty for saves
int32_t tally; // count of treasures gained
int32_t thresh; // current threshold for endgame scoring tier
bool32_t seenbigwords; // have we red the graffiti in the Giant's Room?
turn_t trnluz; // # points lost so far due to turns used
turn_t turns; // counts commands given (ignores yes/no)
char zzword[TOKLEN + 1]; // randomly generated magic word from bird
struct {
int32_t abbrev; // has location been seen?
int32_t atloc; // head of object linked list per location
} locs[NLOCATIONS + 1];
struct {
int32_t seen; // true if dwarf has seen him
loc_t loc; // location of dwarves, initially hard-wired in
loc_t oldloc; // prior loc of each dwarf, initially garbage
} dwarves[NDWARVES + 1];
struct {
loc_t fixed; // fixed location of object (if not IS_FREE)
int32_t prop; // object state
loc_t place; // location of object
} objects[NOBJECTS + 1];
struct {
bool32_t used; // hints[i].used = true iff hint i has been used.
int32_t lc; // hints[i].lc = show int at LOC with cond bit i
} hints[NHINTS];
obj_t link[NOBJECTS * 2 + 1]; // object-list links
};
/*
* Game application settings - settings, but not state of the game, per se.
* This data is not saved in a saved game.
*/
struct settings_t {
FILE *logfp;
bool oldstyle;
bool prompt;
char **argv;
int argc;
int optind;
FILE *scriptfp;
int debug;
};
typedef struct {
char raw[LINESIZE];
vocab_t id;
word_type_t type;
} command_word_t;
typedef enum {
EMPTY,
RAW,
TOKENIZED,
GIVEN,
PREPROCESSED,
PROCESSING,
EXECUTED
} command_state_t;
typedef struct {
enum speechpart part;
command_word_t word[2];
verb_t verb;
obj_t obj;
command_state_t state;
} command_t;
/*
* Bump on save format change.
*
* Note: Verify that the tests run clean before bumping this, then rebuild the
* check files afterwards. Otherwise you will get a spurious failure due to the
* old version having been generated into a check file.
*/
#define SAVE_VERSION 31
/*
* Goes at start of file so saves can be identified by file(1) and the like.
*/
#define ADVENT_MAGIC "open-adventure\n"
/*
* If you change the first three members, the resume function may not properly
* reject saves from older versions. Later members can change, but bump the
* version when you do that.
*/
struct save_t {
char magic[sizeof(ADVENT_MAGIC)];
int32_t version;
int32_t canary;
struct game_t game;
};
extern struct game_t game;
extern struct save_t save;
extern struct settings_t settings;
extern char *myreadline(const char *);
extern bool get_command_input(command_t *);
extern void clear_command(command_t *);
extern void speak(const char *, ...);
extern void sspeak(int msg, ...);
extern void pspeak(vocab_t, enum speaktype, bool, int, ...);
extern void rspeak(vocab_t, ...);
extern void echo_input(FILE *, const char *, const char *);
extern bool silent_yes_or_no(void);
extern bool yes_or_no(const char *, const char *, const char *);
extern void juggle(obj_t);
extern void move(obj_t, loc_t);
extern void put(obj_t, loc_t, int);
extern void carry(obj_t, loc_t);
extern void drop(obj_t, loc_t);
extern int atdwrf(loc_t);
extern int setbit(int);
extern bool tstbit(int, int);
extern void set_seed(int32_t);
extern int32_t randrange(int32_t);
extern int score(enum termination);
extern void terminate(enum termination) __attribute__((noreturn));
extern int savefile(FILE *);
#if defined ADVENT_AUTOSAVE
extern void autosave(void);
#endif
extern int suspend(void);
extern int resume(void);
extern int restore(FILE *);
extern int initialise(void);
extern phase_codes_t action(command_t);
extern void state_change(obj_t, int);
extern bool is_valid(struct game_t);
extern void bug(enum bugtype, const char *) __attribute__((__noreturn__));
/* represent an empty command word */
static const command_word_t empty_command_word = {
.raw = "",
.id = WORD_EMPTY,
.type = NO_WORD_TYPE,
};
/* end */

106
advent.svg Normal file
View file

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!--
SPDX-FileCopyrightText: 2017 Dr. Tobias Quathamer <toddy@debian.org>
SPDX-License-Identifier: BSD-2-Clause
-->
<svg width="128" height="128" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<!-- gradient for the brass body -->
<linearGradient id="brass">
<stop offset="5%" stop-color="#b5a642" />
<stop offset="95%" stop-color="#e7d874" />
</linearGradient>
<!-- body of lamp -->
<path d="m40,118 c-6,0 -8,2 -8,8 h64 c0,-6 -2,-8 -8,-8"
fill="url(#brass)" stroke="black" stroke-width="1" />
<rect x="40" y="98" width="48" height="20"
fill="url(#brass)" stroke="black" stroke-width="1" />
<!-- glass around lamp light -->
<rect x="45" y="78" width="38" height="20"
fill="#ddd" stroke="black" stroke-width="1" />
<!-- gradient for the flame -->
<linearGradient id="flame" gradientTransform="rotate(90)">
<stop offset="20%" stop-color="yellow" />
<stop offset="100%" stop-color="#fa0" />
</linearGradient>
<!-- flame -->
<path d="m59,98 c-2,-4 -2,-6 1,-10 c2,-2.67 2,-3 4,-7 c2,4 2,4.33 4,7 c3,4 3,6 1,10 z"
fill="url(#flame)" stroke="black" stroke-width="1" />
<!-- brass bars around glass -->
<rect x="40" y="78" width="2" height="20"
fill="#b5a642" stroke="black" stroke-width="1" />
<rect x="50" y="78" width="2" height="20"
fill="#bfb04c" stroke="black" stroke-width="1" />
<rect x="76" y="78" width="2" height="20"
fill="#ddce6a" stroke="black" stroke-width="1" />
<rect x="86" y="78" width="2" height="20"
fill="#e7d874" stroke="black" stroke-width="1" />
<!-- top brass plate -->
<rect x="40" y="76" width="48" height="2"
fill="url(#brass)" stroke="black" stroke-width="1" />
<!-- gradient for the metal mesh -->
<linearGradient id="meshcolor">
<stop offset="5%" stop-color="#888" />
<stop offset="95%" stop-color="#aaa" />
</linearGradient>
<!-- two lines of little holes -->
<pattern id="mesh" x="50" y="0" width="28" height="6" patternUnits="userSpaceOnUse">
<!-- rectangle for the metal background -->
<rect x="0" y="0" width="28" height="10" fill="url(#meshcolor)" />
<!-- first line of holes -->
<circle cx="2" cy="2" r="1" fill="white" />
<circle cx="5" cy="2" r="1" fill="white" />
<circle cx="8" cy="2" r="1" fill="white" />
<circle cx="11" cy="2" r="1" fill="white" />
<circle cx="14" cy="2" r="1" fill="white" />
<circle cx="17" cy="2" r="1" fill="white" />
<circle cx="20" cy="2" r="1" fill="white" />
<circle cx="23" cy="2" r="1" fill="white" />
<circle cx="26" cy="2" r="1" fill="white" />
<!-- second line of holes -->
<circle cx="0.5" cy="5" r="1" fill="white" />
<circle cx="3.5" cy="5" r="1" fill="white" />
<circle cx="6.5" cy="5" r="1" fill="white" />
<circle cx="9.5" cy="5" r="1" fill="white" />
<circle cx="12.5" cy="5" r="1" fill="white" />
<circle cx="15.5" cy="5" r="1" fill="white" />
<circle cx="18.5" cy="5" r="1" fill="white" />
<circle cx="21.5" cy="5" r="1" fill="white" />
<circle cx="24.5" cy="5" r="1" fill="white" />
<circle cx="27.5" cy="5" r="1" fill="white" />
</pattern>
<!-- metal mesh -->
<rect x="50" y="24" width="28" height="52"
fill="url(#mesh)" stroke="black" stroke-width="1" />
<!-- brass bars around mesh -->
<path d="m50,24 l-10,52 h2 l10,-52"
fill="#b5a642" stroke="black" stroke-width="1" />
<rect x="63" y="24" width="2" height="52"
fill="#cebf5b" stroke="black" stroke-width="1" />
<path d="m76,24 l10,52 h2 l-10,-52"
fill="#e7d874" stroke="black" stroke-width="1" />
<!-- hook on top, needs to be drawn before the lid -->
<path d="m63,19.5 v-5 a5,5 0 1,0 -5,-5 h-2 a7,7 0 1,1 9,6.7 v3.5"
fill="#cebf5b" stroke="black" stroke-width="1" />
<!-- top brass lid -->
<path d="m50,24 c12,-6 16,-6 28,0 z"
fill="url(#brass)" stroke="black" stroke-width="1" />
</svg>

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -1,42 +0,0 @@
= advent(6) =
:doctype: manpage
== NAME ==
advent - Colossal Cave Adventure
== SYNOPSIS ==
*advent*
== DESCRIPTION ==
The original Colossal Cave Adventure from 1976 was the origin of all
text adventures, dungeon-crawl games, and computer-hosted roleplaying
games.
This is the last version released by Crowther & Woods, its original
authors, in 1995. It has been known as "adventure 2.5" and "430-point
adventure".
This game is released as open source with the permission and encouragement of
the authors.
There is an 'adventure' in the BSD games package that is a C
port of the 1976 ancestor of this game. To avoid a name collision,
this game builds as 'advent', reflecting the fact that the PDP-10
on which it originally ran limited filenames to 6 characters.
== OPTIONS ==
-l:: Log commands to specified file.
-o:: Old-style. Restores original interface, no prompt.
== ENVIRONMENT VARIABLES ==
ADVENTURE::
Path to the text database file describing Colossal Cave.
== REPORTING BUGS ==
Report bugs to Eric S. Raymond <esr@thyrsus.com>. The project page is
at http://catb.org/~esr/advent
== SEE ALSO ==
wumpus(6), adventure(6), zork(6), rogue(6), nethack(6).

File diff suppressed because it is too large Load diff

4239
adventure.yaml Normal file

File diff suppressed because it is too large Load diff

105
cheat.c Normal file
View file

@ -0,0 +1,105 @@
/*
* 'cheat' is a tool for generating save game files to test states that ought
* not happen. It leverages chunks of advent, mostly initialize() and
* savefile(), so we know we're always outputting save files that advent
* can import.
*
* SPDX-FileCopyrightText: (C) 1977, 2005 by Will Crowther and Don Woods
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "advent.h"
#include <editline/readline.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int ch;
char *savefilename = NULL;
FILE *fp = NULL;
// Initialize game variables
initialise();
/* we're generating a saved game, so saved once by default,
* unless overridden with command-line options below.
*/
game.saved = 1;
/* Options. */
const char *opts = "d:l:s:t:v:o:";
const char *usage =
"Usage: %s [-d numdie] [-s numsaves] [-v version] -o savefilename "
"\n"
" -d number of deaths. Signed integer.\n"
" -l lifetime of lamp in turns. Signed integer.\n"
" -s number of saves. Signed integer.\n"
" -t number of turns. Signed integer.\n"
" -v version number of save format.\n"
" -o required. File name of save game to write.\n";
while ((ch = getopt(argc, argv, opts)) != EOF) {
switch (ch) {
case 'd':
game.numdie = (turn_t)atoi(optarg);
printf("cheat: game.numdie = %d\n", game.numdie);
break;
case 'l':
game.limit = (turn_t)atoi(optarg);
printf("cheat: game.limit = %d\n", game.limit);
break;
case 's':
game.saved = (int)atoi(optarg);
printf("cheat: game.saved = %d\n", game.saved);
break;
case 't':
game.turns = (turn_t)atoi(optarg);
printf("cheat: game.turns = %d\n", game.turns);
break;
case 'v':
save.version = atoi(optarg);
printf("cheat: version = %d\n", save.version);
break;
case 'o':
savefilename = optarg;
break;
default:
fprintf(stderr, usage, argv[0]);
exit(EXIT_FAILURE);
break;
}
}
// Save filename required; the point of cheat is to generate save file
if (savefilename == NULL) {
fprintf(stderr, usage, argv[0]);
fprintf(stderr, "ERROR: filename required\n");
exit(EXIT_FAILURE);
}
fp = fopen(savefilename, WRITE_MODE);
if (fp == NULL) {
fprintf(stderr, "Can't open file %s. Exiting.\n", savefilename);
exit(EXIT_FAILURE);
}
savefile(fp);
fclose(fp);
printf("cheat: %s created.\n", savefilename);
return EXIT_SUCCESS;
}
// LCOV_EXCL_START
/*
* Ugh...unused, but required for linkage.
* See the actually useful version of this in main.c
*/
char *myreadline(const char *prompt) { return readline(prompt); }
// LCOV_EXCL_STOP
/* end */

25
control
View file

@ -1,22 +1,29 @@
# This is not a real Debian control file
# It's project metadata for the shipper tool
Package: advent
Package: open-adventure
Description: Colossal Cave Adventure, the 1995 430-point version.
This is the last descendent of the original 1976 Colossal Cave Adventure
worked on by the original authors - Crowther & Woods. It has sometimes
been known as Adventure 2.5. The original PDP-10 name 'advent' is used
to avoid collision with the BSD Games version.
This is the last descendant of the original 1976 Colossal Cave Adventure
worked on by the original authors - Crowther & Woods; it is shipped with
their permission and encouragement. It has sometimes been known as
Adventure 2.5. The original PDP-10 name 'advent' is used for the
built program to avoid collision with the BSD Games version.
#XBS-Destinations: freshcode
Homepage: http://www.catb.org/~esr/advent
Homepage: http://www.catb.org/~esr/open-adventure
XBS-HTML-Target: index.html
XBS-Repository-URL: https://gitlab.com/esr/open-adventure
#XBS-Project-Tags: Games/Entertainment
XBS-Debian-Packages: open-adventure
XBS-IRC-Channel: irc://chat.freenode.net/#open-adventure
XBS-Project-Tags: Games/Entertainment
XBS-VC-Tag-Template: %(version)s
XBS-Logo: lamp.png
XBS-Validate: make pylint cppcheck check

45
funcs.h
View file

@ -1,45 +0,0 @@
#include <stdbool.h>
/* Statement functions
*
* AT(OBJ) = true if on either side of two-placed object
* CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
* DARK(DUMMY) = true if location "LOC" is dark
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
* FOREST(LOC) = true if LOC is part of the forest
* GSTONE(OBJ) = true if OBJ is a gemstone
* HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
* LIQ(DUMMY) = object number of liquid in bottle
* LIQLOC(LOC) = object number of liquid (if any) at LOC
* PCT(N) = true N% of the time (N integer from 0 to 100)
* TOTING(OBJ) = true if the OBJ is being carried */
#define TOTING(OBJ) (PLACE[OBJ] == -1)
#define AT(OBJ) (PLACE[OBJ] == LOC || FIXED[OBJ] == LOC)
#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
#define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
#define LIQ(DUMMY) (LIQ2(PROP[BOTTLE]<0 ? -1-PROP[BOTTLE] : PROP[BOTTLE]))
#define LIQLOC(LOC) (LIQ2((MOD(COND[LOC]/2*2,8)-5)*MOD(COND[LOC]/4,2)+1))
#define CNDBIT(L,N) (TSTBIT(COND[L],N))
#define FORCED(LOC) (COND[LOC] == 2)
#define DARK(DUMMY) ((!CNDBIT(LOC,0)) && (PROP[LAMP] == 0 || !HERE(LAMP)))
#define PCT(N) (RAN(100) < (N))
#define GSTONE(OBJ) ((OBJ) == EMRALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
#define FOREST(LOC) ((LOC) >= 145 && (LOC) <= 166)
#define VOCWRD(LETTRS,SECT) (VOCAB(MAKEWD(LETTRS),SECT))
/* The following two functions were added to fix a bug (CLOCK1 decremented
* while in forest). They should probably be replaced by using another
* "cond" bit. For now, however, a quick fix... OUTSID(LOC) is true if
* LOC is outside, INDEEP(LOC) is true if LOC is "deep" in the cave (hall
* of mists or deeper). Note special kludges for "FOOF" locs. */
#define OUTSID(LOC) ((LOC) <= 8 || FOREST(LOC) || (LOC) == PLAC[SAPPH] || (LOC) == 180 || (LOC) == 182)
#define INDEEP(LOC) ((LOC) >= 15 && !OUTSID(LOC) && (LOC) != 179)
extern int carry(void), discard(bool), attack(void), throw(void), feed(void), fill(void);
void score(long);

24
hints.adoc Normal file
View file

@ -0,0 +1,24 @@
= Non-spoiler hints =
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
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.
"Free bird": It's more than an epic guitar solo. Do it twice!
There is a legend that if you drink the blood of a dragon, you will
be able to understand the speech of birds.
That vending machine? It would be better off dead.
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.

174
history.adoc Normal file
View file

@ -0,0 +1,174 @@
= A brief history of Colossal Cave Adventure =
by Eric S. Raymond
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
Adventure is the fons et origo of all later dungeon-crawling computer
games, the granddaddy of interactive fiction, and one of the hallowed
artifacts of hacker folklore.
== Origin and history ==
The very first version was released by Crowther in 1976, in FORTRAN on
the PDP-10 at Bolt, Beranek, and Newman. (Crowther was at the time
writing what we could now call firmware for the earliest ARPANET
routers.) It was a maze game based on the Colossal Cave complex in
Kentucky, including fewer of the D&D-like elements now associated with
the game.
Adventure as we now know it, the ancestor of all later versions, was
released on a PDP-10 at the Stanford AI Lab by Don Woods on June 3rd,
1977 (some sources erroneously say 1976). That version is sometimes
known as 350-point Adventure.
Between 1977 and 1995 Crowther and Woods themselves continued to work
intermittently on the game. This main line of development culminated
in the 1995 release of Adventure 2.5, also known as 430-point Adventure
The earliest port to C was by Jim Gillogly under an early Unix running
at the Rand Corporation in 1977; this version was later, and still is,
included in the BSD Games collection. I have it from Don Woods directly
that "[Jim Gillogly] was one of the first to request and receive a copy
of the source" but that Woods did not actually know of the BSD port
until I briefed him on it in 2017. (This contradicts some implications
in third-party histories.)
Many other people ported and extended the game in various directions.
A notable version was the first game shipped for the IBM Personal
Computer in 1981; neither Crowther nor Woods nor Gillogly were paid
royalties.
The history of these non-mainline versions is complex and
murky. Functional differences were generally marked by changes in the
maximum score as people added puzzles and rooms; however, multiple
ports of some versions existed - some in FORTRAN, some in C,
some in other languages - so the maximum point score is not
completely disambiguating.
Same articles at <<DA>> are a narrative of the history of the game.
There is an in-depth study of its origins at <<SN>>. Many versions
are collected at The Interactive Fiction Archive <<IFA>>; note however
that IFA's historical claims are thinly sourced and its dates for the
earliest releases don't match either comments in the code or the
careful reconstruction in <<SN>>.
== Open Adventure ==
An attempt to untangle and document a lot of the non-mainline history
has been made by Arthur O'Dwyer at <<QUUX>>. For our purposes, it
will suffice to explain the chain of provenance that led from the
original Adventure to the Open Adventure distributed with this
document.
The original 350-point ADVENT on the PDP-10 had been one of my
formative experiences as a fledgling hacker in 1976-77. Forty years
later, in February 2017, while doing some casual research into the
history of text adventure games, I looked through some source code at
<<IFA>> and was delighted to learn of Adventure 2.5, a version of the
Crowther-Woods mainline later than I had ever played.
Adventure 2.5 had been shipped long enough ago that today's conventions of
open-source licensing were not yet fully established. The Makefile
contained a rights reservation by Don Woods and that was it.
I wrote to Don asking permission to release 2.5 under 2-clause BSD;
he replied on 15 May 2017 giving both permission and encouragement.
Here is what Don said about differences between the original Adventure
and 2.5:
............................................................................
> The bulk of the points come from five new 16-point treasures. (I say "bulk"
> because I think at least one of the scores included some padding and I may
> have tweaked those.) Each of the new treasures requires solving a puzzle
> that's definitely at the tricky end of the scale for Adventure. Much of the
> new stuff involves trying new directions and/or finding new uses for stuff
> that already existed; e.g. the forest outside is no longer a small number of
> locations with partially random movement, but is a full-fledged maze, one
> that I hope has a character different from either of the previous two.
>
> As the text itself says, V2.5 is essentially the same as V2, with a few more
> hints. (I think I came up with a better one for the endgame, too.) I don't
> seem to have a copy of the similar text from V2, so I don't know whether/how
> it described itself to new and seasoned players.
>
> The other big change, as I mentioned above, was I added a way of docking
> points at a certain number of turns. This was my second attempt to do what
> the batteries had been for: require being efficient to achieve top score.
> Alas, the batteries led to players deliberately turning the lamp off/on
> whenever they weren't moving or were in a lit area, making the game take
> even longer! I set the requirement at what felt like a hard but fair
> number of turns, then applied several sneaky tricks to shave off another
> twenty.
>
> I hacked up a wrapper around the game (still in Fortran, most likely, but
> I forget) that would try each initializing the RNG using each second of a
> given day, while feeding in a script that either worked or aborted early
> if anything went wrong (such as a dwarf blocking my path). As I recall,
> it took less than a day's worth of RNG seeds to find one that worked.
>
> I verified my script could work given a favorable RNG, and stuck
> that number in the message.
>
> I like how that final puzzle, unlike the game itself, does not readily
> succumb even given access to the game source. You really need to fit
> together not only the goals and the map and use of inventory space, but
> also details like just what _can_ you do in the dark...?
............................................................................
Great care has been taken to preserve 2.5's exact gameplay as intended
by Don. We have added a "version" command.
However, under the hood Open Adventure is rather different from 2.5.
Where 2.5 was written in FORTRAN mechanically translated into
extremely ugly C, Open Adventure has been translated into much more
modern and idiomatic C. The extremely cryptic and opaque format of
the original database of rooms, objects, and strings has been moved to
YAML; this makes the brilliant design of it much easier to comprehend.
== Earlier non-influences ==
There is record of one earlier dungeon-crawling game called "dnd",
written in 1974-75 on the PLATO system at University of Illinois
<<DND>>. This was in some ways similar to later roguelike games but
not to Adventure. The designers of later roguelikes frequently cite
Adventure as an influence, but not dnd; like PLATO itself, dnd seems
not to have become known outside of its own user community until
rediscovered by computer historians many years after Adventure
shipped.
There was also Hunt The Wumpus <<WUMPUS>>, written by Gregory Yob in
1972. There is no evidence that Yob's original (circulated
in BASIC among microcomputer enthusiasts) was known to the ARPANET-
and minicomputer-centered culture Crowther and Woods were part of
until well after Adventure was written.
(I was a developer of the Nethack roguelike early in that game's
history, in the late 1980s; we knew nothing of PLATO dnd. We did know
of Hunt The Wumpus then from its early Unix port, but it didn't
influence us either, nor in any apparent way the designers of other
early roguelikes. After my time the wumpus was included as a monster
in Nethack, but this was done in a spirit of conscious museumization
well after historians rediscovered Yob's game.)
Neither of these games used an attempt at a natural-language parser
even as primitive as Adventure's.
== Sources ==
// asciidoc and asciidoctor both foo up on bare links ending in ')'.
[bibliography]
- [[[IFA]]] http://rickadams.org/adventure/[Colossal Cave Adventure Page]
- [[[DA]]] http://www.filfre.net/sitemap/[The Digital Antiquarian]
- [[[SN]]]
http://www.digitalhumanities.org/dhq/vol/1/2/000009/000009.html[Digital
Humanities Quarterly]
- [[[DND]]] https://en.wikipedia.org/wiki/Dnd_(video_game)[dnd (video game)]
- [[[WUMPUS]]] https://en.wikipedia.org/wiki/Hunt_the_Wumpus[Hunt The Wumpus]
- [[[QUUX]]] https://github.com/Quuxplusone/Advent[Quuxplusone/Advent]

View file

@ -1,86 +0,0 @@
= A brief history of Colossal Cave Adventure =
by Eric S. Raymond
Adventure is the fons et origo of all later dungeon-crawling games,
the grandaddy of interactive fiction, and one of the hallowed artifacts
of hacker folklore.
The very first version was released by Crowther in 1976, in FORTRAN on
the PDP-10 at Bolt, Beranek, and Newman. (Crowther was at the time
writing what we could now call firmware for the earliest ARPANET
routers.) It was a maze game based on the Colossal Cave complex in
Kentucky, lacking the D&D-like elements now associated with the game.
Adventure as we now know it, the ancestor of all later versions, was
was released on a PDP-10 at the Stanford AI Lab by Don Woods in 1977
(some sources, apparently erroneously, say 1976). That version is
sometimes known as 350-point Adventure.
Between 1977 and 1995 Crowther and Woods themselves continued to work
intermittently on the game. This main line of development culminated
in the 1995 release of Adventure 2.5, also known as 430-point Adventure
The earliest port to C was by Jim Gillogly under an early Unix running
at the Rand Corporation in 1977; this version was later, and still is,
included in the BSD Games collection. It was blessed by Crowther and
Woods and briefly marketed in 1981 under the name "The Original
Adventure".
Many other people ported and extended the game in various directions.
A notable version was the first game shipped for the IBM Personal
Computer in 1981; this, for which neither Crowther nor Woods nor
Gillogly were paid royalties, what "The Original" was competing
against.
The history of these non-mainline versions is complex and
murky. Functional differences were generally marked by changes in the
maximum score as people added puzzles and rooms; however, multiple
ports of some versions existed - some in FORTRAN, some in C,
some in other languages - so the maximum point score is not
completely disambiguating.
Same articles at <<DA>> are a narrative of the history of the
game. There is an in-depth study of its origins at <<SN>>.
Many versions are collected at The Interactive Fiction Archive
<<IFA>>; note however that its dates for the earliest releases
don't match other comments in the code or the careful reconstruction
in <<SN>>.
Future versions of this document may attempt to untangle some of the
non-mainline history. For now, it will suffice to explain the chain of
provenance that led from the original Adventure to the version
distributed with this document.
The original 350-point ADVENT on the PDP-10 had been one of my
formative experiences as a fledgling hacker in 1976-77. Forty years
later, in February 2017, while doing some casual research into the
history of text adventure games, I looked through some source code at
<<IFA>> and was delighted to learn of Adventure 2.5, a version of the
Crowther-Woods mainline later than I had ever played.
Adventure 2.5 had been shipped long enough ago that today's conventions of
open-source licensing were not yet fully established. The Makefile
contained a rights reservation by Don Woods and that was it.
I wrote to Don asking permission to release 2.5 under 2-clause BSD;
he replied on 15 May giving both permission and encouragement.
== Nomenclature ==
This project is called "Open Adventure" because it's not at all clear
to number Adventure past 2.5 without misleading or causing
collisions. Various of the non-mainline versions have claimed to be
versions 3, 4, 5, 6, 7 and for all I know higher than that. It seems
best just to start a new numbering series while acknowledging the
links back. I have reverted to "Advent" to avoid a name collision
with the BSD Games version.
== Sources ==
[bibliography]
- [[[IFA]]] http://rickadams.org/adventure/
- [[[[DA]]] http://www.filfre.net/sitemap/
- [[[SN]]] http://www.digitalhumanities.org/dhq/vol/1/2/000009/000009.html

790
init.c
View file

@ -1,714 +1,96 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "misc.h"
#include "main.h"
#include "share.h"
#include "funcs.h"
/*
* Initialisation
*
* SPDX-FileCopyrightText: (C) 1977, 2005 by Will Crowther and Don Woods
* SPDX-License-Identifier: BSD-2-Clause
*/
/* Current limits:
* 12500 words of message text (LINES, LINSIZ).
* 885 travel options (TRAVEL, TRVSIZ).
* 330 vocabulary words (KTAB, ATAB, TABSIZ).
* 185 locations (LTEXT, STEXT, KEY, COND, ABB, ATLOC, LOCSND, LOCSIZ).
* 100 objects (PLAC, PLACE, FIXD, FIXED, LINK (TWICE), PTEXT, PROP,
* OBJSND, OBJTXT).
* 35 "action" verbs (ACTSPK, VRBSIZ).
* 277 random messages (RTEXT, RTXSIZ).
* 12 different player classifications (CTEXT, CVAL, CLSMAX).
* 20 hints (HINTLC, HINTED, HINTS, HNTSIZ).
* 5 "# of turns" threshholds (TTEXT, TRNVAL, TRNSIZ).
* There are also limits which cannot be exceeded due to the structure of
* the database. (E.G., The vocabulary uses n/1000 to determine word type,
* so there can't be more than 1000 words.) These upper limits are:
* 1000 non-synonymous vocabulary words
* 300 locations
* 100 objects */
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include "advent.h"
/* Description of the database format
*
*
* The data file contains several sections. Each begins with a line containing
* a number identifying the section, and ends with a line containing "-1".
*
* Section 1: Long form descriptions. Each line contains a location number,
* a tab, and a line of text. The set of (necessarily adjacent) lines
* whose numbers are X form the long description of location X.
* Section 2: Short form descriptions. Same format as long form. Not all
* places have short descriptions.
* Section 3: Travel table. Each line contains a location number (X), a second
* location number (Y), and a list of motion numbers (see section 4).
* each motion represents a verb which will go to Y if currently at X.
* Y, in turn, is interpreted as follows. Let M=Y/1000, N=Y mod 1000.
* If N<=300 it is the location to go to.
* If 300<N<=500 N-300 is used in a computed goto to
* a section of special code.
* If N>500 message N-500 from section 6 is printed,
* and he stays wherever he is.
* Meanwhile, M specifies the conditions on the motion.
* If M=0 it's unconditional.
* If 0<M<100 it is done with M% probability.
* If M=100 unconditional, but forbidden to dwarves.
* If 100<M<=200 he must be carrying object M-100.
* If 200<M<=300 must be carrying or in same room as M-200.
* If 300<M<=400 PROP(M % 100) must *not* be 0.
* If 400<M<=500 PROP(M % 100) must *not* be 1.
* If 500<M<=600 PROP(M % 100) must *not* be 2, etc.
* If the condition (if any) is not met, then the next *different*
* "destination" value is used (unless it fails to meet *its* conditions,
* in which case the next is found, etc.). Typically, the next dest will
* be for one of the same verbs, so that its only use is as the alternate
* destination for those verbs. For instance:
* 15 110022 29 31 34 35 23 43
* 15 14 29
* This says that, from loc 15, any of the verbs 29, 31, etc., will take
* him to 22 if he's carrying object 10, and otherwise will go to 14.
* 11 303008 49
* 11 9 50
* This says that, from 11, 49 takes him to 8 unless PROP(3)=0, in which
* case he goes to 9. Verb 50 takes him to 9 regardless of PROP(3).
* Section 4: Vocabulary. Each line contains a number (n), a tab, and a
* five-letter word. Call M=N/1000. If M=0, then the word is a motion
* verb for use in travelling (see section 3). Else, if M=1, the word is
* an object. Else, if M=2, the word is an action verb (such as "carry"
* or "attack"). Else, if M=3, the word is a special case verb (such as
* "dig") and N % 1000 is an index into section 6. Objects from 50 to
* (currently, anyway) 79 are considered treasures (for pirate, closeout).
* Section 5: Object descriptions. Each line contains a number (N), a tab,
* and a message. If N is from 1 to 100, the message is the "inventory"
* message for object n. Otherwise, N should be 000, 100, 200, etc., and
* the message should be the description of the preceding object when its
* prop value is N/100. The N/100 is used only to distinguish multiple
* messages from multi-line messages; the prop info actually requires all
* messages for an object to be present and consecutive. Properties which
* produce no message should be given the message ">$<".
* Section 6: Arbitrary messages. Same format as sections 1, 2, and 5, except
* the numbers bear no relation to anything (except for special verbs
* in section 4).
* Section 7: Object locations. Each line contains an object number and its
* initial location (zero (or omitted) if none). If the object is
* immovable, the location is followed by a "-1". If it has two locations
* (e.g. the grate) the first location is followed with the second, and
* the object is assumed to be immovable.
* Section 8: Action defaults. Each line contains an "action-verb" number and
* the index (in section 6) of the default message for the verb.
* Section 9: Location attributes. Each line contains a number (n) and up to
* 20 location numbers. Bit N (where 0 is the units bit) is set in
* COND(LOC) for each loc given. The cond bits currently assigned are:
* 0 Light
* 1 If bit 2 is on: on for oil, off for water
* 2 Liquid asset, see bit 1
* 3 Pirate doesn't go here unless following player
* 4 Cannot use "back" to move away
* Bits past 10 indicate areas of interest to "hint" routines:
* 11 Trying to get into cave
* 12 Trying to catch bird
* 13 Trying to deal with snake
* 14 Lost in maze
* 15 Pondering dark room
* 16 At witt's end
* 17 Cliff with urn
* 18 Lost in forest
* 19 Trying to deal with ogre
* 20 Found all treasures except jade
* COND(LOC) is set to 2, overriding all other bits, if loc has forced
* motion.
* Section 10: Class messages. Each line contains a number (n), a tab, and a
* message describing a classification of player. The scoring section
* selects the appropriate message, where each message is considered to
* 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
* modification (and particularly expansion) of the program.
* 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)
* before triggering the hint, the points deducted for taking the hint,
* the message number (section 6) of the question, and the message number
* of the hint. These values are stashed in the "hints" array. HNTMAX is
* set to the max hint number (<= HNTSIZ).
* Section 12: Unused in this version.
* Section 13: Sounds and text. Each line contains either 2 or 3 numbers. If
* 2 (call them N and S), N is a location and message ABS(S) from section
* 6 is the sound heard there. If S<0, the sound there drowns out all
* other noises. If 3 numbers (call them N, S, and T), N is an object
* number and S+PROP(N) is the property message (from section 5) if he
* listens to the object, and T+PROP(N) is the text if he reads it. If
* S or T is -1, the object has no sound or text, respectively. Neither
* S nor T is allowed to be 0.
* Section 14: Turn threshholds. Each line contains a number (N), a tab, and
* a message berating the player for taking so many turns. The messages
* must be in the proper (ascending) order. The message gets printed if
* the player exceeds N % 100000 turns, at which time N/100000 points
* get deducted from his score.
* Section 0: End of database. */
struct settings_t settings = {.logfp = NULL, .oldstyle = false, .prompt = true};
/* The various messages (sections 1, 2, 5, 6, etc.) may include certain
* special character sequences to denote that the program must provide
* parameters to insert into a message when the message is printed. These
* sequences are:
* %S = The letter 'S' or nothing (if a given value is exactly 1)
* %W = A word (up to 10 characters)
* %L = A word mapped to lower-case letters
* %U = A word mapped to upper-case letters
* %C = A word mapped to lower-case, first letter capitalised
* %T = Several words of text, ending with a word of -1
* %1 = A 1-digit number
* %2 = A 2-digit number
* ...
* %9 = A 9-digit number
* %B = Variable number of blanks
* %! = The entire message should be suppressed */
struct game_t game = {
/* Last dwarf is special (the pirate). He always starts at his
* chest's eventual location inside the maze. This loc is saved
* in chloc for ref. The dead end in the other maze has its
* loc stored in chloc2. */
.chloc = LOC_MAZEEND12, .chloc2 = LOC_DEADEND13, .abbnum = 5,
.clock1 = WARNTIME, .clock2 = FLASHTIME, .newloc = LOC_START,
.loc = LOC_START, .limit = GAMELIMIT, .foobar = WORD_EMPTY,
};
static bool quick_init(void);
static int raw_init(void);
static void report(void);
static void quick_save(void);
static int finish_init(void);
static void quick_io(void);
void initialise(void) {
if (oldstyle)
int initialise(void) {
if (settings.oldstyle) {
printf("Initialising...\n");
if(!quick_init()){raw_init(); report(); quick_save();}
finish_init();
}
static int raw_init(void) {
printf("Couldn't find adventure.data, using adventure.text...\n");
FILE *OPENED=fopen("adventure.text","r" /* NOT binary */);
if(!OPENED){printf("Can't read adventure.text!\n"); exit(0);}
/* Clear out the various text-pointer arrays. All text is stored in array
* lines; each line is preceded by a word pointing to the next pointer (i.e.
* the word following the end of the line). The pointer is negative if this is
* first line of a message. The text-pointer arrays contain indices of
* pointer-words in lines. STEXT(N) is short description of location N.
* LTEXT(N) is long description. PTEXT(N) points to message for PROP(N)=0.
* Successive prop messages are found by chasing pointers. RTEXT contains
* section 6's stuff. CTEXT(N) points to a player-class message. TTEXT is for
* section 14. We also clear COND (see description of section 9 for details). */
/* 1001 */ for (I=1; I<=300; I++) {
if(I <= 100)PTEXT[I]=0;
if(I <= RTXSIZ)RTEXT[I]=0;
if(I <= CLSMAX)CTEXT[I]=0;
if(I <= 100)OBJSND[I]=0;
if(I <= 100)OBJTXT[I]=0;
if(I > LOCSIZ) goto L1001;
STEXT[I]=0;
LTEXT[I]=0;
COND[I]=0;
KEY[I]=0;
LOCSND[I]=0;
L1001: /*etc*/ ;
} /* end loop */
LINUSE=1;
TRVS=1;
CLSSES=0;
TRNVLS=0;
/* Start new data section. Sect is the section number. */
L1002: SECT=GETNUM(OPENED);
OLDLOC= -1;
switch (SECT) { case 0: return(0); case 1: goto L1004; case 2: goto
L1004; case 3: goto L1030; case 4: goto L1040; case 5: goto L1004;
case 6: goto L1004; case 7: goto L1050; case 8: goto L1060; case
9: goto L1070; case 10: goto L1004; case 11: goto L1080; case 12:
break; case 13: goto L1090; case 14: goto L1004; }
/* (0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
* (10) (11) (12) (13) (14) */
BUG(9);
/* Sections 1, 2, 5, 6, 10, 14. Read messages and set up pointers. */
L1004: KK=LINUSE;
L1005: LINUSE=KK;
LOC=GETNUM(OPENED);
if(LNLENG >= LNPOSN+70)BUG(0);
if(LOC == -1) goto L1002;
if(LNLENG < LNPOSN)BUG(1);
L1006: KK=KK+1;
if(KK >= LINSIZ)BUG(2);
LINES[KK]=GETTXT(false,false,false,KK);
if(LINES[KK] != -1) goto L1006;
LINES[LINUSE]=KK;
if(LOC == OLDLOC) goto L1005;
OLDLOC=LOC;
LINES[LINUSE]= -KK;
if(SECT == 14) goto L1014;
if(SECT == 10) goto L1012;
if(SECT == 6) goto L1011;
if(SECT == 5) goto L1010;
if(LOC > LOCSIZ)BUG(10);
if(SECT == 1) goto L1008;
STEXT[LOC]=LINUSE;
goto L1005;
L1008: LTEXT[LOC]=LINUSE;
goto L1005;
L1010: if(LOC > 0 && LOC <= 100)PTEXT[LOC]=LINUSE;
goto L1005;
L1011: if(LOC > RTXSIZ)BUG(6);
RTEXT[LOC]=LINUSE;
goto L1005;
L1012: CLSSES=CLSSES+1;
if(CLSSES > CLSMAX)BUG(11);
CTEXT[CLSSES]=LINUSE;
CVAL[CLSSES]=LOC;
goto L1005;
L1014: TRNVLS=TRNVLS+1;
if(TRNVLS > TRNSIZ)BUG(11);
TTEXT[TRNVLS]=LINUSE;
TRNVAL[TRNVLS]=LOC;
goto L1005;
/* The stuff for section 3 is encoded here. Each "from-location" gets a
* contiguous section of the "TRAVEL" array. Each entry in travel is
* NEWLOC*1000 + KEYWORD (from section 4, motion verbs), and is negated if
* this is the last entry for this location. KEY(N) is the index in travel
* of the first option at location N. */
L1030: LOC=GETNUM(OPENED);
if(LOC == -1) goto L1002;
NEWLOC=GETNUM(NULL);
if(KEY[LOC] != 0) goto L1033;
KEY[LOC]=TRVS;
goto L1035;
L1033: TRVS--; TRAVEL[TRVS]= -TRAVEL[TRVS]; TRVS++;
L1035: L=GETNUM(NULL);
if(L == 0) goto L1039;
TRAVEL[TRVS]=NEWLOC*1000+L;
TRVS=TRVS+1;
if(TRVS == TRVSIZ)BUG(3);
goto L1035;
L1039: TRVS--; TRAVEL[TRVS]= -TRAVEL[TRVS]; TRVS++;
goto L1030;
/* Here we read in the vocabulary. KTAB(N) is the word number, ATAB(N) is
* the corresponding word. The -1 at the end of section 4 is left in KTAB
* as an end-marker. The words are given a minimal hash to make deciphering
* the core-image harder. (We don't use gettxt's hash since that would force
* us to hash each input line to make comparisons work, and that in turn
* would make it harder to detect particular input words.) */
L1040: J=10000;
for (TABNDX=1; TABNDX<=TABSIZ; TABNDX++) {
KTAB[TABNDX]=GETNUM(OPENED);
if(KTAB[TABNDX] == -1) goto L1002;
J=J+7;
ATAB[TABNDX]=GETTXT(true,true,true,0)+J*J;
} /* end loop */
BUG(4);
/* Read in the initial locations for each object. Also the immovability info.
* plac contains initial locations of objects. FIXD is -1 for immovable
* objects (including the snake), or = second loc for two-placed objects. */
L1050: OBJ=GETNUM(OPENED);
if(OBJ == -1) goto L1002;
PLAC[OBJ]=GETNUM(NULL);
FIXD[OBJ]=GETNUM(NULL);
goto L1050;
/* Read default message numbers for action verbs, store in ACTSPK. */
L1060: VERB=GETNUM(OPENED);
if(VERB == -1) goto L1002;
ACTSPK[VERB]=GETNUM(NULL);
goto L1060;
/* Read info about available liquids and other conditions, store in COND. */
L1070: K=GETNUM(OPENED);
if(K == -1) goto L1002;
L1071: LOC=GETNUM(NULL);
if(LOC == 0) goto L1070;
if(CNDBIT(LOC,K)) BUG(8);
COND[LOC]=COND[LOC]+SETBIT(K);
goto L1071;
/* Read data for hints. */
L1080: HNTMAX=0;
L1081: K=GETNUM(OPENED);
if(K == -1) goto L1002;
if(K <= 0 || K > HNTSIZ)BUG(7);
for (I=1; I<=4; I++) {
HINTS[K][I] =GETNUM(NULL);
} /* end loop */
HNTMAX=(HNTMAX>K ? HNTMAX : K);
goto L1081;
/* Read the sound/text info, store in OBJSND, OBJTXT, LOCSND. */
L1090: K=GETNUM(OPENED);
if(K == -1) goto L1002;
KK=GETNUM(NULL);
I=GETNUM(NULL);
if(I == 0) goto L1092;
OBJSND[K]=(KK>0 ? KK : 0);
OBJTXT[K]=(I>0 ? I : 0);
goto L1090;
L1092: LOCSND[K]=KK;
goto L1090;
}
/* Finish constructing internal data format */
/* Having read in the database, certain things are now constructed. PROPS are
* set to zero. We finish setting up COND by checking for forced-motion travel
* entries. The PLAC and FIXD arrays are used to set up ATLOC(N) as the first
* object at location N, and LINK(OBJ) as the next object at the same location
* as OBJ. (OBJ>100 indicates that FIXED(OBJ-100)=LOC; LINK(OBJ) is still the
* correct link to use.) ABB is zeroed; it controls whether the abbreviated
* description is printed. Counts modulo 5 unless "LOOK" is used. */
static int finish_init(void) {
for (I=1; I<=100; I++) {
PLACE[I]=0;
PROP[I]=0;
LINK[I]=0;
{long x = I+100; LINK[x]=0;}
} /* end loop */
/* 1102 */ for (I=1; I<=LOCSIZ; I++) {
ABB[I]=0;
if(LTEXT[I] == 0 || KEY[I] == 0) goto L1102;
K=KEY[I];
if(MOD(IABS(TRAVEL[K]),1000) == 1)COND[I]=2;
L1102: ATLOC[I]=0;
} /* end loop */
/* Set up the ATLOC and LINK arrays as described above. We'll use the DROP
* subroutine, which prefaces new objects on the lists. Since we want things
* in the other order, we'll run the loop backwards. If the object is in two
* locs, we drop it twice. This also sets up "PLACE" and "fixed" as copies of
* "PLAC" and "FIXD". Also, since two-placed objects are typically best
* described last, we'll drop them first. */
/* 1106 */ for (I=1; I<=100; I++) {
K=101-I;
if(FIXD[K] <= 0) goto L1106;
DROP(K+100,FIXD[K]);
DROP(K,PLAC[K]);
L1106: /*etc*/ ;
} /* end loop */
for (I=1; I<=100; I++) {
K=101-I;
FIXED[K]=FIXD[K];
if(PLAC[K] != 0 && FIXD[K] <= 0)DROP(K,PLAC[K]);
} /* end loop */
/* Treasures, as noted earlier, are objects 50 through MAXTRS (CURRENTLY 79).
* Their props are initially -1, and are set to 0 the first time they are
* described. TALLY keeps track of how many are not yet found, so we know
* when to close the cave. */
MAXTRS=79;
TALLY=0;
for (I=50; I<=MAXTRS; I++) {
if(PTEXT[I] != 0)PROP[I]= -1;
TALLY=TALLY-PROP[I];
} /* end loop */
/* Clear the hint stuff. HINTLC(I) is how long he's been at LOC with cond bit
* I. HINTED(I) is true iff hint I has been used. */
for (I=1; I<=HNTMAX; I++) {
HINTED[I]=false;
HINTLC[I]=0;
} /* end loop */
/* Define some handy mnemonics. These correspond to object numbers. */
AXE=VOCWRD(12405,1);
BATTER=VOCWRD(201202005,1);
BEAR=VOCWRD(2050118,1);
BIRD=VOCWRD(2091804,1);
BLOOD=VOCWRD(212151504,1);
BOTTLE=VOCWRD(215202012,1);
CAGE=VOCWRD(3010705,1);
CAVITY=VOCWRD(301220920,1);
CHASM=VOCWRD(308011913,1);
CLAM=VOCWRD(3120113,1);
DOOR=VOCWRD(4151518,1);
DRAGON=VOCWRD(418010715,1);
DWARF=VOCWRD(423011806,1);
FISSUR=VOCWRD(609191921,1);
FOOD=VOCWRD(6151504,1);
GRATE=VOCWRD(718012005,1);
KEYS=VOCWRD(11052519,1);
KNIFE=VOCWRD(1114090605,1);
LAMP=VOCWRD(12011316,1);
MAGZIN=VOCWRD(1301070126,1);
MESSAG=VOCWRD(1305191901,1);
MIRROR=VOCWRD(1309181815,1);
OGRE=VOCWRD(15071805,1);
OIL=VOCWRD(150912,1);
OYSTER=VOCWRD(1525192005,1);
PILLOW=VOCWRD(1609121215,1);
PLANT=VOCWRD(1612011420,1);
PLANT2=PLANT+1;
RESER=VOCWRD(1805190518,1);
ROD=VOCWRD(181504,1);
ROD2=ROD+1;
SIGN=VOCWRD(19090714,1);
SNAKE=VOCWRD(1914011105,1);
STEPS=VOCWRD(1920051619,1);
TROLL=VOCWRD(2018151212,1);
TROLL2=TROLL+1;
URN=VOCWRD(211814,1);
VEND=VOCWRD(1755140409,1);
VOLCAN=VOCWRD(1765120301,1);
WATER=VOCWRD(1851200518,1);
/* Objects from 50 through whatever are treasures. Here are a few. */
AMBER=VOCWRD(113020518,1);
CHAIN=VOCWRD(308010914,1);
CHEST=VOCWRD(308051920,1);
COINS=VOCWRD(315091419,1);
EGGS=VOCWRD(5070719,1);
EMRALD=VOCWRD(513051801,1);
JADE=VOCWRD(10010405,1);
NUGGET=VOCWRD(7151204,1);
PEARL=VOCWRD(1605011812,1);
PYRAM=VOCWRD(1625180113,1);
RUBY=VOCWRD(18210225,1);
RUG=VOCWRD(182107,1);
SAPPH=VOCWRD(1901161608,1);
TRIDNT=VOCWRD(2018090405,1);
VASE=VOCWRD(22011905,1);
/* These are motion-verb numbers. */
BACK=VOCWRD(2010311,0);
CAVE=VOCWRD(3012205,0);
DPRSSN=VOCWRD(405161805,0);
ENTER=VOCWRD(514200518,0);
ENTRNC=VOCWRD(514201801,0);
LOOK=VOCWRD(12151511,0);
NUL=VOCWRD(14211212,0);
STREAM=VOCWRD(1920180501,0);
/* And some action verbs. */
FIND=VOCWRD(6091404,2);
INVENT=VOCWRD(914220514,2);
LOCK=VOCWRD(12150311,2);
SAY=VOCWRD(190125,2);
THROW=VOCWRD(2008181523,2);
/* Initialise the dwarves. DLOC is loc of dwarves, hard-wired in. ODLOC is
* prior loc of each dwarf, initially garbage. DALTLC is alternate initial loc
* for dwarf, in case one of them starts out on top of the adventurer. (No 2
* of the 5 initial locs are adjacent.) DSEEN is true if dwarf has seen him.
* DFLAG controls the level of activation of all this:
* 0 No dwarf stuff yet (wait until reaches Hall Of Mists)
* 1 Reached Hall Of Mists, but hasn't met first dwarf
* 2 Met first dwarf, others start moving, no knives thrown yet
* 3 A knife has been thrown (first set always misses)
* 3+ Dwarves are mad (increases their accuracy)
* Sixth dwarf is special (the pirate). He always starts at his chest's
* eventual location inside the maze. This loc is saved in CHLOC for ref.
* the dead end in the other maze has its loc stored in CHLOC2. */
CHLOC=114;
CHLOC2=140;
for (I=1; I<=6; I++) {
DSEEN[I]=false;
} /* end loop */
DFLAG=0;
DLOC[1]=19;
DLOC[2]=27;
DLOC[3]=33;
DLOC[4]=44;
DLOC[5]=64;
DLOC[6]=CHLOC;
DALTLC=18;
/* Other random flags and counters, as follows:
* ABBNUM How often we should print non-abbreviated descriptions
* BONUS Used to determine amount of bonus if he reaches closing
* CLOCK1 Number of turns from finding last treasure till closing
* CLOCK2 Number of turns from first warning till blinding flash
* CONDS Min value for cond(loc) if loc has any hints
* DETAIL How often we've said "not allowed to give more detail"
* DKILL Number of dwarves killed (unused in scoring, needed for msg)
* FOOBAR Current progress in saying "FEE FIE FOE FOO".
* HOLDNG Number of objects being carried
* IGO How many times he's said "go XXX" instead of "XXX"
* IWEST How many times he's said "west" instead of "w"
* KNFLOC 0 if no knife here, loc if knife here, -1 after caveat
* LIMIT Lifetime of lamp (not set here)
* MAXDIE Number of reincarnation messages available (up to 5)
* NUMDIE Number of times killed so far
* THRESH Next #turns threshhold (-1 if none)
* TRNDEX Index in TRNVAL of next threshhold (section 14 of database)
* TRNLUZ # points lost so far due to number of turns used
* TURNS Tallies how many commands he's given (ignores yes/no)
* Logicals were explained earlier */
TURNS=0;
TRNDEX=1;
THRESH= -1;
if(TRNVLS > 0)THRESH=MOD(TRNVAL[1],100000)+1;
TRNLUZ=0;
LMWARN=false;
IGO=0;
IWEST=0;
KNFLOC=0;
DETAIL=0;
ABBNUM=5;
for (I=0; I<=4; I++) {
{long x = 2*I+81; if(RTEXT[x] != 0)MAXDIE=I+1;}
} /* end loop */
NUMDIE=0;
HOLDNG=0;
DKILL=0;
FOOBAR=0;
BONUS=0;
CLOCK1=30;
CLOCK2=50;
CONDS=SETBIT(11);
SAVED=0;
CLOSNG=false;
PANIC=false;
CLOSED=false;
CLSHNT=false;
NOVICE=false;
SETUP=1;
/* if we can ever think of how, we should save it at this point */
return(0); /* then we won't actually return from initialisation */
}
/* Report on amount of arrays actually used, to permit reductions. */
static void report(void) {
for (K=1; K<=LOCSIZ; K++) {
KK=LOCSIZ+1-K;
if(LTEXT[KK] != 0) goto L1997;
/*etc*/ ;
} /* end loop */
OBJ=0;
L1997: for (K=1; K<=100; K++) {
if(PTEXT[K] != 0)OBJ=OBJ+1;
} /* end loop */
for (K=1; K<=TABNDX; K++) {
if(KTAB[K]/1000 == 2)VERB=KTAB[K]-2000;
} /* end loop */
for (K=1; K<=RTXSIZ; K++) {
J=RTXSIZ+1-K;
if(RTEXT[J] != 0) goto L1993;
/*etc*/ ;
} /* end loop */
L1993: SETPRM(1,LINUSE,LINSIZ);
SETPRM(3,TRVS,TRVSIZ);
SETPRM(5,TABNDX,TABSIZ);
SETPRM(7,KK,LOCSIZ);
SETPRM(9,OBJ,100);
SETPRM(11,VERB,VRBSIZ);
SETPRM(13,J,RTXSIZ);
SETPRM(15,CLSSES,CLSMAX);
SETPRM(17,HNTMAX,HNTSIZ);
SETPRM(19,TRNVLS,TRNSIZ);
RSPEAK(267);
TYPE0();
}
static long init_reading, init_cksum;
static FILE *f;
static void quick_item(long*);
static void quick_array(long*, long);
static bool quick_init(void) {
extern char *getenv();
char *adv = getenv("ADVENTURE");
f = NULL;
if(adv)f = fopen(adv,READ_MODE);
if(f == NULL)f = fopen("adventure.data",READ_MODE);
if(f == NULL)return(false);
init_reading = true;
init_cksum = 1;
quick_io();
if(fread(&K,sizeof(long),1,f) == 1) init_cksum -= K; else init_cksum = 1;
fclose(f);
if(init_cksum != 0)printf("Checksum error!\n");
return(init_cksum == 0);
}
static void quick_save(void) {
printf("Writing adventure.data...\n");
f = fopen("adventure.data",WRITE_MODE);
if(f == NULL){printf("Can't open file!\n"); return;}
init_reading = false;
init_cksum = 1;
quick_io();
fwrite(&init_cksum,sizeof(long),1,f);
fclose(f);
}
static void quick_io(void) {
quick_item(&LINUSE);
quick_item(&TRVS);
quick_item(&CLSSES);
quick_item(&TRNVLS);
quick_item(&TABNDX);
quick_item(&HNTMAX);
quick_array(PTEXT,100);
quick_array(RTEXT,RTXSIZ);
quick_array(CTEXT,CLSMAX);
quick_array(OBJSND,100);
quick_array(OBJTXT,100);
quick_array(STEXT,LOCSIZ);
quick_array(LTEXT,LOCSIZ);
quick_array(COND,LOCSIZ);
quick_array(KEY,LOCSIZ);
quick_array(LOCSND,LOCSIZ);
quick_array(LINES,LINSIZ);
quick_array(CVAL,CLSMAX);
quick_array(TTEXT,TRNSIZ);
quick_array(TRNVAL,TRNSIZ);
quick_array(TRAVEL,TRVSIZ);
quick_array(KTAB,TABSIZ);
quick_array(ATAB,TABSIZ);
quick_array(PLAC,100);
quick_array(FIXD,100);
quick_array(ACTSPK,VRBSIZ);
quick_array((long *)HINTS,(HNTMAX+1)*5-1);
}
static void quick_item(W)long *W; {
if(init_reading && fread(W,sizeof(long),1,f) != 1)return;
init_cksum = MOD(init_cksum*13+(*W),60000000);
if(!init_reading)fwrite(W,sizeof(long),1,f);
}
static void quick_array(A,N)long *A, N; { long I;
if(init_reading && fread(A,sizeof(long),N+1,f) != N+1)printf("Read error!\n");
for(I=1;I<=N;I++)init_cksum = MOD(init_cksum*13+A[I],60000000);
if(!init_reading && fwrite(A,sizeof(long),N+1,f)!=N+1)printf("Write error!\n");
}
srand(time(NULL));
int seedval = (int)rand();
set_seed(seedval);
for (int i = 1; i <= NDWARVES; i++) {
game.dwarves[i].loc = dwarflocs[i - 1];
}
for (int i = 1; i <= NOBJECTS; i++) {
game.objects[i].place = LOC_NOWHERE;
}
for (int i = 1; i <= NLOCATIONS; i++) {
if (!(locations[i].description.big == 0 || tkey[i] == 0)) {
int k = tkey[i];
if (travel[k].motion == HERE) {
conditions[i] |= (1 << COND_FORCED);
}
}
}
/* Set up the game.locs atloc and game.link arrays.
* We'll use the DROP subroutine, which prefaces new objects on the
* lists. Since we want things in the other order, we'll run the
* loop backwards. If the object is in two locs, we drop it twice.
* Also, since two-placed objects are typically best described
* last, we'll drop them first. */
for (int i = NOBJECTS; i >= 1; i--) {
if (objects[i].fixd > 0) {
drop(i + NOBJECTS, objects[i].fixd);
drop(i, objects[i].plac);
}
}
for (int i = 1; i <= NOBJECTS; i++) {
int k = NOBJECTS + 1 - i;
game.objects[k].fixed = objects[k].fixd;
if (objects[k].plac != 0 && objects[k].fixd <= 0) {
drop(k, objects[k].plac);
}
}
/* Treasure props are initially STATE_NOTFOUND, and are set to
* STATE_FOUND the first time they are described. game.tally
* keeps track of how many are not yet found, so we know when to
* close the cave.
* (ESR) Non-treasures are set to STATE_FOUND explicitly so we
* don't rely on the value of uninitialized storage. This is to
* make translation to future languages easier. */
for (int object = 1; object <= NOBJECTS; object++) {
if (objects[object].is_treasure) {
++game.tally;
if (objects[object].inventory != NULL) {
OBJECT_SET_NOT_FOUND(object);
}
} else {
OBJECT_SET_FOUND(object);
}
}
game.conds = setbit(COND_HBASE);
return seedval;
}

BIN
lamp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

2413
main.c

File diff suppressed because it is too large Load diff

10
main.h
View file

@ -1,10 +0,0 @@
#include <stdbool.h>
#define LINESIZE 100
extern long ABB[], ATAB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
KTAB[], *LINES, LINK[], LNLENG, LNPOSN,
PARMS[], PLACE[], PTEXT[], RTEXT[], TABSIZ;
extern signed char INLINE[LINESIZE+1], MAP1[], MAP2[];
extern FILE *logfp;
extern bool oldstyle;

663
make_dungeon.py Executable file
View file

@ -0,0 +1,663 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
"""
This is the open-adventure dungeon generator. It consumes a YAML description of
the dungeon and outputs a dungeon.h and dungeon.c pair of C code files.
The nontrivial part of this is the compilation of the YAML for
movement rules to the travel array that's actually used by
playermove().
"""
# pylint: disable=consider-using-f-string,line-too-long,invalid-name,missing-function-docstring,too-many-branches,global-statement,multiple-imports,too-many-locals,too-many-statements,too-many-nested-blocks,no-else-return,raise-missing-from,redefined-outer-name
import sys, yaml
YAML_NAME = "adventure.yaml"
H_NAME = "dungeon.h"
C_NAME = "dungeon.c"
H_TEMPLATE_PATH = "templates/dungeon.h.tpl"
C_TEMPLATE_PATH = "templates/dungeon.c.tpl"
DONOTEDIT_COMMENT = "/* Generated from adventure.yaml - do not hand-hack! */\n\n"
statedefines = ""
def make_c_string(string):
"""Render a Python string into C string literal format."""
if string is None:
return "NULL"
string = string.replace("\n", "\\n")
string = string.replace("\t", "\\t")
string = string.replace('"', '\\"')
string = string.replace("'", "\\'")
string = '"' + string + '"'
return string
def get_refs(l):
reflist = [x[0] for x in l]
ref_str = ""
for ref in reflist:
ref_str += " {},\n".format(ref)
ref_str = ref_str[:-1] # trim trailing newline
return ref_str
def get_string_group(strings):
template = """{{
.strs = {},
.n = {},
}}"""
if strings == []:
strs = "NULL"
else:
strs = (
"(const char* []) {" + ", ".join([make_c_string(s) for s in strings]) + "}"
)
n = len(strings)
sg_str = template.format(strs, n)
return sg_str
def get_arbitrary_messages(arb):
template = """ {},
"""
arb_str = ""
for item in arb:
arb_str += template.format(make_c_string(item[1]))
arb_str = arb_str[:-1] # trim trailing newline
return arb_str
def get_class_messages(cls):
template = """ {{
.threshold = {},
.message = {},
}},
"""
cls_str = ""
for item in cls:
threshold = item["threshold"]
message = make_c_string(item["message"])
cls_str += template.format(threshold, message)
cls_str = cls_str[:-1] # trim trailing newline
return cls_str
def get_turn_thresholds(trn):
template = """ {{
.threshold = {},
.point_loss = {},
.message = {},
}},
"""
trn_str = ""
for item in trn:
threshold = item["threshold"]
point_loss = item["point_loss"]
message = make_c_string(item["message"])
trn_str += template.format(threshold, point_loss, message)
trn_str = trn_str[:-1] # trim trailing newline
return trn_str
def get_locations(loc):
template = """ {{ // {}: {}
.description = {{
.small = {},
.big = {},
}},
.sound = {},
.loud = {},
}},
"""
loc_str = ""
for (i, item) in enumerate(loc):
short_d = make_c_string(item[1]["description"]["short"])
long_d = make_c_string(item[1]["description"]["long"])
sound = item[1].get("sound", "SILENT")
loud = "true" if item[1].get("loud") else "false"
loc_str += template.format(i, item[0], short_d, long_d, sound, loud)
loc_str = loc_str[:-1] # trim trailing newline
return loc_str
def get_objects(obj):
template = """ {{ // {}: {}
.words = {},
.inventory = {},
.plac = {},
.fixd = {},
.is_treasure = {},
.descriptions = (const char* []) {{
{}
}},
.sounds = (const char* []) {{
{}
}},
.texts = (const char* []) {{
{}
}},
.changes = (const char* []) {{
{}
}},
}},
"""
max_state = 0
obj_str = ""
for (i, item) in enumerate(obj):
attr = item[1]
try:
words_str = get_string_group(attr["words"])
except KeyError:
words_str = get_string_group([])
i_msg = make_c_string(attr["inventory"])
descriptions_str = ""
if attr["descriptions"] is None:
descriptions_str = " " * 12 + "NULL,"
else:
labels = []
for l_msg in attr["descriptions"]:
descriptions_str += " " * 12 + make_c_string(l_msg) + ",\n"
for label in attr.get("states", []):
labels.append(label)
descriptions_str = descriptions_str[:-1] # trim trailing newline
if labels:
global statedefines
statedefines += "/* States for %s */\n" % item[0]
for (n, label) in enumerate(labels):
statedefines += "#define %s\t%d\n" % (label, n)
max_state = max(max_state, n)
statedefines += "\n"
sounds_str = ""
if attr.get("sounds") is None:
sounds_str = " " * 12 + "NULL,"
else:
for l_msg in attr["sounds"]:
sounds_str += " " * 12 + make_c_string(l_msg) + ",\n"
sounds_str = sounds_str[:-1] # trim trailing newline
texts_str = ""
if attr.get("texts") is None:
texts_str = " " * 12 + "NULL,"
else:
for l_msg in attr["texts"]:
texts_str += " " * 12 + make_c_string(l_msg) + ",\n"
texts_str = texts_str[:-1] # trim trailing newline
changes_str = ""
if attr.get("changes") is None:
changes_str = " " * 12 + "NULL,"
else:
for l_msg in attr["changes"]:
changes_str += " " * 12 + make_c_string(l_msg) + ",\n"
changes_str = changes_str[:-1] # trim trailing newline
locs = attr.get("locations", ["LOC_NOWHERE", "LOC_NOWHERE"])
immovable = attr.get("immovable", False)
try:
if isinstance(locs, str):
locs = [locs, -1 if immovable else 0]
except IndexError:
sys.stderr.write("dungeon: unknown object location in %s\n" % locs)
sys.exit(1)
treasure = "true" if attr.get("treasure") else "false"
obj_str += template.format(
i,
item[0],
words_str,
i_msg,
locs[0],
locs[1],
treasure,
descriptions_str,
sounds_str,
texts_str,
changes_str,
)
obj_str = obj_str[:-1] # trim trailing newline
statedefines += "/* Maximum state value */\n#define MAX_STATE %d\n" % max_state
return obj_str
def get_obituaries(obit):
template = """ {{
.query = {},
.yes_response = {},
}},
"""
obit_str = ""
for o in obit:
query = make_c_string(o["query"])
yes = make_c_string(o["yes_response"])
obit_str += template.format(query, yes)
obit_str = obit_str[:-1] # trim trailing newline
return obit_str
def get_hints(hnt):
template = """ {{
.number = {},
.penalty = {},
.turns = {},
.question = {},
.hint = {},
}},
"""
hnt_str = ""
for member in hnt:
item = member["hint"]
number = item["number"]
penalty = item["penalty"]
turns = item["turns"]
question = make_c_string(item["question"])
hint = make_c_string(item["hint"])
hnt_str += template.format(number, penalty, turns, question, hint)
hnt_str = hnt_str[:-1] # trim trailing newline
return hnt_str
def get_condbits(locations):
cnd_str = ""
for (name, loc) in locations:
conditions = loc["conditions"]
hints = loc.get("hints") or []
flaglist = []
for flag in conditions:
if conditions[flag]:
flaglist.append(flag)
line = "|".join([("(1<<COND_%s)" % f) for f in flaglist])
trail = "|".join([("(1<<COND_H%s)" % f["name"]) for f in hints])
if trail:
line += "|" + trail
if line.startswith("|"):
line = line[1:]
if not line:
line = "0"
cnd_str += " " + line + ",\t// " + name + "\n"
return cnd_str
def get_motions(motions):
template = """ {{
.words = {},
}},
"""
mot_str = ""
for motion in motions:
contents = motion[1]
if contents["words"] is None:
words_str = get_string_group([])
else:
words_str = get_string_group(contents["words"])
mot_str += template.format(words_str)
global ignore
if not contents.get("oldstyle", True):
for word in contents["words"]:
if len(word) == 1:
ignore += word.upper()
return mot_str
def get_actions(actions):
template = """ {{
.words = {},
.message = {},
.noaction = {},
}},
"""
act_str = ""
for action in actions:
contents = action[1]
if contents["words"] is None:
words_str = get_string_group([])
else:
words_str = get_string_group(contents["words"])
if contents["message"] is None:
message = "NULL"
else:
message = make_c_string(contents["message"])
if contents.get("noaction") is None:
noaction = "false"
else:
noaction = "true"
act_str += template.format(words_str, message, noaction)
global ignore
if not contents.get("oldstyle", True):
for word in contents["words"]:
if len(word) == 1:
ignore += word.upper()
act_str = act_str[:-1] # trim trailing newline
return act_str
def bigdump(arr):
out = ""
for (i, _) in enumerate(arr):
if i % 10 == 0:
if out and out[-1] == " ":
out = out[:-1]
out += "\n "
out += str(arr[i]).lower() + ", "
out = out[:-2] + "\n"
return out
def buildtravel(locs, objs):
assert len(locs) <= 300
assert len(objs) <= 100
# THIS CODE IS WAAAY MORE COMPLEX THAN IT NEEDS TO BE. It's the
# result of a massive refactoring exercise that concentrated all
# the old nastiness in one spot. It hasn't been finally simplified
# because there's no need to do it until one of the assertions
# fails. Hint: if you try cleaning this up, the acceptance test is
# simple - the output dungeon.c must not change.
#
# This function first compiles the YAML to a form identical to the
# data in section 3 of the old adventure.text file, then a second
# stage unpacks that data into the travel array. Here are the
# rules of that intermediate form:
#
# Each row of data contains a location number (X), a second
# location number (Y), and a list of motion numbers (see section 4).
# each motion represents a verb which will go to Y if currently at X.
# Y, in turn, is interpreted as follows. Let M=Y/1000, N=Y mod 1000.
# If N<=300 it is the location to go to.
# If 300<N<=500 N-300 is used in a computed goto to
# a section of special code.
# If N>500 message N-500 from section 6 is printed,
# and he stays wherever he is.
# Meanwhile, M specifies the conditions on the motion.
# If M=0 it's unconditional.
# If 0<M<100 it is done with M% probability.
# If M=100 unconditional, but forbidden to dwarves.
# If 100<M<=200 he must be carrying object M-100.
# If 200<M<=300 must be carrying or in same room as M-200.
# If 300<M<=400 game.prop(M % 100) must *not* be 0.
# If 400<M<=500 game.prop(M % 100) must *not* be 1.
# If 500<M<=600 game.prop(M % 100) must *not* be 2, etc.
# If the condition (if any) is not met, then the next *different*
# "destination" value is used (unless it fails to meet *its* conditions,
# in which case the next is found, etc.). Typically, the next dest will
# be for one of the same verbs, so that its only use is as the alternate
# destination for those verbs. For instance:
# 15 110022 29 31 34 35 23 43
# 15 14 29
# This says that, from loc 15, any of the verbs 29, 31, etc., will take
# him to 22 if he's carrying object 10, and otherwise will go to 14.
# 11 303008 49
# 11 9 50
# This says that, from 11, 49 takes him to 8 unless game.prop[3]=0, in which
# case he goes to 9. Verb 50 takes him to 9 regardless of game.prop[3].
ltravel = []
verbmap = {}
for i, motion in enumerate(db["motions"]):
try:
for word in motion[1]["words"]:
verbmap[word.upper()] = i
except TypeError:
pass
def dencode(action, name):
"Decode a destination number"
if action[0] == "goto":
try:
return locnames.index(action[1])
except ValueError:
sys.stderr.write(
"dungeon: unknown location %s in goto clause of %s\n"
% (action[1], name)
)
raise ValueError
elif action[0] == "special":
return 300 + action[1]
elif action[0] == "speak":
try:
return 500 + msgnames.index(action[1])
except ValueError:
sys.stderr.write(
"dungeon: unknown location %s in carry clause of %s\n"
% (cond[1], name)
)
else:
print(cond)
raise ValueError
return "" # Pacify pylint
def cencode(cond, name):
if cond is None:
return 0
if cond == ["nodwarves"]:
return 100
elif cond[0] == "pct":
return cond[1]
elif cond[0] == "carry":
try:
return 100 + objnames.index(cond[1])
except ValueError:
sys.stderr.write(
"dungeon: unknown object name %s in carry clause of %s\n"
% (cond[1], name)
)
sys.exit(1)
elif cond[0] == "with":
try:
return 200 + objnames.index(cond[1])
except IndexError:
sys.stderr.write(
"dungeon: unknown object name %s in with clause of %s\n"
% (cond[1], name)
)
sys.exit(1)
elif cond[0] == "not":
try:
obj = objnames.index(cond[1])
if isinstance(cond[2], int):
state = cond[2]
elif cond[2] in objs[obj][1].get("states", []):
state = objs[obj][1].get("states").index(cond[2])
else:
for (i, stateclause) in enumerate(objs[obj][1]["descriptions"]):
if isinstance(stateclause, list):
if stateclause[0] == cond[2]:
state = i
break
else:
sys.stderr.write(
"dungeon: unmatched state symbol %s in not clause of %s\n"
% (cond[2], name)
)
sys.exit(0)
return 300 + obj + 100 * state
except ValueError:
sys.stderr.write(
"dungeon: unknown object name %s in not clause of %s\n"
% (cond[1], name)
)
sys.exit(1)
else:
print(cond)
raise ValueError
for (i, (name, loc)) in enumerate(locs):
if "travel" in loc:
for rule in loc["travel"]:
tt = [i]
dest = dencode(rule["action"], name) + 1000 * cencode(
rule.get("cond"), name
)
tt.append(dest)
tt += [motionnames[verbmap[e]].upper() for e in rule["verbs"]]
if not rule["verbs"]:
tt.append(1) # Magic dummy entry for null rules
ltravel.append(tuple(tt))
# At this point the ltravel data is in the Section 3
# representation from the FORTRAN version. Next we perform the
# same mapping into what used to be the runtime format.
travel = [[0, "LOC_NOWHERE", 0, 0, 0, 0, 0, 0, "false", "false"]]
tkey = [0]
oldloc = 0
while ltravel:
rule = list(ltravel.pop(0))
loc = rule.pop(0)
newloc = rule.pop(0)
if loc != oldloc:
tkey.append(len(travel))
oldloc = loc
elif travel:
travel[-1][-1] = "false" if travel[-1][-1] == "true" else "true"
while rule:
cond = newloc // 1000
nodwarves = cond == 100
if cond == 0:
condtype = "cond_goto"
condarg1 = condarg2 = 0
elif cond < 100:
condtype = "cond_pct"
condarg1 = cond
condarg2 = 0
elif cond == 100:
condtype = "cond_goto"
condarg1 = 100
condarg2 = 0
elif cond <= 200:
condtype = "cond_carry"
condarg1 = objnames[cond - 100]
condarg2 = 0
elif cond <= 300:
condtype = "cond_with"
condarg1 = objnames[cond - 200]
condarg2 = 0
else:
condtype = "cond_not"
condarg1 = cond % 100
condarg2 = (cond - 300) // 100.0
dest = newloc % 1000
if dest <= 300:
desttype = "dest_goto"
destval = locnames[dest]
elif dest > 500:
desttype = "dest_speak"
destval = msgnames[dest - 500]
else:
desttype = "dest_special"
destval = locnames[dest - 300]
travel.append(
[
len(tkey) - 1,
locnames[len(tkey) - 1],
rule.pop(0),
condtype,
condarg1,
condarg2,
desttype,
destval,
"true" if nodwarves else "false",
"false",
]
)
travel[-1][-1] = "true"
return (travel, tkey)
def get_travel(travel):
template = """ {{ // from {}: {}
.motion = {},
.condtype = {},
.condarg1 = {},
.condarg2 = {},
.desttype = {},
.destval = {},
.nodwarves = {},
.stop = {},
}},
"""
out = ""
for entry in travel:
out += template.format(*entry)
out = out[:-1] # trim trailing newline
return out
if __name__ == "__main__":
with open(YAML_NAME, "r", encoding="ascii", errors="surrogateescape") as f:
db = yaml.safe_load(f)
locnames = [x[0] for x in db["locations"]]
msgnames = [el[0] for el in db["arbitrary_messages"]]
objnames = [el[0] for el in db["objects"]]
motionnames = [el[0] for el in db["motions"]]
(travel, tkey) = buildtravel(db["locations"], db["objects"])
ignore = ""
try:
with open(
H_TEMPLATE_PATH, "r", encoding="ascii", errors="surrogateescape"
) as htf:
# read in dungeon.h template
h_template = DONOTEDIT_COMMENT + htf.read()
with open(
C_TEMPLATE_PATH, "r", encoding="ascii", errors="surrogateescape"
) as ctf:
# read in dungeon.c template
c_template = DONOTEDIT_COMMENT + ctf.read()
except IOError as e:
print("ERROR: reading template failed ({})".format(e.strerror))
sys.exit(-1)
c = c_template.format(
h_file=H_NAME,
arbitrary_messages=get_arbitrary_messages(db["arbitrary_messages"]),
classes=get_class_messages(db["classes"]),
turn_thresholds=get_turn_thresholds(db["turn_thresholds"]),
locations=get_locations(db["locations"]),
objects=get_objects(db["objects"]),
obituaries=get_obituaries(db["obituaries"]),
hints=get_hints(db["hints"]),
conditions=get_condbits(db["locations"]),
motions=get_motions(db["motions"]),
actions=get_actions(db["actions"]),
tkeys=bigdump(tkey),
travel=get_travel(travel),
ignore=ignore,
dwarflocs=", ".join(db["dwarflocs"]) + ",",
)
# 0-origin index of birds's last song. Bird should
# die after player hears this.
deathbird = len(dict(db["objects"])["BIRD"]["sounds"]) - 1
h = h_template.format(
num_locations=len(db["locations"]) - 1,
num_objects=len(db["objects"]) - 1,
num_hints=len(db["hints"]),
num_classes=len(db["classes"]) - 1,
num_deaths=len(db["obituaries"]),
num_thresholds=len(db["turn_thresholds"]),
num_motions=len(db["motions"]),
num_actions=len(db["actions"]),
num_travel=len(travel),
num_keys=len(tkey),
bird_endstate=deathbird,
arbitrary_messages=get_refs(db["arbitrary_messages"]),
locations=get_refs(db["locations"]),
objects=get_refs(db["objects"]),
motions=get_refs(db["motions"]),
actions=get_refs(db["actions"]),
state_definitions=statedefines,
ndwarflocs=str(len(db["dwarflocs"])),
)
with open(H_NAME, "w", encoding="ascii", errors="surrogateescape") as hf:
hf.write(h)
with open(C_NAME, "w", encoding="ascii", errors="surrogateescape") as cf:
cf.write(c)
# end

221
make_graph.py Executable file
View file

@ -0,0 +1,221 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
"""\
usage: make_graph.py [-a] [-d] [-m] [-s] [-v]
Make a DOT graph of Colossal Cave.
-a = emit graph of entire dungeon
-d = emit graph of maze all different
-f = emit graph of forest locations
-m = emit graph of maze all alike
-s = emit graph of non-forest surface locations
-v = include internal symbols in room labels
"""
# pylint: disable=consider-using-f-string,line-too-long,invalid-name,missing-function-docstring,multiple-imports,redefined-outer-name
import sys, getopt, yaml
def allalike(loc):
"Select out loci related to the Maze All Alike"
return location_lookup[loc]["conditions"].get("ALLALIKE")
def alldifferent(loc):
"Select out loci related to the Maze All Alike"
return location_lookup[loc]["conditions"].get("ALLDIFFERENT")
def surface(loc):
"Select out surface locations"
return location_lookup[loc]["conditions"].get("ABOVE")
def forest(loc):
return location_lookup[loc]["conditions"].get("FOREST")
def abbreviate(d):
m = {
"NORTH": "N",
"EAST": "E",
"SOUTH": "S",
"WEST": "W",
"UPWAR": "U",
"DOWN": "D",
}
return m.get(d, d)
def roomlabel(loc):
"Generate a room label from the description, if possible"
loc_descriptions = location_lookup[loc]["description"]
description = ""
if debug:
description = loc[4:]
longd = loc_descriptions["long"]
short = loc_descriptions["maptag"] or loc_descriptions["short"]
if short is None and longd is not None and len(longd) < 20:
short = loc_descriptions["long"]
if short is not None:
if short.startswith("You're "):
short = short[7:]
if short.startswith("You are "):
short = short[8:]
if (
short.startswith("in ")
or short.startswith("at ")
or short.startswith("on ")
):
short = short[3:]
if short.startswith("the "):
short = short[4:]
if short[:3] in {"n/s", "e/w"}:
short = short[:3].upper() + short[3:]
elif short[:2] in {"ne", "sw", "se", "nw"}:
short = short[:2].upper() + short[2:]
else:
short = short[0].upper() + short[1:]
if debug:
description += "\\n"
description += short
if loc in startlocs:
description += "\\n(" + ",".join(startlocs[loc]).lower() + ")"
return description
# A forwarder is a location that you can't actually stop in - when you go there
# it ships some message (which is the point) then shifts you to a next location.
# A forwarder has a zero-length array of notion verbs in its travel section.
#
# Here is an example forwarder declaration:
#
# - LOC_GRUESOME:
# description:
# long: 'There is now one more gruesome aspect to the spectacular vista.'
# short: !!null
# maptag: !!null
# conditions: {DEEP: true}
# travel: [
# {verbs: [], action: [goto, LOC_NOWHERE]},
# ]
def is_forwarder(loc):
"Is a location a forwarder?"
travel = location_lookup[loc]["travel"]
return len(travel) == 1 and len(travel[0]["verbs"]) == 0
def forward(loc):
"Chase a location through forwarding links."
while is_forwarder(loc):
loc = location_lookup[loc]["travel"][0]["action"][1]
return loc
def reveal(objname):
"Should this object be revealed when mapping?"
if "OBJ_" in objname:
return False
if objname == "VEND":
return True
obj = object_lookup[objname]
return not obj.get("immovable")
if __name__ == "__main__":
with open("adventure.yaml", "r", encoding="ascii", errors="surrogateescape") as f:
db = yaml.safe_load(f)
location_lookup = dict(db["locations"])
object_lookup = dict(db["objects"])
try:
(options, arguments) = getopt.getopt(sys.argv[1:], "adfmsv")
except getopt.GetoptError as e:
print(e)
sys.exit(1)
subset = allalike
debug = False
for (switch, val) in options:
if switch == "-a":
# pylint: disable=unnecessary-lambda-assignment
subset = lambda loc: True
elif switch == "-d":
subset = alldifferent
elif switch == "-f":
subset = forest
elif switch == "-m":
subset = allalike
elif switch == "-s":
subset = surface
elif switch == "-v":
debug = True
else:
sys.stderr.write(__doc__)
raise SystemExit(1)
startlocs = {}
for obj in db["objects"]:
objname = obj[0]
location = obj[1].get("locations")
if location != "LOC_NOWHERE" and reveal(objname):
if location in startlocs:
startlocs[location].append(objname)
else:
startlocs[location] = [objname]
# Compute reachability, using forwards.
# Dictionary key is (from, to) iff its a valid link,
# value is corresponding motion verbs.
links = {}
nodes = []
for (loc, attrs) in db["locations"]:
nodes.append(loc)
travel = attrs["travel"]
if len(travel) > 0:
for dest in travel:
verbs = [abbreviate(x) for x in dest["verbs"]]
if len(verbs) == 0:
continue
action = dest["action"]
if action[0] == "goto":
dest = forward(action[1])
if not (subset(loc) or subset(dest)):
continue
links[(loc, dest)] = verbs
neighbors = set()
for loc in nodes:
for (f, t) in links:
if f == "LOC_NOWHERE" or t == "LOC_NOWHERE":
continue
if (f == loc and subset(t)) or (t == loc and subset(f)):
if loc not in neighbors:
neighbors.add(loc)
print("digraph G {")
for loc in nodes:
if not is_forwarder(loc):
node_label = roomlabel(loc)
if subset(loc):
print(' %s [shape=box,label="%s"]' % (loc[4:], node_label))
elif loc in neighbors:
print(' %s [label="%s"]' % (loc[4:], node_label))
# Draw arcs
for (f, t) in links:
arc = "%s -> %s" % (f[4:], t[4:])
label = ",".join(links[(f, t)]).lower()
if len(label) > 0:
arc += ' [label="%s"]' % label
print(" " + arc)
print("}")
# end

1729
misc.c

File diff suppressed because it is too large Load diff

76
misc.h
View file

@ -1,76 +0,0 @@
#include <time.h>
#include <stdio.h>
/* b is not needed for POSIX but harmless */
#define READ_MODE "rb"
#define WRITE_MODE "wb"
extern void fSPEAK(long);
#define SPEAK(N) fSPEAK(N)
extern void fPSPEAK(long,long);
#define PSPEAK(MSG,SKIP) fPSPEAK(MSG,SKIP)
extern void fRSPEAK(long);
#define RSPEAK(I) fRSPEAK(I)
extern void fSETPRM(long,long,long);
#define SETPRM(FIRST,P1,P2) fSETPRM(FIRST,P1,P2)
extern void fGETIN(long*,long*,long*,long*);
#define GETIN(WORD1,WORD1X,WORD2,WORD2X) fGETIN(&WORD1,&WORD1X,&WORD2,&WORD2X)
extern long fYES(long,long,long);
#define YES(X,Y,Z) fYES(X,Y,Z)
extern long fGETNUM(FILE *);
#define GETNUM(K) fGETNUM(K)
extern long fGETTXT(long,long,long,long);
#define GETTXT(SKIP,ONEWRD,UPPER,HASH) fGETTXT(SKIP,ONEWRD,UPPER,HASH)
extern long fMAKEWD(long);
#define MAKEWD(LETTRS) fMAKEWD(LETTRS)
extern void fPUTTXT(long,long*,long,long);
#define PUTTXT(WORD,STATE,CASE,HASH) fPUTTXT(WORD,&STATE,CASE,HASH)
extern void fSHFTXT(long,long);
#define SHFTXT(FROM,DELTA) fSHFTXT(FROM,DELTA)
extern void fTYPE0();
#define TYPE0() fTYPE0()
extern void fSAVWDS(long*,long*,long*,long*,long*,long*,long*);
#define SAVWDS(W1,W2,W3,W4,W5,W6,W7) fSAVWDS(&W1,&W2,&W3,&W4,&W5,&W6,&W7)
extern void fSAVARR(long*,long);
#define SAVARR(ARR,N) fSAVARR(ARR,N)
extern void fSAVWRD(long,long*);
#define SAVWRD(OP,WORD) fSAVWRD(OP,&WORD)
extern long fVOCAB(long,long);
#define VOCAB(ID,INIT) fVOCAB(ID,INIT)
extern void fDSTROY(long);
#define DSTROY(OBJECT) fDSTROY(OBJECT)
extern void fJUGGLE(long);
#define JUGGLE(OBJECT) fJUGGLE(OBJECT)
extern void fMOVE(long,long);
#define MOVE(OBJECT,WHERE) fMOVE(OBJECT,WHERE)
extern long fPUT(long,long,long);
#define PUT(OBJECT,WHERE,PVAL) fPUT(OBJECT,WHERE,PVAL)
extern void fCARRY(long,long);
#define CARRY(OBJECT,WHERE) fCARRY(OBJECT,WHERE)
extern void fDROP(long,long);
#define DROP(OBJECT,WHERE) fDROP(OBJECT,WHERE)
extern long fATDWRF(long);
#define ATDWRF(WHERE) fATDWRF(WHERE)
extern long fSETBIT(long);
#define SETBIT(BIT) fSETBIT(BIT)
extern long fTSTBIT(long,long);
#define TSTBIT(MASK,BIT) fTSTBIT(MASK,BIT)
extern long fRAN(long);
#define RAN(RANGE) fRAN(RANGE)
extern long fRNDVOC(long,long);
#define RNDVOC(CHAR,FORCE) fRNDVOC(CHAR,FORCE)
extern void fBUG(long);
#define BUG(NUM) fBUG(NUM)
extern void fMAPLIN(FILE *);
#define MAPLIN(FIL) fMAPLIN(FIL)
extern void fTYPE();
#define TYPE() fTYPE()
extern void fMPINIT();
#define MPINIT() fMPINIT()
extern void fSAVEIO(long,long,long*);
#define SAVEIO(OP,IN,ARR) fSAVEIO(OP,IN,ARR)
#define DATIME(D,T) do {struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); D=ts.tv_sec, T=ts.tv_nsec;} while (0)
extern long fIABS(long);
#define IABS(N) fIABS(N)
extern long fMOD(long,long);
#define MOD(N,M) fMOD(N,M)

229
notes.adoc Normal file
View file

@ -0,0 +1,229 @@
= Open Adventure Maintainer's Notes =
by Eric S. Raymond
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
In which we explain what has been done to this code since Don Woods
authorized us to ship it under an open-source license. There's a
separate link:history.html[history] describing how it came to us.
== Who we are ==
The principal maintainers of this code are Eric S. Raymond and Jason
Ninneman. Eric received Don Woods's encouragement to update and ship
the game; Jason signed on early in the process to help. The assistance
of Peje Nilsson in restructuring some particularly grotty gotos is
gratefully acknowledged. Petr Voropaev contributed fuzz testing and
code cleanups. Aaron Traas did a lot of painstaking work to improve
test coverage, and factored out the last handful of gotos. Ryan
Sarson nudged us into fixing a longstanding minor bug in the
handling of incorrect magic-word sequences,
== Nomenclature ==
This project is called "Open Adventure" because it's not at all clear
to number Adventure past 2.5 without misleading or causing
collisions. Various of the non-mainline versions have claimed to be
versions 3, 4, 5, 6, 7 and for all I know higher than that. It seems
best just to start a new numbering series while acknowledging the
links back.
We have reverted to "advent" for the binary to avoid a name collision
with the BSD Games version.
== Philosophy ==
Extreme care has been taken not to make changes that would alter the
logic of the game as we received it from Don Woods, except to fix
glitches that were clearly bugs. By policy, all user-visible
changes to gameplay must be revertible with the -o (oldstyle) option.
It is a goal of this project to exactly preserve the *intended
behavior* of 430-point Adventure, but the implementation of it is fair
game for improvement. In particular, we are concerned to move it to a
form that is (a) readable, and (b) friendly to forward translation to
future languages. It has already survived a move from FORTRAN to C; a
future as a Python or Go translation seems possible, even probable.
Compatibility with the 2.5 source we found has been checked by
building a version patched minimally to support the seed command and
running it against the entire test suite, which has 100% code
coverage.
== Functional changes ==
Bug fixes:
* The caged bird used to be counted as two items in your inventory.
* Reading the relocated Witt's End sign in the endgame didn't work right.
* Oyster was readable after first gotten even when not carried.
* Response to an attempt to unlock the oyster while carrying it was incorrect.
* Behavior when saying the giant's magic words before having seen them
wasn't quite correct - the game responded as though the player had
already read them ("...can't you read?"). The new message is "Well,
that was remarkably pointless!" The -o option reverts this change.
* Attempting to extinguish an unlit urn caused it to lose its oil.
* "A crystal bridge now spans the fissure." (progressive present) was
incorrect most places it appeared and has been replaced by "A crystal
bridge spans the fissure." (timeless present).
* A few minor typos have been corrected: absence of capitalization on
"Swiss" and "Persian", inconsistent spelling of "imbedded" vs. "embedded",
"eying" for "eyeing", "thresholds" for "threshholds", "pencilled"
for "penciled".
* Under odd circumstances (dropping rug or vase outdoors) the game could
formerly say "floor" when it should say "ground" (or "dirt", or
something).
* The "knives vanish" message could formerly be emitted when "I see no
knife here." would be appropriate.
Enhancements:
By default, advent issues "> " as a command prompt. This feature
became common in many variants after the original 350-point version,
but was never backported into Crowther & Woods's main line before now.
The "-o" (oldstyle) option reverts the behavior.
There is a set of standard one-letter command aliases conventional in modern
text adventure games; 'l' and 'x'; for 'look' (or 'examine'), 'z' to do nothing
for a turn, 'i' for 'inventory', 'g' for 'get', and 'd' for 'drop'. The 'd'
alias collides with 'd' for 'down', but the others have been implemented.
The "-o" (oldstyle) option disables them.
Unrecognized words are no longer truncated to 5 characters and
uppercased when they are echoed. The "-o" (oldstyle) option restores
this behavior.
A "seed" command has been added. This is not intended for human use
but as a way for game logs to set the PRNG (pseudorandom-number generator) so
that random events (dwarf & pirate appearances, the bird's magic word)
will be reproducible.
A "version" command has been added. This has no effect on gameplay.
The text displayed by the "news" command has been updated.
A -l command-line option has been added. When this is given (with a
file path argument) each command entered will be logged to the
specified file. Additionally, a generated "seed" command will be put
early in the file capturing the randomized start state of the PRNG
so that replays of the log will be reproducible.
Using "seed" and -l, the distribution now includes a regression-test
suite for the game. Any log captured with -l (and thus containing
a "seed" command) will replay reliably, including random events.
The adventure.text file is no longer required at runtime. Instead, an
adventure.yaml file is compiled at build time to a source module
containing C structures, which is then linked to the advent
binary. The YAML is drastically easier to read and edit than
the old ad-hoc format of adventure.txt.
The game-save format has changed. This was done to simplify the
FORTRAN-derived code that formerly implemented the save/restore
functions; without C's fread(3)/fwrite() and structs it was
necessarily pretty ugly by modern standards. Encryption and
checksumming have been discarded - it's pointless to try
tamper-proofing saves when everyone has the source code. However
the game still integrity-checks savefiles on resume, including an
abort if the endianness of the restoring machine does not match that of
the saving machine. There is a magic-cookie header on the saves so
in theory they could be identified by programs like file(1).
Save and resume filenames are stripped of leading and trailing
whitespace before processing.
A -r command-line option has been added. When it is given (with a file
path argument) it is functionally equivalent to a RESTORE command.
An -a command-line option has been added (conditionally on
ADVENT_AUTOSAVE) for use in BBS door systems. When this option is
given, the game roads from the specified filename argument on startup
and saves to it on quit or a received signal. There is a new nmessage
to inform the user about this.
The game can be built in a mode that entirely disables save/resume
(-DADVENT_NOSAVE). If the game had been built this way, a diagnostic is
emitted if you try to save or resume.
== Translation ==
The 2.5 code was a mechanical C translation of a FORTRAN original.
There were gotos everywhere and the code was, though functional,
ugly and quite unreadable.
Jason Ninneman and I have moved it to what is almost, but not quite,
idiomatic modern C. We refactored the right way, checking correctness
against a comprehensive test suite that we built first and verified
with coverage tools (there is effectively 100% code coverage). This is
what you are running when you do "make check".
The move to modern C entailed some structural changes. The most
important was the refactoring of over 350 gotos into if/loop/break
structures. We also abolished almost all shared globals; the main one
left is a struct holding the game's saveable/restorable state.
The original code was greatly complicated by a kind of bit-packing
that was performed because the FORTRAN it was written in had no string
type. Text from the adventure.text file was compiled into sequences
of sixbit code points in a restricted character set, packed 5 to a
32-bit word (and it seems clear from the code that words were originally
*6* chars each packed into a PDP-10 36-bit word). A command noun or
verb was one of these words, and what would be string operations in a
more recent language were all done on sequences of these words.
We have removed all this bit-packing cruft in favor of proper C
strings. C strings may be a weak and leaky abstraction, but this is
one of the rare cases in which they are an obvious improvement over
what they're displacing...
We have also conducted extensive fuzz testing on the game using
afl (American Fuzzy Lop). We've found and fixed some crashers in
our new code (which occasionally uses malloc(3)), but none as yet
in Don's old code (which didn't).
After version 1.11, correctness was carefully checked against the
behavior of a binary from before the big refactoring.
The code falls short of being fully modern C in the following
ways:
* We have not attempted to translate the old code to pointer-based
idioms (as opposed, in particular, to integer-based array indexing).
We don't need whatever minor performance gains this might collect,
and the choice to refrain will make forward translation into future
languages easier.
* Linked lists (for objects at a location) are implemented using an array
of link indices. This is a surviving FORTRANism that is quite unlike
normal practice in C or any more modern language. We have not tried
to fix it because doing so would (a) be quite difficult, and (b)
compromise forward-portability to other languages.
* Much of the code still assumes one-origin array indexing. Thus,
arrays are a cell larger than they strictly need to be and cell 0 is
unused.
We have made exactly one minor architectural change. In addition to the
old code's per-object state-description messages, we now have a per-object
message series for state *changes*. This makes it possible to pull a fair
amount of text out of the arbitrary-messages list and associate those
messages with the objects that conceptually own them.
== Development status ==
We consider this project finished. All issues and TODOs have been
cleared, behavior has been carefully checked against original ADVENT,
no future demand for new features is expected, and the test suite has
100% code coverage. If new bugs appear as the toolchain bit-rots out
from under underneath, we will fix those problems.
// end

267
saveresume.c Normal file
View file

@ -0,0 +1,267 @@
/*
* Saving and resuming.
*
* (ESR) This replaces a bunch of particularly nasty FORTRAN-derived code;
* see the history.adoc file in the source distribution for discussion.
*
* SPDX-FileCopyrightText: (C) 1977, 2005 by Will Crowther and Don Woods
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <ctype.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "advent.h"
/*
* Use this to detect endianness mismatch. Can't be unchanged by byte-swapping.
*/
#define ENDIAN_MAGIC 2317
struct save_t save;
#define IGNORE(r) \
do { \
if (r) { \
} \
} while (0)
int savefile(FILE *fp) {
/* Save game to file. No input or output from user. */
memcpy(&save.magic, ADVENT_MAGIC, sizeof(ADVENT_MAGIC));
if (save.version == 0) {
save.version = SAVE_VERSION;
}
if (save.canary == 0) {
save.canary = ENDIAN_MAGIC;
}
save.game = game;
IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp));
return (0);
}
/* Suspend and resume */
static char *strip(char *name) {
// Trim leading whitespace
while (isspace((unsigned char)*name)) {
name++; // LCOV_EXCL_LINE
}
if (*name != '\0') {
// Trim trailing whitespace;
// might be left there by autocomplete
char *end = name + strlen(name) - 1;
while (end > name && isspace((unsigned char)*end)) {
end--;
}
// Write new null terminator character
end[1] = '\0';
}
return name;
}
int suspend(void) {
/* Suspend. Offer to save things in a file, but charging
* some points (so can't win by using saved games to retry
* battles or to start over after learning zzword).
* If ADVENT_NOSAVE is defined, gripe instead. */
#if defined ADVENT_NOSAVE || defined ADVENT_AUTOSAVE
rspeak(SAVERESUME_DISABLED);
return GO_TOP;
#endif
FILE *fp = NULL;
rspeak(SUSPEND_WARNING);
if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE],
arbitrary_messages[OK_MAN],
arbitrary_messages[OK_MAN])) {
return GO_CLEAROBJ;
}
game.saved = game.saved + 5;
while (fp == NULL) {
char *name = myreadline("\nFile name: ");
if (name == NULL) {
return GO_TOP;
}
name = strip(name);
if (strlen(name) == 0) {
return GO_TOP; // LCOV_EXCL_LINE
}
fp = fopen(strip(name), WRITE_MODE);
if (fp == NULL) {
printf("Can't open file %s, try again.\n", name);
}
free(name);
}
savefile(fp);
fclose(fp);
rspeak(RESUME_HELP);
exit(EXIT_SUCCESS);
}
int resume(void) {
/* Resume. Read a suspended game back from a file.
* If ADVENT_NOSAVE is defined, gripe instead. */
#if defined ADVENT_NOSAVE || defined ADVENT_AUTOSAVE
rspeak(SAVERESUME_DISABLED);
return GO_TOP;
#endif
FILE *fp = NULL;
if (game.loc != LOC_START || game.locs[LOC_START].abbrev != 1) {
rspeak(RESUME_ABANDON);
if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE],
arbitrary_messages[OK_MAN],
arbitrary_messages[OK_MAN])) {
return GO_CLEAROBJ;
}
}
while (fp == NULL) {
char *name = myreadline("\nFile name: ");
if (name == NULL) {
return GO_TOP;
}
name = strip(name);
if (strlen(name) == 0) {
return GO_TOP; // LCOV_EXCL_LINE
}
fp = fopen(name, READ_MODE);
if (fp == NULL) {
printf("Can't open file %s, try again.\n", name);
}
free(name);
}
return restore(fp);
}
int restore(FILE *fp) {
/* Read and restore game state from file, assuming
* sane initial state.
* If ADVENT_NOSAVE is defined, gripe instead. */
#ifdef ADVENT_NOSAVE
rspeak(SAVERESUME_DISABLED);
return GO_TOP;
#endif
IGNORE(fread(&save, sizeof(struct save_t), 1, fp));
fclose(fp);
if (memcmp(save.magic, ADVENT_MAGIC, sizeof(ADVENT_MAGIC)) != 0 ||
save.canary != ENDIAN_MAGIC) {
rspeak(BAD_SAVE);
} else if (save.version != SAVE_VERSION) {
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10),
SAVE_VERSION / 10, MOD(SAVE_VERSION, 10));
} else if (!is_valid(save.game)) {
rspeak(SAVE_TAMPERING);
exit(EXIT_SUCCESS);
} else {
game = save.game;
}
return GO_TOP;
}
bool is_valid(struct game_t valgame) {
/* Save files can be roughly grouped into three groups:
* With valid, reachable state, with valid, but unreachable
* state and with invalid state. We check that state is
* valid: no states are outside minimal or maximal value
*/
/* Prevent division by zero */
if (valgame.abbnum == 0) {
return false; // LCOV_EXCL_LINE
}
/* Check for RNG overflow. Truncate */
if (valgame.lcg_x >= LCG_M) {
return false;
}
/* Bounds check for locations */
if (valgame.chloc < -1 || valgame.chloc > NLOCATIONS ||
valgame.chloc2 < -1 || valgame.chloc2 > NLOCATIONS ||
valgame.loc < 0 || valgame.loc > NLOCATIONS || valgame.newloc < 0 ||
valgame.newloc > NLOCATIONS || valgame.oldloc < 0 ||
valgame.oldloc > NLOCATIONS || valgame.oldlc2 < 0 ||
valgame.oldlc2 > NLOCATIONS) {
return false; // LCOV_EXCL_LINE
}
/* Bounds check for location arrays */
for (int i = 0; i <= NDWARVES; i++) {
if (valgame.dwarves[i].loc < -1 ||
valgame.dwarves[i].loc > NLOCATIONS ||
valgame.dwarves[i].oldloc < -1 ||
valgame.dwarves[i].oldloc > NLOCATIONS) {
return false; // LCOV_EXCL_LINE
}
}
for (int i = 0; i <= NOBJECTS; i++) {
if (valgame.objects[i].place < -1 ||
valgame.objects[i].place > NLOCATIONS ||
valgame.objects[i].fixed < -1 ||
valgame.objects[i].fixed > NLOCATIONS) {
return false; // LCOV_EXCL_LINE
}
}
/* Bounds check for dwarves */
if (valgame.dtotal < 0 || valgame.dtotal > NDWARVES ||
valgame.dkill < 0 || valgame.dkill > NDWARVES) {
return false; // LCOV_EXCL_LINE
}
/* Validate that we didn't die too many times in save */
if (valgame.numdie >= NDEATHS) {
return false; // LCOV_EXCL_LINE
}
/* Recalculate tally, throw the towel if in disagreement */
int temp_tally = 0;
for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
if (objects[treasure].is_treasure) {
if (OBJECT_IS_NOTFOUND2(valgame, treasure)) {
++temp_tally;
}
}
}
if (temp_tally != valgame.tally) {
return false; // LCOV_EXCL_LINE
}
/* Check that properties of objects aren't beyond expected */
for (obj_t obj = 0; obj <= NOBJECTS; obj++) {
if (PROP_IS_INVALID(valgame.objects[obj].prop)) {
return false; // LCOV_EXCL_LINE
}
}
/* Check that values in linked lists for objects in locations are inside
* bounds */
for (loc_t loc = LOC_NOWHERE; loc <= NLOCATIONS; loc++) {
if (valgame.locs[loc].atloc < NO_OBJECT ||
valgame.locs[loc].atloc > NOBJECTS * 2) {
return false; // LCOV_EXCL_LINE
}
}
for (obj_t obj = 0; obj <= NOBJECTS * 2; obj++) {
if (valgame.link[obj] < NO_OBJECT ||
valgame.link[obj] > NOBJECTS * 2) {
return false; // LCOV_EXCL_LINE
}
}
return true;
}
/* end */

253
score.c
View file

@ -1,117 +1,162 @@
#include <stdlib.h>
#include "misc.h"
#include "main.h"
#include "share.h"
/*
* scoring and wrap-up
* Scoring and wrap-up.
*
* SPDX-FileCopyrightText: (C) 1977, 2005 by Will Crowther and Don Woods
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "advent.h"
#include "dungeon.h"
#include <stdlib.h>
void score(long MODE) {
/* <0 if scoring, >0 if quitting, =0 if died or won */
static int mxscor; /* ugh..the price for having score() not exit. */
/* The present scoring algorithm is as follows:
* Objective: Points: Present total possible:
* Getting well into cave 25 25
* Each treasure < chest 12 60
* Treasure chest itself 14 14
* Each treasure > chest 16 224
* Surviving (MAX-NUM)*10 30
* Not quitting 4 4
* Reaching "CLOSNG" 25 25
* "Closed": Quit/Killed 10
* Klutzed 25
* Wrong way 30
* Success 45 45
* Came to Witt's End 1 1
* Round out the total 2 2
* TOTAL: 430
* Points can also be deducted for using hints or too many turns, or for
* saving intermediate positions. */
int score(enum termination mode) {
/* mode is 'scoregame' if scoring, 'quitgame' if quitting, 'endgame' if
* died or won */
int score = 0;
SCORE=0;
MXSCOR=0;
/* The present scoring algorithm is as follows:
* Objective: Points: Present total possible:
* Getting well into cave 25 25
* Each treasure < chest 12 60
* Treasure chest itself 14 14
* Each treasure > chest 16 224
* Surviving (MAX-NUM)*10 30
* Not quitting 4 4
* Reaching "game.closng" 25 25
* "Closed": Quit/Killed 10
* Klutzed 25
* Wrong way 30
* Success 45 45
* Came to Witt's End 1 1
* Round out the total 2 2
* TOTAL: 430
* Points can also be deducted for using hints or too many turns, or
* for saving intermediate positions. */
/* First tally up the treasures. Must be in building and not broken.
* Give the poor guy 2 points just for finding each treasure. */
/* First tally up the treasures. Must be in building and not broken.
* Give the poor guy 2 points just for finding each treasure. */
mxscor = 0;
for (int i = 1; i <= NOBJECTS; i++) {
if (!objects[i].is_treasure) {
continue;
}
if (objects[i].inventory != 0) {
int k = 12;
if (i == CHEST) {
k = 14;
}
if (i > CHEST) {
k = 16;
}
if (!OBJECT_IS_STASHED(i) && !OBJECT_IS_NOTFOUND(i)) {
score += 2;
}
if (game.objects[i].place == LOC_BUILDING &&
OBJECT_IS_FOUND(i)) {
score += k - 2;
}
mxscor += k;
}
}
/* 20010 */ for (I=50; I<=MAXTRS; I++) {
if(PTEXT[I] == 0) goto L20010;
K=12;
if(I == CHEST)K=14;
if(I > CHEST)K=16;
if(PROP[I] >= 0)SCORE=SCORE+2;
if(PLACE[I] == 3 && PROP[I] == 0)SCORE=SCORE+K-2;
MXSCOR=MXSCOR+K;
L20010: /*etc*/ ;
} /* end loop */
/* Now look at how he finished and how far he got. NDEATHS and
* game.numdie tell us how well he survived. game.dflag will tell us
* if he ever got suitably deep into the cave. game.closng still
* indicates whether he reached the endgame. And if he got as far as
* "cave closed" (indicated by "game.closed"), then bonus is zero for
* mundane exits or 133, 134, 135 if he blew it (so to speak). */
score += (NDEATHS - game.numdie) * 10;
mxscor += NDEATHS * 10;
if (mode == endgame) {
score += 4;
}
mxscor += 4;
if (game.dflag != 0) {
score += 25;
}
mxscor += 25;
if (game.closng) {
score += 25;
}
mxscor += 25;
if (game.closed) {
if (game.bonus == none) {
score += 10;
}
if (game.bonus == splatter) {
score += 25;
}
if (game.bonus == defeat) {
score += 30;
}
if (game.bonus == victory) {
score += 45;
}
}
mxscor += 45;
/* Now look at how he finished and how far he got. MAXDIE and NUMDIE tell us
* how well he survived. DFLAG will
* tell us if he ever got suitably deep into the cave. CLOSNG still indicates
* whether he reached the endgame. And if he got as far as "cave closed"
* (indicated by "CLOSED"), then bonus is zero for mundane exits or 133, 134,
* 135 if he blew it (so to speak). */
/* Did he come to Witt's End as he should? */
if (game.objects[MAGAZINE].place == LOC_WITTSEND) {
score += 1;
}
mxscor += 1;
SCORE=SCORE+(MAXDIE-NUMDIE)*10;
MXSCOR=MXSCOR+MAXDIE*10;
if(MODE == 0)SCORE=SCORE+4;
MXSCOR=MXSCOR+4;
if(DFLAG != 0)SCORE=SCORE+25;
MXSCOR=MXSCOR+25;
if(CLOSNG)SCORE=SCORE+25;
MXSCOR=MXSCOR+25;
if(!CLOSED) goto L20020;
if(BONUS == 0)SCORE=SCORE+10;
if(BONUS == 135)SCORE=SCORE+25;
if(BONUS == 134)SCORE=SCORE+30;
if(BONUS == 133)SCORE=SCORE+45;
L20020: MXSCOR=MXSCOR+45;
/* Round it off. */
score += 2;
mxscor += 2;
/* Did he come to Witt's End as he should? */
/* Deduct for hints/turns/saves. Hints < 4 are special; see database
* desc. */
for (int i = 0; i < NHINTS; i++) {
if (game.hints[i].used) {
score = score - hints[i].penalty;
}
}
if (game.novice) {
score -= 5;
}
if (game.clshnt) {
score -= 10;
}
score = score - game.trnluz - game.saved;
if(PLACE[MAGZIN] == 108)SCORE=SCORE+1;
MXSCOR=MXSCOR+1;
/* Round it off. */
SCORE=SCORE+2;
MXSCOR=MXSCOR+2;
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
for (I=1; I<=HNTMAX; I++) {
if(HINTED[I])SCORE=SCORE-HINTS[I][2];
} /* end loop */
if(NOVICE)SCORE=SCORE-5;
if(CLSHNT)SCORE=SCORE-10;
SCORE=SCORE-TRNLUZ-SAVED;
/* Return to score command if that's where we came from. */
if(MODE < 0) return;
/* that should be good enough. Let's tell him all about it. */
if(SCORE+TRNLUZ+1 >= MXSCOR && TRNLUZ != 0)RSPEAK(242);
if(SCORE+SAVED+1 >= MXSCOR && SAVED != 0)RSPEAK(143);
SETPRM(1,SCORE,MXSCOR);
SETPRM(3,TURNS,TURNS);
RSPEAK(262);
for (I=1; I<=CLSSES; I++) {
if(CVAL[I] >= SCORE) goto L20210;
/*etc*/ ;
} /* end loop */
SPK=265;
goto L25000;
L20210: SPEAK(CTEXT[I]);
SPK=264;
if(I >= CLSSES) goto L25000;
I=CVAL[I]+1-SCORE;
SETPRM(1,I,I);
SPK=263;
L25000: RSPEAK(SPK);
exit(0);
/* Return to score command if that's where we came from. */
if (mode == scoregame) {
rspeak(GARNERED_POINTS, score, mxscor, game.turns, game.turns);
}
return score;
}
void terminate(enum termination mode) {
/* End of game. Let's tell him all about it. */
int points = score(mode);
#if defined ADVENT_AUTOSAVE
autosave();
#endif
if (points + game.trnluz + 1 >= mxscor && game.trnluz != 0) {
rspeak(TOOK_LONG);
}
if (points + game.saved + 1 >= mxscor && game.saved != 0) {
rspeak(WITHOUT_SUSPENDS);
}
rspeak(TOTAL_SCORE, points, mxscor, game.turns, game.turns);
for (int i = 1; i <= (int)NCLASSES; i++) {
if (classes[i].threshold >= points) {
speak(classes[i].message);
if (i < (int)NCLASSES) {
int nxt = classes[i].threshold + 1 - points;
rspeak(NEXT_HIGHER, nxt, nxt);
} else {
rspeak(NO_HIGHER);
}
exit(EXIT_SUCCESS);
}
}
rspeak(OFF_SCALE);
exit(EXIT_SUCCESS);
}
/* end */

24
share.h
View file

@ -1,24 +0,0 @@
extern void score(long);
extern long ABBNUM, ACTSPK[], AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
BIRD, BLOOD, BONUS,
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT, CLSMAX, CLSSES,
COINS, COND[], CONDS, CTEXT[], CVAL[], DALTLC, DETAIL,
DKILL, DOOR, DPRSSN, DRAGON, DSEEN[], DTOTAL, DWARF, EGGS,
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[], FOOBAR, FOOD,
GRATE, HINT, HINTED[], HINTLC[], HINTS[][5], HNTMAX,
HNTSIZ, I, INVENT, IGO, IWEST, J, JADE, K, K2, KEY[], KEYS, KK,
KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LINSIZ, LINUSE, LL,
LMWARN, LOC, LOCK, LOCSIZ, LOCSND[], LOOK, LTEXT[],
MAGZIN, MAXDIE, MAXTRS, MESH, MESSAG, MIRROR, MXSCOR,
NEWLOC, NOVICE, NUGGET, NUL, NUMDIE, OBJ, OBJSND[],
OBJTXT[], ODLOC[], OGRE, OIL, OLDLC2, OLDLOC, OLDOBJ, OYSTER,
PANIC, PEARL, PILLOW, PLAC[], PLANT, PLANT2, PROP[], PYRAM,
RESER, ROD, ROD2, RTXSIZ, RUBY, RUG, SAPPH, SAVED, SAY,
SCORE, SECT, SETUP, SIGN, SNAKE, SPK, STEPS, STEXT[], STICK,
STREAM, TABNDX, TALLY, THRESH, THROW, TK[], TRAVEL[], TRIDNT,
TRNDEX, TRNLUZ, TRNSIZ, TRNVAL[], TRNVLS, TROLL, TROLL2, TRVS,
TRVSIZ, TTEXT[], TURNS, URN, V1, V2, VASE, VEND, VERB,
VOLCAN, VRBSIZ, VRSION, WATER, WD1, WD1X, WD2, WD2X,
WZDARK, ZZWORD;

View file

@ -0,0 +1,87 @@
<--
SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
SPDX-License-Identifier: BSD-2-Clause
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Coverage - adventure.yaml</title>
<link rel="stylesheet" type="text/css" href="gcov.css">
<style>
.covered {{
text-align: center;
background-color: #A7FC9D;
}}
.covered::before {{
content: '\002714';
}}
.uncovered {{
text-align: center;
background-color: #FF0000;
}}
.uncovered::before {{
content: '\002715';
}}
</style>
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr>
<td class="title" colspan="2">adventure.yaml Coverage report</td>
</tr>
<tr>
<td class="ruler" colspan="2"><img src="glass.png" width=3 height=3 alt=""></td>
</tr>
<tr valign="top">
<td>
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Test:</a></td>
<td width="35%" class="headerValue">adventure.yaml</td>
<td width="65%"></td>
</tr>
<tr>
<td class="headerItem">Date:</a></td>
<td class="headerValue">2017-07-07 21:47:56</td>
<td></td>
</tr>
</table>
</td>
<td>
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="55%"></td>
<td width="15%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Covered</td>
<td width="15%" class="headerCovTableHead">% Coverage</td>
</tr>
{summary}
</table>
</td>
</tr>
<tr>
<td><img src="glass.png" width=3 height=3 alt=""></td>
</tr>
<tr>
<td class="ruler" colspan="2"><img src="glass.png" width=3 height=3 alt=""></td>
</tr>
</table>
<br>
<center>
<table width="60%" border=0 cellpadding=1 cellspacing=1>
{categories}
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr>
<td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td>
</tr>
<tr>
<td class="versionInfo">Generated by: <a href="https://gitlab.com/esr/open-adventure/blob/master/tests/coverage_dungeon.py">Open Adventure Dungeon Coverage Generator</a></td>
</tr>
</table>
<br>
</body>
</html>

59
templates/dungeon.c.tpl Normal file
View file

@ -0,0 +1,59 @@
/*
SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
SPDX-License-Identifier: BSD-2-Clause
*/
#include "{h_file}"
const char* arbitrary_messages[] = {{
{arbitrary_messages}
}};
const class_t classes[] = {{
{classes}
}};
const turn_threshold_t turn_thresholds[] = {{
{turn_thresholds}
}};
const location_t locations[] = {{
{locations}
}};
const object_t objects[] = {{
{objects}
}};
const obituary_t obituaries[] = {{
{obituaries}
}};
const hint_t hints[] = {{
{hints}
}};
long conditions[] = {{
{conditions}
}};
const motion_t motions[] = {{
{motions}
}};
const action_t actions[] = {{
{actions}
}};
const long tkey[] = {{{tkeys}}};
const travelop_t travel[] = {{
{travel}
}};
const char *ignore = "{ignore}";
/* Dwarf starting locations */
const int dwarflocs[NDWARVES] = {{{dwarflocs}}};
/* end */

167
templates/dungeon.h.tpl Normal file
View file

@ -0,0 +1,167 @@
/*
SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
SPDX-License-Identifier: BSD-2-Clause
*/
#ifndef DUNGEON_H
#define DUNGEON_H
#include <stdio.h>
#include <stdbool.h>
#define SILENT -1 /* no sound */
/* Symbols for cond bits */
#define COND_LIT 0 /* Light */
#define COND_OILY 1 /* If bit 2 is on: on for oil, off for water */
#define COND_FLUID 2 /* Liquid asset, see bit 1 */
#define COND_NOARRR 3 /* Pirate doesn't go here unless following */
#define COND_NOBACK 4 /* Cannot use "back" to move away */
#define COND_ABOVE 5 /* Aboveground, but not in forest */
#define COND_DEEP 6 /* Deep - e.g where dwarves are active */
#define COND_FOREST 7 /* In the forest */
#define COND_FORCED 8 /* Only one way in or out of here */
#define COND_ALLDIFFERENT 9 /* Room is in maze all different */
#define COND_ALLALIKE 10 /* Room is in maze all alike */
/* Bits past 11 indicate areas of interest to "hint" routines */
#define COND_HBASE 11 /* Base for location hint bits */
#define COND_HCAVE 12 /* Trying to get into cave */
#define COND_HBIRD 13 /* Trying to catch bird */
#define COND_HSNAKE 14 /* Trying to deal with snake */
#define COND_HMAZE 15 /* Lost in maze */
#define COND_HDARK 16 /* Pondering dark room */
#define COND_HWITT 17 /* At Witt's End */
#define COND_HCLIFF 18 /* Cliff with urn */
#define COND_HWOODS 19 /* Lost in forest */
#define COND_HOGRE 20 /* Trying to deal with ogre */
#define COND_HJADE 21 /* Found all treasures except jade */
#define NDWARVES {ndwarflocs} // number of dwarves
extern const int dwarflocs[NDWARVES];
typedef struct {{
const char** strs;
const int n;
}} string_group_t;
typedef struct {{
const string_group_t words;
const char* inventory;
int plac, fixd;
bool is_treasure;
const char** descriptions;
const char** sounds;
const char** texts;
const char** changes;
}} object_t;
typedef struct {{
const char* small;
const char* big;
}} descriptions_t;
typedef struct {{
descriptions_t description;
const long sound;
const bool loud;
}} location_t;
typedef struct {{
const char* query;
const char* yes_response;
}} obituary_t;
typedef struct {{
const int threshold;
const int point_loss;
const char* message;
}} turn_threshold_t;
typedef struct {{
const int threshold;
const char* message;
}} class_t;
typedef struct {{
const int number;
const int turns;
const int penalty;
const char* question;
const char* hint;
}} hint_t;
typedef struct {{
const string_group_t words;
}} motion_t;
typedef struct {{
const string_group_t words;
const char* message;
const bool noaction;
}} action_t;
enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}};
enum desttype_t {{dest_goto, dest_special, dest_speak}};
typedef struct {{
const long motion;
const long condtype;
const long condarg1;
const long condarg2;
const enum desttype_t desttype;
const long destval;
const bool nodwarves;
const bool stop;
}} travelop_t;
extern const location_t locations[];
extern const object_t objects[];
extern const char* arbitrary_messages[];
extern const class_t classes[];
extern const turn_threshold_t turn_thresholds[];
extern const obituary_t obituaries[];
extern const hint_t hints[];
extern long conditions[];
extern const motion_t motions[];
extern const action_t actions[];
extern const travelop_t travel[];
extern const long tkey[];
extern const char *ignore;
#define NLOCATIONS {num_locations}
#define NOBJECTS {num_objects}
#define NHINTS {num_hints}
#define NCLASSES {num_classes}
#define NDEATHS {num_deaths}
#define NTHRESHOLDS {num_thresholds}
#define NMOTIONS {num_motions}
#define NACTIONS {num_actions}
#define NTRAVEL {num_travel}
#define NKEYS {num_keys}
#define BIRD_ENDSTATE {bird_endstate}
enum arbitrary_messages_refs {{
{arbitrary_messages}
}};
enum locations_refs {{
{locations}
}};
enum object_refs {{
{objects}
}};
enum motion_refs {{
{motions}
}};
enum action_refs {{
{actions}
}};
/* State definitions */
{state_definitions}
#endif /* end DUNGEON_H */

177
tests/Makefile Normal file
View file

@ -0,0 +1,177 @@
# Test-suite makefile for open-adventure
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Use absolute path so tests that change working directory still use
# scripts from parent directory. Note that using $PWD seems to fail
# here under Gitlab's CI environment.
PARDIR=$(realpath ..)
PATH := $(PARDIR):$(realpath .):${PATH}
GCOV?=gcov
# Make this overrideable so it's easier to test old versions
advent?=advent
# Defeat annoying behavior under Mac OS X - builtin echo doesn't do -n
ECHO := /bin/echo
# The TAP filter. Only affects presentation of the test suite messages
TAPCONSUMER=tapview
# Fall back to safety if our declared TAP consumer does not exist.
# This is helpful in the CI environment, where it would be better for
# the logfiles to carry the raw TAP messages.
TAPFILTER=$(shell command -v $(TAPCONSUMER) || echo cat)
# Find all *.log entries to test
TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///' | sort)
.PHONY: check clean testlist listcheck savegames savecheck coverage
.PHONY: buildchecks multifile-regress tap count
check: savecheck
@make tap | tapview
@-advent -x 2>/dev/null || exit 0 # Get usage message into coverage tests
.SUFFIXES: .chk
clean:
rm -fr *~ *.adv scratch.tmp *.ochk advent430 adventure.data
# Show summary lines for all tests.
testlist:
@grep '^##' *.log
listcheck:
@for f in *.log; do \
if ( head -3 $$f | grep -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \
done
# Generate bogus savegames.
cheat_numdie.adv:
@$(PARDIR)/cheat -d -900 -o cheat_numdie.adv > /tmp/cheat_numdie
cheat_numdie1000.adv:
@$(PARDIR)/cheat -d -1000 -o cheat_numdie1000.adv > /tmp/cheat_numdie1000
cheat_savetamper.adv:
@$(PARDIR)/cheat -d 2000 -o cheat_savetamper.adv > /tmp/cheat_savetamper
resume_badversion.adv:
@$(PARDIR)/cheat -v -1337 -o resume_badversion.adv > /tmp/cheat_badversion
thousand_saves.adv:
@$(PARDIR)/cheat -s -1000 -o thousand_saves.adv > /tmp/cheat_1000saves
thousand_turns.adv:
@$(PARDIR)/cheat -t -1000 -o thousand_turns.adv > /tmp/cheat_1000turns
thousand_limit.adv:
@$(PARDIR)/cheat -l -1000 -o thousand_limit.adv > /tmp/cheat_1000limit
SGAMES = cheat_numdie.adv cheat_numdie1000.adv cheat_savetamper.adv resume_badversion.adv \
thousand_saves.adv thousand_turns.adv thousand_limit.adv
# Force coverage of cheat edgecases
scheck1:
@$(PARDIR)/cheat -QqQ 2> /tmp/coverage_cheat_batopt | true
@./outcheck.sh "cheat: bogus option for save file generation"
scheck2:
@$(PARDIR)/cheat 2>/dev/null | true
@./outcheck.sh "cheat: No save file specified"
scheck3:
@$(PARDIR)/cheat -d 1 2> /tmp/coverage_cheat_nooutput | true
@./outcheck.sh "cheat: doesn't save because we omit -o"
scheck4:
@$(PARDIR)/cheat -o / 2> /tmp/coverage_cheat_badoutput | true
@./outcheck.sh "cheat: doesn't save to invalid path"
scheck5:
@$(advent) -r /badfilename < pitfall.log > /tmp/coverage_advent_readfail 2>&1 || exit 1
@./outcheck.sh "cheat: doesn't start with invalid file with -r"
scheck6:
@$(advent) -l / < pitfall.log > /tmp/coverage_advent_logfail 2>&1 || exit 1
@./outcheck.sh "cheat: doesn't start with invalid file passed to -l"
scheck7:
@$(advent) -r thousand_saves.adv < pitfall.log > /tmp/coverage_advent_readfail 2>&1 || exit 1
@./outcheck.sh "test -r with valid input"
SCHECKS = scheck1 scheck2 scheck3 scheck4 scheck5 scheck6 scheck7
# Don't run this from here, you'll get cryptic warnings and no good result
# if the advent binary wasn't built with coverage flags. Do "make clean coverage"
# from the top-level directory.
coverage: check
lcov -t "advent" -o $(PARDIR)/advent.info -c -d $(PARDIR) --gcov-tool=$(GCOV)
genhtml -o $(PARDIR)/coverage/ $(PARDIR)/advent.info
./coverage_dungeon.py
# Rebuild characterizing tests
buildchecks: savegames
$(PARDIR)/cheat -s -1000 -o thousand_saves.adv > /tmp/regress1000saves
@for file in $(TESTLOADS); do \
echo "Remaking $${file}.chk"; \
OPTS=`sed -n /#options:/s///p <$${file}.log`; \
advent $$OPTS <$${file}.log >$${file}.chk 2>&1 || exit 1; \
done; \
echo "inven" | advent issue36.log /dev/stdin >multifile.chk; \
rm -f scratch.tmp
RUN_TARGETS=$(TESTLOADS:%=run-regress-%)
$(RUN_TARGETS): run-regress-%: %.log
@(test=$(<:.log=); legend=$$(sed -n '/^## /s///p' <"$<" 2>/dev/null || echo "(no description)"); \
OPTS=`sed -n /#options:/s///p $<`; \
$(advent) $$OPTS <$< | tapdiffer "$${test}: $${legend}" "$${test}.chk")
multifile-regress:
@(echo "inven" | advent issue36.log /dev/stdin) | tapdiffer "multifile: multiple-file test" multifile.chk
TEST_TARGETS = $(SCHECKS) $(RUN_TARGETS) multifile-regress
tap: count $(SGAMES) $(TEST_TARGETS)
@rm -f scratch.tmp /tmp/coverage* /tmp/cheat*
count:
@echo 1..$(words $(TEST_TARGETS))
# The following machinery tests the game against a binary made from
# the advent430 branch To use it, switch to that branch, build the
# binary, run it once to generate adventure.data, then switch back to
# master leaving advent430 and adventure.data in place (make clean
# does not remove them).
#
# make clean # Clean up object files, laving a bare source tree
# git checkout advent430 # Check out the advent430 branch
# make # Build the advent430 binary
# advent430 # Run it. Answer the novice question and quit
# make clean # Remove .o files
# git checkout master # Go back to master branch
# make # Rebuild advent.
#
# The diff file produced has corrected spellings in it. That's what oldfilter
# is for, to massage out the original spellings and avoid noise diffs.
# Diffs in amount of whitespace and trailing whitespace are ignored
#
# A magic comment of NOCOMPARE in a log file excludes it from this comparison.
# making it a skipped test in the TAP view. First use of this was to avoid a
# spurious mismatch on the news text. Other uses avoid spurious mismatches due
# to bug fixes.
#
# When adding more tests, bear in mind that any game that continues after a
# resurrection will need a NOCOMPARE. At some point in the forward port,
# resurrection was accidentally changed in a way that messed with the LCG chain.
#
# The *.chk files need not be up-to-date for this to work.
#
TAPFILTER=tapview
oldcompare:
@if [ -f ../advent430 ]; then cp ../advent430 ../adventure.data .; else echo "advent430 nonexistent"; exit 1; fi
@-(for x in *.log; do \
stem=$${x%.log}; \
legend=$$(sed -n '/^## /s///p' <$$x 2>/dev/null || echo "(no description)"); \
if grep NOCOMPARE $$x >/dev/null; \
then echo "not ok - $${stem}.ochk: $${legend} # SKIP"; \
else \
./advent430 <$${stem}.log | oldfilter >$${stem}.ochk; \
../advent <$${stem}.log >$${stem}.log-new; \
./newfilter <$${stem}.log-new | tapdiffer -b "$${stem}: $${legend}" $${stem}.ochk; \
fi; \
done; \
echo 1..$(words $(shell ls *.log))) | $(TAPFILTER)
@rm *.ochk *-new advent430 adventure.data
# List all NOCOMPARE tests.
residuals:
@grep -n NOCOMPARE *.log
# end

36
tests/README Normal file
View file

@ -0,0 +1,36 @@
= Notes on the test machinery =
== Understanding and running tests ==
A .log 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 the game log
foo.log. To add new tests, just drop log files in this directory.
To see summary lines from all tests, 'make testlist'. The summary lines
are those led with ##; you should have one such descriptive line at the
head of each file.
To run the tests, "make check".
To remake the check files, "make buildchecks".
== Composing tests ==
The simplest way to make a test is to simply play a game with the -l
option giving a log path. Commands will be captured to that log.
To re-use a command sequence from an existing log, run advent and
paste it to the advent command log from the clipboard.
To see where we can use more tests, "make coverage".
// end

1639
tests/axebear.chk Normal file

File diff suppressed because it is too large Load diff

278
tests/axebear.log Normal file
View file

@ -0,0 +1,278 @@
## Observe axe after throwing at bear
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
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
eat plant
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
eat 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
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
throw axe
look

660
tests/axeorama.chk Normal file
View file

@ -0,0 +1,660 @@
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 1838473132
Seed set to 1838473132
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> drop rod
OK
> cage bird
OK
> take rod
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> free bird
OK
> wave rod
The bird flies about agitatedly for a moment, then disappears through
the crack. It reappears shortly, carrying in its beak a jade
necklace, which it drops at your feet.
> take necklace
OK
> drop rod
OK
> cage bird
OK
> take rod
OK
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> drop rod
OK
> drop cage
OK
> take cage
OK
> cage bird
OK
> take rod
OK
> w
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> e
You're in Hall of Mt King.
> s
You are in the south side chamber.
There is precious jewelry here!
> take jewelry
OK
> n
You're in Hall of Mt King.
> up
You're in Hall of Mists.
Rough stone steps lead up the dome.
> s
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
There is a large sparkling nugget of gold here!
> take gold
OK
> n
You're in Hall of Mists.
> d
You're in Hall of Mt King.
> n
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
There are bars of silver here!
> n
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
A hollow voice says "PLUGH".
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> extinguish lamp
Your lamp is now off.
> drop coins
I see no coins here.
> drop jewelry
OK
> drop necklace
OK
> drop gold
OK
> plugh
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're at "Y2".
> s
You're in n/s passage above e/w passage.
There are bars of silver here!
> take silver
OK
> s
You're in Hall of Mt King.
> sw
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You are in a secret canyon which here runs e/w. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able
to get back up.
There is a little axe here.
> take axe
OK
> w
You are in a secret canyon which exits to the north and east.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> throw axe
The axe bounces harmlessly off the dragon's thick scales.
You are in a secret canyon which exits to the north and east.
There is a little axe here.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> take axe
OK
> kill dragon
With what? Your bare hands?
> y
Congratulations! You have just vanquished a dragon with your bare
hands! (Unbelievable, isn't it?)
You are in a secret canyon which exits to the north and east.
There is a Persian rug spread out on the floor!
The blood-specked body of a huge green dead dragon lies to one side.
> inven
You are currently holding the following:
Brass lantern
Wicker cage
Black rod
Little bird in cage
Dwarf's axe
Bars of silver
> e
You're in secret e/w canyon above tight canyon.
> e
You are in the Hall of the Mountain King, with passages off in all
directions.
> u
You're in Hall of Mists.
Rough stone steps lead up the dome.
> w
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> wave rod
The bird flies agitatedly about the cage.
A crystal bridge now spans the fissure.
> w
You are on the west side of the fissure in the Hall of Mists.
There are diamonds here!
A crystal bridge spans the fissure.
> w
You are at the west end of the Hall of Mists. A low wide crawl
continues west and another goes north. To the south is a little
passage 6 feet off the floor.
> w
You are at the east end of a very long hall apparently without side
chambers. To the east a low wide crawl slants up. To the north a
round two foot hole slants down.
> w
You are at the west end of a very long featureless hall. The hall
joins up with a narrow north/south passage.
> s
You are in a maze of twisty little passages, all different.
> sw
You are in a little maze of twisty passages, all different.
> se
You are in a little maze of twisting passages, all different.
> s
Dead end
There is a massive and somewhat battered vending machine here. The
instructions on it read: "Drop coins here to receive fresh batteries."
> throw axe
There is nothing here to attack.
> kill machine
As you strike the vending machine, it pivots backward along with a
section of wall, revealing a dark passage leading south.
> s
You are in a long, rough-hewn, north/south corridor.
> s
You are in a large chamber with passages to the west and north.
A formidable ogre bars the northern exit.
> throw axe
The ogre, who despite his bulk is quite agile, easily dodges your
attack. He seems almost amused by your puny effort.
You are in a large chamber with passages to the west and north.
There is a little axe here.
A formidable ogre bars the northern exit.
> take axe
OK
> w
You are in a long, rough-hewn, north/south corridor.
> n
Dead end
There is a massive vending machine here, swung back to reveal a
southward passage.
> n
You are in a little maze of twisting passages, all different.
> n
You are in a little maze of twisty passages, all different.
> nw
You are in a maze of twisty little passages, all different.
> d
You're at west end of long hall.
> e
You're at east end of long hall.
> e
You're at west end of Hall of Mists.
> e
You're on west bank of fissure.
There are diamonds here!
A crystal bridge spans the fissure.
> e
You're on east bank of fissure.
A crystal bridge spans the fissure.
> e
You're in Hall of Mists.
Rough stone steps lead up the dome.
> n
You're in Hall of Mt King.
> n
There is a threatening little dwarf in the room with you!
One sharp nasty knife is thrown at you!
It misses!
You're in n/s passage above e/w passage.
> take knife
The dwarves' knives vanish as they strike the walls of the cave.
> throw axe
You killed a little dwarf. The body vanishes in a cloud of greasy
black smoke.
You're in n/s passage above e/w passage.
There is a little axe here.
> take axe
OK
> d
You are in a dirty broken passage. To the east is a crawl. To the
west is a large passage. Above you is a hole to another passage.
> w
You are in a large room full of dusty rocks. There is a big hole in
the floor. There are cracks everywhere, and a passage leading east.
> d
You are at a complex junction. A low hands and knees passage from the
north joins a higher crawl from the east to make a walking passage
going west. There is also a large room above. The air is damp here.
> w
You are in Bedquilt, a long east/west passage with holes everywhere.
To explore at random select north, south, up, or down.
> n
You have crawled around in some little holes and wound up back in the
main passage.
There is a threatening little dwarf in the room with you!
You're in Bedquilt.
> feed dwarf
There is nothing here to eat.
> throw axe
You killed a little dwarf.
You're in Bedquilt.
There is a little axe here.
> take axe
OK
> n
You have crawled around in some little holes and wound up back in the
main passage.
You're in Bedquilt.
> n
You are in a large low room. Crawls lead north, se, and sw.
> n
Dead end crawl.
> out
You're in large low room.
> sw
You are in a long winding corridor sloping out of sight in both
directions.
> up
You are on one side of a large, deep chasm. A heavy white mist rising
up from below obscures all view of the far side. A sw path leads away
from the chasm into a winding corridor.
A rickety wooden bridge extends across the chasm, vanishing into the
mist. A notice posted on the bridge reads, "Stop! Pay troll!"
A burly troll stands by the bridge and insists you throw him a
treasure before you may cross.
> throw axe
The troll deftly catches the axe, examines it carefully, and tosses it
back, declaring, "Good workmanship, but it's not valuable enough."
You're on sw side of chasm.
There is a little axe here.
A rickety wooden bridge extends across the chasm, vanishing into the
mist. A notice posted on the bridge reads, "Stop! Pay troll!"
A burly troll stands by the bridge and insists you throw him a
treasure before you may cross.
> jump
I respectfully suggest you go across the bridge instead of jumping.
You're on sw side of chasm.
There is a little axe here.
A rickety wooden bridge extends across the chasm, vanishing into the
mist. A notice posted on the bridge reads, "Stop! Pay troll!"
A burly troll stands by the bridge and insists you throw him a
treasure before you may cross.
>
You scored 105 out of a possible 430, using 109 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 16 more points.

122
tests/axeorama.log Normal file
View file

@ -0,0 +1,122 @@
## Test throwing axe at non-dwarves.
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Added coverage of LOC_DEADCRAWL and CROSS_BRIDGE
n
seed 1838473132
in
take lamp
xyzzy
on
take rod
e
take cage
w
w
w
drop rod
cage bird
take rod
w
free bird
wave rod
take necklace
drop rod
cage bird
take rod
d
d
free bird
drop rod
drop cage
take cage
cage bird
take rod
w
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
throw axe
take axe
kill dragon
y
inven
e
e
u
# Go to vending machine and ogre from Hall of Mists
w
wave rod
w
w
w
w
s
sw
se
s
throw axe
kill machine
s
s
throw axe
take axe
# Return to Hall of Mists
w
n
n
n
# Vending machine
nw
d
e
e
e
e
e
# Hall of Mists
n
n
take knife
throw axe
take axe
d
w
d
w
# Bedquilt
n
feed dwarf
throw axe
take axe
n
n
n
out
sw
up
# Troll bridge
throw axe
jump

22
tests/badmagic.chk Normal file
View file

@ -0,0 +1,22 @@
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
Can't open file y, try again.
Oops, that does not look like a valid save file.
You're in front of building.
>
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.

8
tests/badmagic.log Normal file
View file

@ -0,0 +1,8 @@
## Resume from filename withoy the right magic at the front
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
#NOCOMPARE advent430 doesn't have this test
n
resume
y
../main.o

315
tests/barehands.chk Normal file
View file

@ -0,0 +1,315 @@
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 1635997320
Seed set to 1635997320
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> take rod
OK
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> drop rod
OK
> take bird
OK
> take rod
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> free bird
OK
> wave rod
The bird flies about agitatedly for a moment, then disappears through
the crack. It reappears shortly, carrying in its beak a jade
necklace, which it drops at your feet.
> drop rod
OK
> take bird
OK
> take jade
OK
> e
You're in bird chamber.
> e
You are in an awkward sloping east/west canyon.
> e
You're in debris room.
> off
Your lamp is now off.
It is now pitch dark. If you proceed you will likely fall into a pit.
> xyzzy
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> drop jade
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're in debris room.
> w
You are in an awkward sloping east/west canyon.
> w
You're in bird chamber.
> w
You're at top of small pit.
A three foot black rod with a rusty star on an end lies nearby.
Rough stone steps lead down the pit.
> take rod
OK
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> w
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> wave rod
The bird flies agitatedly about the cage.
A crystal bridge now spans the fissure.
> drop rod
OK
> e
You're in Hall of Mists.
Rough stone steps lead up the dome.
> n
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> take bird
OK
> s
You are in the south side chamber.
There is precious jewelry here!
> take jewelry
OK
> n
You're in Hall of Mt King.
> sw
You are in a secret canyon which here runs e/w. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able
to get back up.
> w
You are in a secret canyon which exits to the north and east.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> drop bird
The little bird attacks the green dragon, and in an astounding flurry
gets burnt to a cinder. The ashes blow away.
> extinguish dragon
It is beyond your power to do that.
> kill dragon
With what? Your bare hands?
>
Please answer the question.
> green
Please answer the question.
> n
The dragon looks rather nasty. You'd best not try to get by.
You are in a secret canyon which exits to the north and east.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> kill dragon
With what? Your bare hands?
> y
Congratulations! You have just vanquished a dragon with your bare
hands! (Unbelievable, isn't it?)
You are in a secret canyon which exits to the north and east.
There is a Persian rug spread out on the floor!
The blood-specked body of a huge green dead dragon lies to one side.
> kill dragon
For crying out loud, the poor thing is already dead!
>
You scored 77 out of a possible 430, using 49 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 44 more points.

60
tests/barehands.log Normal file
View file

@ -0,0 +1,60 @@
## Get to dragon, refuse to use bare hands
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
#NOCOMPARE Fails due uninteresting difference in whitespace process.
# Based on walkthrough at http://www.ecsoftwareconsulting.com/node/56
n
seed 1635997320
in
take lamp
xyzzy
take rod
e
take cage
w
on
w
w
drop rod
take bird
take rod
w
free bird
wave rod
drop rod
take bird
take jade
e
e
e
off
xyzzy
drop jade
xyzzy
on
w
w
w
take rod
d
w
wave rod
drop rod
e
n
free bird
take bird
s
take jewelry
n
sw
w
drop bird
extinguish dragon
kill dragon
green
n
kill dragon
y
kill dragon

1811
tests/bigfail.chk Normal file

File diff suppressed because it is too large Load diff

316
tests/bigfail.log Normal file
View file

@ -0,0 +1,316 @@
## Test many nonlethal failure conditions
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# See comments in this log
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
# Test vase breakage
break vase
break vase
se
throw axe
take axe
e
w
ne
e
n
# Here we are at the Shell Room. Fail to carry out bivalves
take clam
unlock clam
s
open clam
drop clam
open clam
read oyster
take oyster
s
drop oyster
s
# OK, bivalve-carry test is done
u
e
u
n
off
plugh
drop pillow
drop trident
drop emerald
drop ebony
take keys
take food
take coins
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
# Bear-verb test. Try feeding without food before feeding with
barren
drop food
in
attack
unlock chain
feed bear
out
take food
in
feed bear
carry bear
unlock chain
take chain
attack bear
feed bear
take bear
fork
ne
e
take spices
drop keys
fork
w
w
sw
free bear
take bear
sw
n
quit

2948
tests/birdsnakewake.chk Normal file

File diff suppressed because it is too large Load diff

477
tests/birdsnakewake.log Normal file
View file

@ -0,0 +1,477 @@
## Attempt to kill snake with bird in the endgame
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
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
# The score commands verify that you do indeed score points
# for dropping the vase on the pillow in the building.
score
drop pillow
drop vase
score
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
sw
listen
take cage
take bird
free bird

464
tests/birdweight.chk Normal file
View file

@ -0,0 +1,464 @@
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 976729036
Seed set to 976729036
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.
> take lamp
OK
> take food
OK
> take bottle
OK
> inventory
You are currently holding the following:
Brass lantern
Tasty food
Small bottle
Water in the bottle
> out
You're in front of building.
> s
You are in a valley in the forest beside a stream tumbling along a
rocky bed.
> w
You are wandering aimlessly through the forest.
> n
You are wandering aimlessly through the forest.
Your keen eye spots a severed leporine appendage lying on the ground.
> take appendage
OK
> s
You are wandering aimlessly through the forest.
> s
You're in valley.
> n
You're in front of building.
> in
You're inside building.
There are some keys on the ground here.
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> take bird
OK
> e
You are in an awkward sloping east/west canyon.
> e
You're in debris room.
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> w
You are in an awkward sloping east/west canyon.
> w
You're in bird chamber.
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> inventory
You are currently holding the following:
Brass lantern
Wicker cage
Black rod
Little bird in cage
Tasty food
Small bottle
Water in the bottle
Leporine appendage
> w
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> wave rod
The bird flies agitatedly about the cage.
A crystal bridge now spans the fissure.
> drop rod
OK
> e
You're in Hall of Mists.
Rough stone steps lead up the dome.
> s
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
There is a large sparkling nugget of gold here!
> take gold
OK
> n
You're in Hall of Mists.
> w
You're on east bank of fissure.
A three foot black rod with a rusty star on an end lies nearby.
A crystal bridge spans the fissure.
> w
You are on the west side of the fissure in the Hall of Mists.
There are diamonds here!
A crystal bridge spans the fissure.
> drop gold
OK
> take diamonds
OK
> w
You are at the west end of the Hall of Mists. A low wide crawl
continues west and another goes north. To the south is a little
passage 6 feet off the floor.
> w
You are at the east end of a very long hall apparently without side
chambers. To the east a low wide crawl slants up. To the north a
round two foot hole slants down.
> w
You are at the west end of a very long featureless hall. The hall
joins up with a narrow north/south passage.
> inventory
You are currently holding the following:
Brass lantern
Wicker cage
Little bird in cage
Tasty food
Small bottle
Water in the bottle
Leporine appendage
Several diamonds
> s
You are in a maze of twisty little passages, all different.
> sw
You are in a little maze of twisty passages, all different.
> se
You are in a little maze of twisting passages, all different.
> s
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
Dead end
There is a little axe here.
There is a massive and somewhat battered vending machine here. The
instructions on it read: "Drop coins here to receive fresh batteries."
> drop food
OK
> drop water
OK
> take axe
OK
> kill machine
As you strike the vending machine, it pivots backward along with a
section of wall, revealing a dark passage leading south.
> s
You are in a long, rough-hewn, north/south corridor.
> s
You are in a large chamber with passages to the west and north.
A formidable ogre bars the northern exit.
> drop diamonds
OK
> w
You are in a long, rough-hewn, north/south corridor.
> w
There is no way to go that direction.
You are in a long, rough-hewn, north/south corridor.
> n
Dead end
There is a bottle of water here.
There is food here.
There is a massive vending machine here, swung back to reveal a
southward passage.
> n
You are in a little maze of twisting passages, all different.
> n
You are in a little maze of twisty passages, all different.
> nw
You are in a maze of twisty little passages, all different.
> d
You're at west end of long hall.
> e
You're at east end of long hall.
> e
You're at west end of Hall of Mists.
> e
You're on west bank of fissure.
There is a large sparkling nugget of gold here!
A crystal bridge spans the fissure.
> take gold
OK
> w
You're at west end of Hall of Mists.
> w
You're at east end of long hall.
> w
You're at west end of long hall.
> s
You are in a maze of twisty little passages, all different.
> sw
You are in a little maze of twisty passages, all different.
> se
You are in a little maze of twisting passages, all different.
> s
Dead end
There is a bottle of water here.
There is food here.
There is a massive vending machine here, swung back to reveal a
southward passage.
> take bottle
OK
> take food
OK
> s
You are in a long, rough-hewn, north/south corridor.
> s
You are in a large chamber with passages to the west and north.
There are diamonds here!
A formidable ogre bars the northern exit.
> throw appendage
OK
> kill ogre
The ogre, who despite his bulk is quite agile, easily dodges your
attack. He seems almost amused by your puny effort.
> take appendage
OK
>
You scored 61 out of a possible 430, using 81 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 60 more points.

90
tests/birdweight.log Normal file
View file

@ -0,0 +1,90 @@
## Verify that the bird is weightless in inventory
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Checks fix for GitLab issue #40
#NOCOMPARE Bird was not weightless in cage in advent430 so this test is invalid.
n
#seed 687800971
seed 976729036
in
take lamp
take food
take bottle
inventory
out
s
w
n
take appendage
s
s
n
in
xyzzy
on
e
take cage
w
w
w
take bird
e
e
take rod
w
w
w
d
inventory
w
wave rod
drop rod
e
s
take gold
n
w
w
drop gold
take diamonds
w
w
w
inventory
s
sw
se
s
drop food
drop water
take axe
kill machine
s
s
drop diamonds
w
w
n
# Back at vending machine
n
n
nw
d
e
e
e
take gold
w
w
w
s
sw
se
s
take bottle
take food
s
s
throw appendage
kill ogre
take appendage

1487
tests/boulder2.chk Normal file

File diff suppressed because it is too large Load diff

244
tests/boulder2.log Normal file
View file

@ -0,0 +1,244 @@
## Coverage of LOC_BOULDERS2.short
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
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
drop rod
take bird
take rod
d
d
free bird
w
e
s
take n
u
s
n
d
n
n
plugh
extin
plugh
on
s
s
sw
take
w
kill drago
y
take rug
e
e
u
d
n
n
off
plugh
drop rug
out
s
w
n
take appen
drop cage
s
s
n
in
take water
plugh
on
plove
ne
s
plove
s
s
u
w
wave rod
drop rod
west
w
w
w
s
sw
se
s
kill machi
s
s
kill ogre
n
s
w
n
n
n
nw
d
e
e
e
e
e
throw axe
take axe
n
n
n
off
plugh
plugh
on
s
s
u
n
n
d
bedqu
throw axe
take
slab
s
d
water plant
u
w
u
reser
H'CFL
n
n
nw
u
u
u
u
ne
sw
d
d
d
d
d
take water
s
s
s
s
d
s
d
water plant
u
drop appen
e
d
get oil
u
w
d
climb
w
n
oil door
drop bottl
n
take tride
w
d
se
n
w
drop tride
drop axe
drop lante
e
take emera
w
take lamp
take axe
take tride
nw
s
se
throw axe
e
w
ne
e
n
open clam
s
u
e
u
n
off
plugh
drop tride
take key
take food
plugh
on
s
d
w
d
n
d
d
u
u
s
w
w
w
w
d
climb
w
get
n
take bottl
n
w
d
sw
u
toss egg
ne
barre
in
feed bear
unloc
take bear
fork
ne
e
out
e

2993
tests/breakmirror.chk Normal file

File diff suppressed because it is too large Load diff

488
tests/breakmirror.log Normal file
View file

@ -0,0 +1,488 @@
## Break the mirror in endgame and die
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
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
break mirror
s
d
s
d
water plant
u
drop appendage
e
d
get oil
u
w
d
climb
w
n
unlock
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
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
cave
e
# Everything to here is from endgame428,
# except we drop the oyster before trying
# to unlock it rather than after.
attack
take oyster
find oyster
lock
lock oyster
drop oyster
unlock oyster
take oyster
read oyster
y
sw
attack bird
find bird
break mirror

79
tests/carrybird.chk Normal file
View file

@ -0,0 +1,79 @@
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 1071883378
Seed set to 1071883378
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.
> take lamp
OK
> rub lamp
Rubbing the electric lamp is not particularly rewarding. Anyway,
nothing exciting happens.
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> take bird
You can catch the bird, but you cannot carry it.
> attack
The little bird is now dead. Its body disappears.
>
You scored 32 out of a possible 430, using 9 turns.
You are obviously a rank amateur. Better luck next time.
To achieve the next higher rating, you need 14 more points.

15
tests/carrybird.log Normal file
View file

@ -0,0 +1,15 @@
## Try to carry bird without cage, then kill bird
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1071883378
in
take lamp
rub lamp
xyzzy
on
w
w
take bird
# test intransitive attack on bird
attack

335
tests/carryfreebird.chk Normal file
View file

@ -0,0 +1,335 @@
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 1495951709
Seed set to 1495951709
You're in front of building.
> attack
There is nothing here to attack.
> 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.
> take lamp
OK
> on
Your lamp is now on.
> xyzzy
>>Foof!<<
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> drop rod
OK
> take bird
OK
> take rod
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> free bird
OK
> wave rod
The bird flies about agitatedly for a moment, then disappears through
the crack. It reappears shortly, carrying in its beak a jade
necklace, which it drops at your feet.
> take jade
OK
> drop rod
OK
> take bird
OK
> take rod
OK
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> w
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> wave rod
The bird flies agitatedly about the cage.
A crystal bridge now spans the fissure.
> drop rod
OK
> e
You're in Hall of Mists.
Rough stone steps lead up the dome.
> n
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> take bird
OK
> s
You are in the south side chamber.
There is precious jewelry here!
> take jewelry
OK
> n
You're in Hall of Mt King.
> sw
You are in a secret canyon which here runs e/w. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able
to get back up.
> w
You are in a secret canyon which exits to the north and east.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> kill dragon
With what? Your bare hands?
> yes
Congratulations! You have just vanquished a dragon with your bare
hands! (Unbelievable, isn't it?)
You are in a secret canyon which exits to the north and east.
There is a Persian rug spread out on the floor!
The blood-specked body of a huge green dead dragon lies to one side.
> drink blood
Your head buzzes strangely for a moment.
> take rug
OK
> e
You're in secret e/w canyon above tight canyon.
> e
You're in Hall of Mt King.
> n
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
There are bars of silver here!
> take silver
OK
> n
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> drop silver
OK
> drop jewelry
OK
> drop jade
OK
> drop rug
OK
> out
You're in front of building.
> s
You are in a valley in the forest beside a stream tumbling along a
rocky bed.
> w
You are wandering aimlessly through the forest.
> n
You are wandering aimlessly through the forest.
Your keen eye spots a severed leporine appendage lying on the ground.
> take appendage
OK
> drop cage
OK
> look
Sorry, but I am not allowed to give more detail. I will repeat the
long description of your location.
You are wandering aimlessly through the forest.
There is a small wicker cage discarded nearby.
There is a little bird in the cage.
> take cage
OK
> free bird
OK
> carry bird
The bird eyes you suspiciously and flutters away. A moment later you
feel something wet land on your head, but upon looking up you can see
no sign of the culprit.
>
You scored 113 out of a possible 430, using 57 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 8 more points.

63
tests/carryfreebird.log Normal file
View file

@ -0,0 +1,63 @@
## Try to carry the bird after freeing it instead of listening
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1495951709
attack
in
take lamp
on
xyzzy
take rod
e
take cage
w
w
w
drop rod
take bird
take rod
w
free bird
wave rod
take jade
drop rod
take bird
take rod
d
w
wave rod
drop rod
e
n
free bird
take bird
s
take jewelry
n
sw
w
kill dragon
yes
drink blood
take rug
e
e
n
take silver
n
plugh
drop silver
drop jewelry
drop jade
drop rug
out
s
w
n
take appendage
drop cage
look
take cage
free bird
carry bird

27
tests/cheatresume.chk Normal file
View file

@ -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
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.
>
Now let's see you do it without suspending in mid-Adventure.
You scored 9031 out of a possible 430, using 0 turns.
Adventuredom stands in awe -- you have now joined the ranks of the
W O R L D C H A M P I O N A D V E N T U R E R S !
It may interest you to know that the Dungeon-Master himself has, to
my knowledge, never achieved this threshold in fewer than 330 turns.
To achieve the next higher rating would be a neat trick!
Congratulations!!

7
tests/cheatresume.log Normal file
View file

@ -0,0 +1,7 @@
## Resume from absurd save file with numdie = -900
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
#NOCOMPARE Can't compare to advent430 due to version skew
n
resume
cheat_numdie.adv

21
tests/cheatresume2.chk Normal file
View file

@ -0,0 +1,21 @@
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
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.
>
Now let's see you do it without suspending in mid-Adventure.
You scored 10031 out of a possible 430, using 0 turns.
You just went off my scale!!

8
tests/cheatresume2.log Normal file
View file

@ -0,0 +1,8 @@
## Resume from absurd save file with numdie = -1000
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# generating "off my scale" score threshold message
#NOCOMPARE Can't compare to advent430 due to version skew
n
resume
cheat_numdie1000.adv

4
tests/compare Executable file
View file

@ -0,0 +1,4 @@
#! /bin/sh
# Display diff for an individual test
test=$1
../advent <${test}.log | ./tapdiffer "${test}" "${test}.chk"

307
tests/coverage_dungeon.py Executable file
View file

@ -0,0 +1,307 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
"""
This is the open-adventure dungeon text coverage report generator. It
consumes a YAML description of the dungeon and determines whether the
various strings contained are present within the test check files.
The default HTML output is appropriate for use with Gitlab CI.
You can override it with a command-line argument.
The DANGLING lists are for actions and messages that should be
considered always found even if the checkfile search doesn't find them.
Typically this will because an action emit a templated message that
can't be regression-tested by equality.
"""
# pylint: disable=consider-using-f-string,line-too-long,invalid-name,missing-function-docstring,redefined-outer-name
import os
import sys
import re
import yaml
TEST_DIR = "."
YAML_PATH = "../adventure.yaml"
HTML_TEMPLATE_PATH = "../templates/coverage_dungeon.html.tpl"
DEFAULT_HTML_OUTPUT_PATH = "../coverage/adventure.yaml.html"
DANGLING_ACTIONS = ["ACT_VERSION"]
DANGLING_MESSAGES = ["SAVERESUME_DISABLED"]
STDOUT_REPORT_CATEGORY = (
" {name:.<19}: {percent:5.1f}% covered ({covered} of {total})\n"
)
HTML_SUMMARY_ROW = """
<tr>
<td class="headerItem"><a href="#{name}">{name}:</a></td>
<td class="headerCovTableEntry">{total}</td>
<td class="headerCovTableEntry">{covered}</td>
<td class="headerCovTableEntry">{percent:.1f}%</td>
</tr>
"""
HTML_CATEGORY_SECTION = """
<tr id="{id}"></tr>
{rows}
<tr>
<td>&nbsp;</td>
</tr>
"""
HTML_CATEGORY_HEADER = """
<tr>
<td class="tableHead" width="60%" colspan="{colspan}">{label}</td>
{cells}
</tr>
"""
HTML_CATEGORY_HEADER_CELL = '<td class="tableHead" width="15%">{}</td>\n'
HTML_CATEGORY_COVERAGE_CELL = '<td class="{}">&nbsp;</td>\n'
HTML_CATEGORY_ROW = """
<tr>
<td class="coverFile" colspan="{colspan}">{id}</td>
{cells}
</tr>
"""
def search(needle, haystack):
# Search for needle in haystack, first escaping needle for regex, then
# replacing %s, %d, etc. with regex wildcards, so the variable messages
# within the dungeon definition will actually match
if needle is None or needle == "" or needle == "NO_MESSAGE":
# if needle is empty, assume we're going to find an empty string
return True
needle_san = (
re.escape(needle)
.replace("\\n", "\n")
.replace("\\t", "\t")
.replace("%S", ".*")
.replace("%s", ".*")
.replace("%d", ".*")
.replace("%V", ".*")
)
return re.search(needle_san, haystack)
def obj_coverage(objects, text, report):
# objects have multiple descriptions based on state
for _, objouter in enumerate(objects):
(obj_name, obj) = objouter
if obj["descriptions"]:
for j, desc in enumerate(obj["descriptions"]):
name = "{}[{}]".format(obj_name, j)
if name not in report["messages"]:
report["messages"][name] = {"covered": False}
report["total"] += 1
if not report["messages"][name]["covered"] and search(desc, text):
report["messages"][name]["covered"] = True
report["covered"] += 1
def loc_coverage(locations, text, report):
# locations have a long and a short description, that each have to
# be checked separately
for name, loc in locations:
desc = loc["description"]
if name not in report["messages"]:
report["messages"][name] = {"long": False, "short": False}
report["total"] += 2
if not report["messages"][name]["long"] and search(desc["long"], text):
report["messages"][name]["long"] = True
report["covered"] += 1
if not report["messages"][name]["short"] and search(desc["short"], text):
report["messages"][name]["short"] = True
report["covered"] += 1
def hint_coverage(obituaries, text, report):
# hints have a "question" where the hint is offered, followed
# by the actual hint if the player requests it
for _, hintouter in enumerate(obituaries):
hint = hintouter["hint"]
name = hint["name"]
if name not in report["messages"]:
report["messages"][name] = {"question": False, "hint": False}
report["total"] += 2
if not report["messages"][name]["question"] and search(hint["question"], text):
report["messages"][name]["question"] = True
report["covered"] += 1
if not report["messages"][name]["hint"] and search(hint["hint"], text):
report["messages"][name]["hint"] = True
report["covered"] += 1
def obit_coverage(obituaries, text, report):
# obituaries have a "query" where it asks the player for a resurrection,
# followed by a snarky comment if the player says yes
for name, obit in enumerate(obituaries):
if name not in report["messages"]:
report["messages"][name] = {"query": False, "yes_response": False}
report["total"] += 2
if not report["messages"][name]["query"] and search(obit["query"], text):
report["messages"][name]["query"] = True
report["covered"] += 1
if not report["messages"][name]["yes_response"] and search(
obit["yes_response"], text
):
report["messages"][name]["yes_response"] = True
report["covered"] += 1
def threshold_coverage(classes, text, report):
# works for class thresholds and turn threshold, which have a "message"
# property
for name, item in enumerate(classes):
if name not in report["messages"]:
report["messages"][name] = {"covered": False}
report["total"] += 1
if not report["messages"][name]["covered"] and search(item["message"], text):
report["messages"][name]["covered"] = True
report["covered"] += 1
def arb_coverage(arb_msgs, text, report):
for name, message in arb_msgs:
if name not in report["messages"]:
report["messages"][name] = {"covered": False}
report["total"] += 1
if not report["messages"][name]["covered"] and (
search(message, text) or name in DANGLING_MESSAGES
):
report["messages"][name]["covered"] = True
report["covered"] += 1
def actions_coverage(items, text, report):
# works for actions
for name, item in items:
if name not in report["messages"]:
report["messages"][name] = {"covered": False}
report["total"] += 1
if not report["messages"][name]["covered"] and (
search(item["message"], text) or name in DANGLING_ACTIONS
):
report["messages"][name]["covered"] = True
report["covered"] += 1
def coverage_report(db, check_file_contents):
# Create report for each category, including total items, number of items
# covered, and a list of the covered messages
report = {}
for name in db.keys():
# initialize each catagory
report[name] = {
"name": name, # convenience for string formatting
"total": 0,
"covered": 0,
"messages": {},
}
# search for each message in every test check file
for chk in check_file_contents:
arb_coverage(db["arbitrary_messages"], chk, report["arbitrary_messages"])
hint_coverage(db["hints"], chk, report["hints"])
loc_coverage(db["locations"], chk, report["locations"])
obit_coverage(db["obituaries"], chk, report["obituaries"])
obj_coverage(db["objects"], chk, report["objects"])
actions_coverage(db["actions"], chk, report["actions"])
threshold_coverage(db["classes"], chk, report["classes"])
threshold_coverage(db["turn_thresholds"], chk, report["turn_thresholds"])
return report
if __name__ == "__main__":
# load DB
try:
with open(YAML_PATH, "r", encoding="ascii", errors="surrogateescape") as f:
db = yaml.safe_load(f)
except IOError as e:
print("ERROR: could not load %s (%s)" % (YAML_PATH, e.strerror))
sys.exit(-1)
# get contents of all the check files
check_file_contents = []
for filename in os.listdir(TEST_DIR):
if filename.endswith(".chk"):
with open(filename, "r", encoding="ascii", errors="surrogateescape") as f:
check_file_contents.append(f.read())
# run coverage analysis report on dungeon database
report = coverage_report(db, check_file_contents)
# render report output
categories_html = ""
summary_html = ""
summary_stdout = "adventure.yaml coverage rate:\n"
for name, category in sorted(report.items()):
# ignore categories with zero entries
if category["total"] > 0:
# Calculate percent coverage
category["percent"] = (category["covered"] / float(category["total"])) * 100
# render section header
cat_messages = list(category["messages"].items())
cat_keys = cat_messages[0][1].keys()
headers_html = ""
colspan = 10 - len(cat_keys)
for key in cat_keys:
headers_html += HTML_CATEGORY_HEADER_CELL.format(key)
category_html = HTML_CATEGORY_HEADER.format(
colspan=colspan, label=category["name"], cells=headers_html
)
# render message coverage row
for message_id, covered in cat_messages:
category_html_row = ""
for key, value in covered.items():
category_html_row += HTML_CATEGORY_COVERAGE_CELL.format(
"uncovered" if not value else "covered"
)
category_html += HTML_CATEGORY_ROW.format(
id=message_id, colspan=colspan, cells=category_html_row
)
categories_html += HTML_CATEGORY_SECTION.format(id=name, rows=category_html)
# render category summaries
summary_stdout += STDOUT_REPORT_CATEGORY.format(**category)
summary_html += HTML_SUMMARY_ROW.format(**category)
# output some quick report stats
print(summary_stdout)
if len(sys.argv) > 1:
html_output_path = sys.argv[1]
else:
html_output_path = DEFAULT_HTML_OUTPUT_PATH
# render HTML report
try:
with open(
HTML_TEMPLATE_PATH, "r", encoding="ascii", errors="surrogateescape"
) as f:
# read in HTML template
html_template = f.read()
except IOError as e:
print("ERROR: reading HTML report template failed ({})".format(e.strerror))
sys.exit(-1)
# parse template with report and write it out
try:
with open(
html_output_path, "w", encoding="ascii", errors="surrogateescape"
) as f:
f.write(
html_template.format(categories=categories_html, summary=summary_html)
)
except IOError as e:
print("ERROR: writing HTML report failed ({})".format(e.strerror))

162
tests/death-jump.chk Normal file
View file

@ -0,0 +1,162 @@
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 1495774850
Seed set to 1495774850
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.
> take keys
OK
> take lamp
OK
> out
You're in front of building.
> s
You are in a valley in the forest beside a stream tumbling along a
rocky bed.
> s
At your feet all the water of the stream splashes into a 2-inch slit
in the rock. Downstream the streambed is bare rock.
> s
You are in a 20-foot depression floored with bare dirt. Set into the
dirt is a strong steel grate mounted in concrete. A dry streambed
leads into the depression.
The grate is locked.
> open grate
The grate is now unlocked.
> d
You are in a small chamber beneath a 3x3 steel grate to the surface.
A low crawl over cobbles leads inward to the west.
The grate is open.
> u
You're outside grate.
The grate is open.
> d
You're below the grate.
The grate is open.
> w
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> w
It is now pitch dark. If you proceed you will likely fall into a pit.
> light lamp
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> crack
The crack is far too small for you to follow. At its widest it is
barely wide enough to admit your foot.
You're at top of small pit.
Rough stone steps lead down the pit.
> down
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> w
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> jump
You didn't make it.
Oh dear, you seem to have gotten yourself killed. I might be able to
help you out, but I've never really done this before. Do you want me
to try to reincarnate you?
> n
OK
You scored 51 out of a possible 430, using 21 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 70 more points.

29
tests/death-jump.log Normal file
View file

@ -0,0 +1,29 @@
## Jump into a pit and die, refuse reincarnation
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1495774850
in
take keys
take lamp
out
s
s
s
open grate
d
# go back up and down again because of coverage
u
d
w
w
light lamp
w
w
w
# attempt and fail to traverse the crack because coverage
crack
down
w
jump
n

3
tests/decheck Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
# Turn a non-oldstyle checkfile on stdin into an equivalent log on stdout.
sed -n -e '/> /s///p'

3043
tests/defeat.chk Normal file

File diff suppressed because it is too large Load diff

497
tests/defeat.log Normal file
View file

@ -0,0 +1,497 @@
## Last-minute defeat, with lava. Also tests vase drop before pillow.
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Based on walkthrough at http://www.ecsoftwareconsulting.com/node/56
n
seed 1838473132
in
take lamp
xyzzy
on
take rod
e
take cage
go west
go west
go west
drop rod
take bird
take rod
go west
free bird
wave rod
take necklace
drop rod
take bird
take rod
d
d
free bird
drop rod
drop cage
take cage
take bird
go west
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
go west
kill dragon
yes
drink blood
take rug
e
e
up
d
n
n
off
plugh
inven
drop rug
drop silver
out
s
go west
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
go west
wave rod
drop rod
west
take diamonds
go west
go west
go west
s
sw
se
s
kill machine
s
s
kill ogre
n
take ruby
s
west
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
west
u
reservoir
say 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
west
d
climb
west
n
oil door
drop bottle
n
take trident
west
d
se
n
west
drop trident
drop ebony
drop axe
drop lantern
e
take emerald
west
take lamp
take axe
take ebony
take trident
nw
s
take vase
se
throw axe
take axe
e
take pillow
west
drop axe
ne
e
n
open clam
open oyster
s
u
e
u
n
off
plugh
# Invert these so we test the vase-drop code
drop vase
drop pillow
drop trident
drop emerald
drop ebony
take keys
take food
plugh
on
s
d
west
d
n
d
d
take pearl
u
u
s
west
west
west
west
d
climb
west
get eggs
n
take bottle
n
west
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
west
west
sw
free bear
inven
sw
sw
d
se
se
west
d
get oil
up
e
take axe
west
west
d
climb
west
fee
fie
foe
foo
take eggs
s
d
u
west
u
s
e
e
n
n
off
plugh
drop eggs
drop pearl
drop spices
drop chain
take rug
take ruby
take emerald
out
west
n
n
n
inven
fill urn
light urn
rub urn
take amber
drop rug
# fly rug before dropping emerald, triggering RUG_NOTHING1
fly rug
drop emerald
fly rug
take sapphire
fly
take emerald
drop ruby
take rug
drop bottle
take ruby
drop emerald
take emerald
e
s
e
e
in
drop ruby
drop sapphire
drop amber
drop rug
look
plugh
on
s
s
u
west
west
west
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
west
d
e
read sign
take magazine
e
drop magazine
w
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
take oyster
# Test both cases (before and after hint) of reading oyster
read oyster
y
read oyster
drop oyster
open oyster
sw
# We want the xyzzy and plugh words to fail here
xyzzy
plugh
read sign
carry sign
take rod
drop rod
# look to see dropped rod on ground. Different state than
# before we picked it up.
look
ne
listen
blast rod

174
tests/domefail.chk Normal file
View file

@ -0,0 +1,174 @@
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 1838473132
Seed set to 1838473132
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> take
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> w
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> e
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> s
You are in the south side chamber.
There is precious jewelry here!
> n
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> u
You're in Hall of Mists.
Rough stone steps lead up the dome.
> s
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
There is a large sparkling nugget of gold here!
> take nugget
OK
> n
You're in Hall of Mists.
> dome
The dome is unclimbable.
You're in Hall of Mists.
> u
The dome is unclimbable.
You're in Hall of Mists.
>
You scored 63 out of a possible 430, using 24 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 58 more points.

29
tests/domefail.log Normal file
View file

@ -0,0 +1,29 @@
## Take nugget and fail to climb to the dome
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1838473132
in
take lamp
xyzzy
on
e
take cage
w
w
w
take
w
d
d
free bird
w
e
s
n
u
s
take nugget
n
dome
u

254
tests/dragon_secret5.chk Normal file
View file

@ -0,0 +1,254 @@
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 18084731
Seed set to 18084731
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take
OK
> w
You're in debris room.
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> cage bird
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> w
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> e
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> s
You are in the south side chamber.
There is precious jewelry here!
> u
There is no way to go that direction.
You are in the south side chamber.
There is precious jewelry here!
> s
There is no way to go that direction.
You are in the south side chamber.
There is precious jewelry here!
> n
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> d
There is no way to go that direction.
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> n
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
There are bars of silver here!
> n
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> extin
Your lamp is now off.
> plugh
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're at "Y2".
> s
You're in n/s passage above e/w passage.
There are bars of silver here!
> s
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> sw
You are in a secret canyon which here runs e/w. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able
to get back up.
> w
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You are in a secret canyon which exits to the north and east.
There is a little axe here.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> kill drago
With what? Your bare hands?
> y
Congratulations! You have just vanquished a dragon with your bare
hands! (Unbelievable, isn't it?)
You are in a secret canyon which exits to the north and east.
There is a little axe here.
There is a Persian rug spread out on the floor!
The blood-specked body of a huge green dead dragon lies to one side.
>
You scored 65 out of a possible 430, using 32 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 56 more points.

38
tests/dragon_secret5.log Normal file
View file

@ -0,0 +1,38 @@
## Check that dead dragon actually moves its location (fuzzed)
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 18084731
in
take lamp
xyzzy
on
e
take
w
w
w
cage bird
w
d
d
free bird
w
e
s
u
s
n
d
n
n
plugh
extin
plugh
on
s
s
sw
w
kill drago
y

158
tests/dropcagedbird.chk Normal file
View file

@ -0,0 +1,158 @@
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 1495951709
Seed set to 1495951709
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.
> take lamp
OK
> on
Your lamp is now on.
> xyzzy
>>Foof!<<
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> wave rod
The bird flies about agitatedly for a moment.
> take bird
The bird seemed unafraid at first, but as you approach it becomes
disturbed and you cannot catch it.
> drop rod
OK
> take bird
OK
> take rod
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> free bird
OK
> wave rod
The bird flies about agitatedly for a moment, then disappears through
the crack. It reappears shortly, carrying in its beak a jade
necklace, which it drops at your feet.
> take jade
OK
> drop rod
OK
> take bird
OK
> drop cage
OK
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> feed snake
There's nothing here it wants to eat (except perhaps you).
>
You scored 59 out of a possible 430, using 25 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 62 more points.

30
tests/dropcagedbird.log Normal file
View file

@ -0,0 +1,30 @@
## Try to carry the bird after freeing it instead of listening
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1495951709
in
take lamp
on
xyzzy
take rod
e
take cage
w
w
w
wave rod
take bird
drop rod
take bird
take rod
w
free bird
wave rod
take jade
drop rod
take bird
drop cage
d
d
feed snake

966
tests/drown.chk Normal file
View file

@ -0,0 +1,966 @@
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 1838473132
Seed set to 1838473132
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> drop rod
OK
> take bird
OK
> take rod
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> free bird
OK
> wave rod
The bird flies about agitatedly for a moment, then disappears through
the crack. It reappears shortly, carrying in its beak a jade
necklace, which it drops at your feet.
> take necklace
OK
> drop rod
OK
> take bird
OK
> take rod
OK
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> drop rod
OK
> drop cage
OK
> take cage
OK
> take bird
OK
> w
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> take coins
OK
> e
You're in Hall of Mt King.
A three foot black rod with a rusty star on an end lies nearby.
> s
You are in the south side chamber.
There is precious jewelry here!
> take jewelry
OK
> n
You're in Hall of Mt King.
A three foot black rod with a rusty star on an end lies nearby.
> up
You're in Hall of Mists.
Rough stone steps lead up the dome.
> s
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
There is a large sparkling nugget of gold here!
> take gold
OK
> n
You're in Hall of Mists.
> d
You're in Hall of Mt King.
A three foot black rod with a rusty star on an end lies nearby.
> n
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
There are bars of silver here!
> n
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
A hollow voice says "PLUGH".
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> extinguish lamp
Your lamp is now off.
> drop coins
OK
> drop jewelry
OK
> drop necklace
OK
> drop gold
OK
> plugh
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're at "Y2".
> s
You're in n/s passage above e/w passage.
There are bars of silver here!
> take silver
OK
> s
You're in Hall of Mt King.
A three foot black rod with a rusty star on an end lies nearby.
> sw
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You are in a secret canyon which here runs e/w. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able
to get back up.
There is a little axe here.
> take axe
OK
> w
You are in a secret canyon which exits to the north and east.
A huge green fierce dragon bars the way!
The dragon is sprawled out on a Persian rug!!
> kill dragon
With what? Your bare hands?
> yes
Congratulations! You have just vanquished a dragon with your bare
hands! (Unbelievable, isn't it?)
You are in a secret canyon which exits to the north and east.
There is a Persian rug spread out on the floor!
The blood-specked body of a huge green dead dragon lies to one side.
> feed dragon
Don't be ridiculous!
> drink blood
Your head buzzes strangely for a moment.
> take rug
OK
> e
You're in secret e/w canyon above tight canyon.
> e
You are in the Hall of the Mountain King, with passages off in all
directions.
A three foot black rod with a rusty star on an end lies nearby.
> up
There is a threatening little dwarf in the room with you!
One sharp nasty knife is thrown at you!
It misses!
You're in Hall of Mists.
Rough stone steps lead up the dome.
> d
There is a threatening little dwarf in the room with you!
You're in Hall of Mt King.
A three foot black rod with a rusty star on an end lies nearby.
> n
There is a threatening little dwarf in the room with you!
You're in n/s passage above e/w passage.
> n
There is a threatening little dwarf in the room with you!
You're at "Y2".
A hollow voice says "PLUGH".
> off
Your lamp is now off.
It is now pitch dark. If you proceed you will likely fall into a pit.
> plugh
>>Foof!<<
You're inside building.
There is a large sparkling nugget of gold here!
A precious jade necklace has been dropped here!
There is precious jewelry here!
There are many coins here!
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> inven
You are currently holding the following:
Brass lantern
Wicker cage
Little bird in cage
Dwarf's axe
Bars of silver
Persian rug
> drop rug
OK
> drop silver
OK
> out
You're in front of building.
> s
You are in a valley in the forest beside a stream tumbling along a
rocky bed.
> w
You are wandering aimlessly through the forest.
> n
You are wandering aimlessly through the forest.
Your keen eye spots a severed leporine appendage lying on the ground.
> take appendage
OK
> free bird
OK
> drop cage
OK
> listen
The bird is singing to you in gratitude for your having returned it to
its home. In return, it informs you of a magic word which it thinks
you may find useful somewhere near the Hall of Mists. The magic word
changes frequently, but for now the bird believes it is "H'CFL". You
thank the bird for this information, and it flies off into the forest.
> s
You are wandering aimlessly through the forest.
> s
You're in valley.
> n
You're in front of building.
> in
You're inside building.
There are bars of silver here!
There is a Persian rug spread out on the floor!
There is a large sparkling nugget of gold here!
A precious jade necklace has been dropped here!
There is precious jewelry here!
There are many coins here!
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> take water
OK
> plugh
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're at "Y2".
> plover
>>Foof!<<
You're in a small chamber lit by an eerie green light. An extremely
narrow tunnel exits to the west. A dark corridor leads ne.
There is an emerald here the size of a plover's egg!
> ne
You're in the dark-room. A corridor leading south is the only exit.
A massive stone tablet embedded in the wall reads:
"Congratulations on bringing light into the dark-room!"
There is a platinum pyramid here, 8 inches on a side!
> take pyramid
OK
> s
You're in Plover Room.
There is an emerald here the size of a plover's egg!
> plover
>>Foof!<<
You're at "Y2".
A hollow voice says "PLUGH".
> s
You're in n/s passage above e/w passage.
> s
You're in Hall of Mt King.
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> up
You're in Hall of Mists.
Rough stone steps lead up the dome.
> w
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> wave rod
A crystal bridge now spans the fissure.
> drop rod
OK
> west
You are on the west side of the fissure in the Hall of Mists.
There are diamonds here!
A crystal bridge spans the fissure.
> take diamonds
OK
> w
There is a threatening little dwarf in the room with you!
One sharp nasty knife is thrown at you!
It misses!
You are at the west end of the Hall of Mists. A low wide crawl
continues west and another goes north. To the south is a little
passage 6 feet off the floor.
> w
There is a threatening little dwarf in the room with you!
You are at the east end of a very long hall apparently without side
chambers. To the east a low wide crawl slants up. To the north a
round two foot hole slants down.
> w
There is a threatening little dwarf in the room with you!
You are at the west end of a very long featureless hall. The hall
joins up with a narrow north/south passage.
> s
There is a threatening little dwarf in the room with you!
You are in a maze of twisty little passages, all different.
> sw
There is a threatening little dwarf in the room with you!
You are in a little maze of twisty passages, all different.
> se
There is a threatening little dwarf in the room with you!
You are in a little maze of twisting passages, all different.
> s
There is a threatening little dwarf in the room with you!
Dead end
There is a massive and somewhat battered vending machine here. The
instructions on it read: "Drop coins here to receive fresh batteries."
> kill machine
As you strike the vending machine, it pivots backward along with a
section of wall, revealing a dark passage leading south.
> s
There is a threatening little dwarf in the room with you!
You are in a long, rough-hewn, north/south corridor.
> s
There is a threatening little dwarf in the room with you!
You are in a large chamber with passages to the west and north.
A formidable ogre bars the northern exit.
> kill ogre
The ogre, who despite his bulk is quite agile, easily dodges your
attack. He seems almost amused by your puny effort.
One sharp nasty knife is thrown at you!
The ogre, distracted by your rush, is struck by the knife. With a
blood-curdling yell he turns and bounds after the dwarf, who flees
in panic. You are left alone in the room.
> n
You are in the ogre's storeroom. The only exit is to the south.
There is an enormous ruby here!
> take ruby
OK
> s
You are in a large chamber with passages to the west and north.
> w
You are in a long, rough-hewn, north/south corridor.
> n
Dead end
There is a massive vending machine here, swung back to reveal a
southward passage.
> n
You are in a little maze of twisting passages, all different.
> n
You are in a little maze of twisty passages, all different.
> nw
You are in a maze of twisty little passages, all different.
> d
You're at west end of long hall.
> e
You're at east end of long hall.
> e
You're at west end of Hall of Mists.
> e
You're on west bank of fissure.
A crystal bridge spans the fissure.
> e
You're on east bank of fissure.
A three foot black rod with a rusty star on an end lies nearby.
A crystal bridge spans the fissure.
> e
There is a threatening little dwarf in the room with you!
One sharp nasty knife is thrown at you!
It misses!
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> throw axe
You killed a little dwarf. The body vanishes in a cloud of greasy
black smoke.
You're in Hall of Mists.
There is a little axe here.
Rough stone steps lead up the dome.
> take axe
OK
> n
You're in Hall of Mt King.
> n
You're in n/s passage above e/w passage.
> n
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
A hollow voice says "PLUGH".
> off
Your lamp is now off.
It is now pitch dark. If you proceed you will likely fall into a pit.
> plugh
>>Foof!<<
You're inside building.
There are bars of silver here!
There is a Persian rug spread out on the floor!
There is a large sparkling nugget of gold here!
A precious jade necklace has been dropped here!
There is precious jewelry here!
There are many coins here!
There are some keys on the ground here.
There is food here.
> drop ruby
OK
> drop diamonds
OK
> drop pyramid
OK
> plugh
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're at "Y2".
A hollow voice says "PLUGH".
> s
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
> s
You're in Hall of Mt King.
> n
You're in n/s passage above e/w passage.
> d
You are in a dirty broken passage. To the east is a crawl. To the
west is a large passage. Above you is a hole to another passage.
> bedquilt
You are in Bedquilt, a long east/west passage with holes everywhere.
To explore at random select north, south, up, or down.
> slab
You are in a large low circular chamber whose floor is an immense slab
fallen from the ceiling (Slab Room). East and west there once were
large passages, but they are now filled with boulders. Low small
passages go north and south, and the south one quickly bends west
around the boulders.
> s
You are at the west end of the Twopit Room. There is a large hole in
the wall above the pit at this end of the room.
> d
You are at the bottom of the western pit in the Twopit Room. There is
a large hole in the wall about 25 feet above you.
There is a tiny little plant in the pit, murmuring "water, water, ..."
> water plant
The plant spurts into furious growth for a few seconds.
You're in west pit.
There is a 12-foot-tall beanstalk stretching up out of the pit,
bellowing "WATER!! WATER!!"
> H'CFL
Nothing happens.
> u
You're at west end of Twopit Room.
The top of a 12-foot-tall beanstalk is poking out of the west pit.
> w
You're in Slab Room.
> u
You are in a secret n/s canyon above a large room.
> reservoir
You are at the edge of a large underground reservoir. An opaque cloud
of white mist fills the room and rises rapidly upward. The lake is
fed by a stream, which tumbles out of a hole in the wall about 10 feet
overhead and splashes noisily into the water somewhere within the
mist. There is a passage going back toward the south.
> drink
You have taken a drink from the stream. The water tastes strongly of
minerals, but is not unpleasant. It is extremely cold.
> H'CFL
The waters have parted to form a narrow path across the reservoir.
> n
You are walking across the bottom of the reservoir. Walls of water
rear up on either side. The roar of the water cascading past is
nearly deafening, and the mist is so thick you can barely see.
> H'CFL
The waters crash together again.
(Uh, y'know, that wasn't very bright.)
Oh dear, you seem to have gotten yourself killed. I might be able to
help you out, but I've never really done this before. Do you want me
to try to reincarnate you?
> n
OK
You scored 177 out of a possible 430, using 153 turns.
You may now consider yourself a "Seasoned Adventurer".
To achieve the next higher rating, you need 74 more points.

161
tests/drown.log Normal file
View file

@ -0,0 +1,161 @@
## Speak a magic word at an inopportune time and drown.
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Based on walkthrough at http://www.ecsoftwareconsulting.com/node/56
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
feed dragon
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
n
d
bedquilt
slab
s
d
water plant
H'CFL
u
w
u
reservoir
drink
H'CFL
n
H'CFL
n

387
tests/dwarf.chk Normal file
View file

@ -0,0 +1,387 @@
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 1494912171
Seed set to 1494912171
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.
> take keys
OK
> take lamp
OK
> out
You're in front of building.
> down
You are in a valley in the forest beside a stream tumbling along a
rocky bed.
> s
At your feet all the water of the stream splashes into a 2-inch slit
in the rock. Downstream the streambed is bare rock.
> s
You are in a 20-foot depression floored with bare dirt. Set into the
dirt is a strong steel grate mounted in concrete. A dry streambed
leads into the depression.
The grate is locked.
> open grate
The grate is now unlocked.
> down
You are in a small chamber beneath a 3x3 steel grate to the surface.
A low crawl over cobbles leads inward to the west.
The grate is open.
> west
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> west
It is now pitch dark. If you proceed you will likely fall into a pit.
> light lamp
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> xyzzy
>>Foof!<<
You're inside building.
There is food here.
There is a bottle of water here.
> xyzzy
>>Foof!<<
You're in debris room.
> west
You are in an awkward sloping east/west canyon.
> drop rod
OK
> west
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> take bird
OK
> east
You are in an awkward sloping east/west canyon.
A three foot black rod with a rusty star on an end lies nearby.
> take rod
OK
> west
You're in bird chamber.
> west
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> down
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> south
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
There is a large sparkling nugget of gold here!
> take gold
OK
> n
You're in Hall of Mists.
> n
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> drop bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> west
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> take coins
OK
> e
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> s
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You are in the south side chamber.
There is a little axe here.
There is precious jewelry here!
> drop cage
OK
> take jewelry
OK
> take axe
OK
> n
There is a threatening little dwarf in the room with you!
One sharp nasty knife is thrown at you!
It misses!
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> n
There is a threatening little dwarf in the room with you!
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
There are bars of silver here!
> n
There is a threatening little dwarf in the room with you!
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
> plugh
>>Foof!<<
You're inside building.
There is food here.
There is a bottle of water here.
> inven
You are currently holding the following:
Set of keys
Brass lantern
Black rod
Dwarf's axe
Large gold nugget
Precious jewelry
Rare coins
> drop jewelry
OK
> drop gold
OK
> inven
You are currently holding the following:
Set of keys
Brass lantern
Black rod
Dwarf's axe
Rare coins
> drop keys
OK
> plugh
>>Foof!<<
There are 2 threatening little dwarves in the room with you.
One sharp nasty knife is thrown at you!
It misses!
You're at "Y2".
> s
There are 2 threatening little dwarves in the room with you.
You're in n/s passage above e/w passage.
There are bars of silver here!
> s
There are 2 threatening little dwarves in the room with you.
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> up
There are 2 threatening little dwarves in the room with you.
You're in Hall of Mists.
Rough stone steps lead up the dome.
> w
There are 2 threatening little dwarves in the room with you.
You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump.
> wave rod
A crystal bridge now spans the fissure.
> w
There are 2 threatening little dwarves in the room with you.
You are on the west side of the fissure in the Hall of Mists.
There are diamonds here!
A crystal bridge spans the fissure.
> take diamonds
OK
> e
A little dwarf with a big knife blocks your way.
There are 2 threatening little dwarves in the room with you.
2 of them throw knives at you!
One of them gets you!
Oh dear, you seem to have gotten yourself killed. I might be able to
help you out, but I've never really done this before. Do you want me
to try to reincarnate you?
> n
OK
You scored 81 out of a possible 430, using 55 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 40 more points.

61
tests/dwarf.log Normal file
View file

@ -0,0 +1,61 @@
## In which the dwarf kills you
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1494912171
in
take keys
take lamp
out
down
s
s
open grate
down
west
take cage
west
light lamp
take rod
xyzzy
xyzzy
west
drop rod
west
take bird
east
take rod
west
west
down
south
take gold
n
n
drop bird
west
take coins
e
s
drop cage
take jewelry
take axe
n
n
n
plugh
inven
drop jewelry
drop gold
inven
drop keys
plugh
s
s
up
w
wave rod
w
take diamonds
e
n

View file

@ -0,0 +1,69 @@
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 383847
Seed set to 383847
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.
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> w
It is now pitch dark. If you proceed you will likely fall into a pit.
> w
It is now pitch dark. If you proceed you will likely fall into a pit.
> w
It is now pitch dark. If you proceed you will likely fall into a pit.
> d
It is now pitch dark. If you proceed you will likely fall into a pit.
> d
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You fell into a pit and broke every bone in your body!
Oh dear, you seem to have gotten yourself killed. I might be able to
help you out, but I've never really done this before. Do you want me
to try to reincarnate you?
> n
OK
You scored 51 out of a possible 430, using 7 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 70 more points.

View file

@ -0,0 +1,13 @@
## Check that dwarf spawns in alternative location (fuzzed)
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 383847
in
xyzzy
w
w
w
d
d
n

1231
tests/eggs_done.chk Normal file

File diff suppressed because it is too large Load diff

196
tests/eggs_done.log Normal file
View file

@ -0,0 +1,196 @@
## Be done with Giant Room and eggs (fuzzed)
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1838473132
in
take lamp
xyzzy
on
take rod
e
take cage
w
w
w
drop rod
take bird
take rod
w
d
d
free bird
w
take coins
e
s
take n
u
s
n
d
n
n
plugh
extin
plugh
on
s
s
sw
take
w
kill drago
y
e
e
u
d
n
n
off
plugh
out
s
w
n
s
s
n
in
take water
plugh
on
plove
s
plove
s
s
u
w
wave rod
west
w
w
w
s
s
e
s
kill machi
s
s
n
s
w
n
n
n
nw
d
e
e
e
e
e
n
n
n
off
plugh
plugh
on
s
s
u
n
n
d
bedqu
throw axe
slab
s
d
water plant
u
w
u
reser
H'CFL
n
n
w
u
u
u
u
w
d
d
d
d
d
take water
s
s
s
s
d
s
d
water plant
u
e
d
get oil
u
w
d
climb
w
n
oil door
d
n
w
d
se
n
w
nw
s
e
se
e
w
ne
e
n
e
u
n
s
d
w
d
n
d
d
u
u
s
w
w
w
w
d
climb
w
take egg
n
fee
fie
foe
foo
look
inven

443
tests/eggs_vanish.chk Normal file
View file

@ -0,0 +1,443 @@
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 1838473132
Seed set to 1838473132
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> take
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> w
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> e
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> s
You are in the south side chamber.
There is precious jewelry here!
> n
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> u
You're in Hall of Mists.
Rough stone steps lead up the dome.
> s
This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps".
There is a large sparkling nugget of gold here!
> n
You're in Hall of Mists.
Rough stone steps lead up the dome.
> d
You're in Hall of Mt King.
A cheerful little bird is sitting here singing.
> n
You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage.
There are bars of silver here!
> n
You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center.
A hollow voice says "PLUGH".
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> extin
Your lamp is now off.
> plugh
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You're at "Y2".
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
There is a bottle of water here.
> take water
OK
> plugh
>>Foof!<<
You're at "Y2".
> plugh
>>Foof!<<
You're inside building.
There are some keys on the ground here.
There is food here.
> plugh
>>Foof!<<
You're at "Y2".
> s
You're in n/s passage above e/w passage.
There are bars of silver here!
> d
You are in a dirty broken passage. To the east is a crawl. To the
west is a large passage. Above you is a hole to another passage.
> bedqu
You are in Bedquilt, a long east/west passage with holes everywhere.
To explore at random select north, south, up, or down.
> slab
You are in a large low circular chamber whose floor is an immense slab
fallen from the ceiling (Slab Room). East and west there once were
large passages, but they are now filled with boulders. Low small
passages go north and south, and the south one quickly bends west
around the boulders.
> s
You are at the west end of the Twopit Room. There is a large hole in
the wall above the pit at this end of the room.
> d
You are at the bottom of the western pit in the Twopit Room. There is
a large hole in the wall about 25 feet above you.
There is a tiny little plant in the pit, murmuring "water, water, ..."
> water plant
The plant spurts into furious growth for a few seconds.
You're in west pit.
There is a 12-foot-tall beanstalk stretching up out of the pit,
bellowing "WATER!! WATER!!"
> u
You're at west end of Twopit Room.
The top of a 12-foot-tall beanstalk is poking out of the west pit.
> w
You're in Slab Room.
> u
You are in a secret n/s canyon above a large room.
> reser
You are at the edge of a large underground reservoir. An opaque cloud
of white mist fills the room and rises rapidly upward. The lake is
fed by a stream, which tumbles out of a hole in the wall about 10 feet
overhead and splashes noisily into the water somewhere within the
mist. There is a passage going back toward the south.
> H'CFL
The waters have parted to form a narrow path across the reservoir.
> n
You are walking across the bottom of the reservoir. Walls of water
rear up on either side. The roar of the water cascading past is
nearly deafening, and the mist is so thick you can barely see.
> n
You are at the northern edge of the reservoir. A northwest passage
leads sharply up from here.
The waters have parted to form a narrow path across the reservoir.
> take water
Your bottle is now full of water.
> s
You're at bottom of reservoir.
> s
You're at reservoir.
The waters have parted to form a narrow path across the reservoir.
> s
You are in a north/south canyon about 25 feet across. The floor is
covered by white mist seeping in from the north. The walls extend
upward for well over 100 feet. Suspended from some unseen point far
above you, an enormous two-sided mirror is hanging parallel to and
midway between the canyon walls. (The mirror is obviously provided
for the use of the dwarves who, as you know, are extremely vain.) A
small window can be seen in either wall, some fifty feet up.
> s
You are in a secret n/s canyon above a large room.
> d
You're in Slab Room.
> s
You're at west end of Twopit Room.
The top of a 12-foot-tall beanstalk is poking out of the west pit.
> d
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You're in west pit.
There is a little axe here.
There is a 12-foot-tall beanstalk stretching up out of the pit,
bellowing "WATER!! WATER!!"
> water plant
The plant grows explosively, almost filling the bottom of the pit.
You're in west pit.
There is a little axe here.
There is a gigantic beanstalk stretching all the way up to the hole.
> climb
You clamber up the plant and scurry through the hole at the top.
You are in a long, narrow corridor stretching out of sight to the
west. At the eastern end is a hole through which you can see a
profusion of leaves.
> w
You are in the Giant Room. The ceiling here is too high up for your
lamp to show it. Cavernous passages lead east, north, and south. On
the west wall is scrawled the inscription, "FEE FIE FOE FOO" [sic].
There is a large nest here, full of golden eggs!
> take
OK
> n
You are at one end of an immense north/south passage.
The way north is barred by a massive, rusty, iron door.
> fee
OK
> fie
OK
> foe
OK
> foo
The nest of golden eggs has vanished!
> s
You're in Giant Room.
There is a large nest here, full of golden eggs!
> e
The passage here is blocked by a recent cave-in.
>
You scored 67 out of a possible 430, using 66 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 54 more points.

72
tests/eggs_vanish.log Normal file
View file

@ -0,0 +1,72 @@
## Vanishing eggs in Giant Room (fuzzed)
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 1838473132
in
take lamp
xyzzy
on
e
take cage
w
w
w
take
w
d
d
free bird
w
e
s
n
u
s
n
d
n
n
plugh
extin
plugh
on
plugh
take water
plugh
plugh
plugh
s
d
bedqu
slab
s
d
water plant
u
w
u
reser
H'CFL
n
n
take water
s
s
s
s
d
s
d
water plant
climb
w
take
n
fee
fie
foe
foo
# go south, east to arrive at LOC_CAVEIN for coverage
s
e

2946
tests/endgame428.chk Normal file

File diff suppressed because it is too large Load diff

475
tests/endgame428.log Normal file
View file

@ -0,0 +1,475 @@
## 428-point walkthrough
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Based on walkthrough at http://www.ecsoftwareconsulting.com/node/56
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
sw
take rod
ne
drop rod
sw
blast

2464
tests/endobjects.chk Normal file

File diff suppressed because it is too large Load diff

430
tests/endobjects.log Normal file
View file

@ -0,0 +1,430 @@
### Check that water is unavailable in endgame
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
# Addresses GitLab issue #55: in endgame, some object starting states are incorrect
#NOCOMPARE Bird was not weightless in cage in advent430, this test depends on that.
no
seed 11247848
no
seed 1516020414
e
plugh
plove
get emerald
w
drop emerald
e
ne
get pyramid
s
plove
plugh
drop pyramid
get lamp
xyzzy
on
get rod
e
get cage
pit
d
w
wave rod
w
get diamonds
e
e
u
drop rod
e
get bird
w
free bird
get rod
wave rod
get necklace
drop rod
get bird
d
s
get gold
n
d
free bird
get bird
s
get jewelry
n
sw
w
kill dragon
yes
drink blood
get rug
e
e
n
n
plugh
drop necklace
drop gold
drop jewelry
drop diamonds
w
s
w
n
get appendage
free bird
drop cage
listen
s
s
n
e
plugh
s
s
sw
w
n
reserv
U'SIM
n
n
u
u
u
u
u
ne
get statuette
sw
d
d
d
d
d
s
s
s
s
s
get axe
e
e
e
w
w
w
w
s
sw
se
s
hit machine
s
s
hit ogre
s
n
get ruby
s
w
n
n
d
d
d
e
e
e
e
e
d
throw axe
get axe
n
get silver
n
plugh
drop silver
drop ebony
drop appendage
get water
plugh
throw axe
get axe
s
d
bedquilt
w
w
w
d
pour water
u
e
d
get oil
u
e
e
get pillow
w
orien
get vase
n
w
get emerald
nw
s
se
ne
slab
u
s
e
e
n
n
plugh
drop pillow
drop vase
drop emerald
xyzzy
pit
d
w
w
w
s
e
s
s
s
n
throw axe
get axe
e
e
nw
get chest
get ruby
get rug
se
se
w
throw axe
s
d
debris
xyzzy
drop chest
get emerald
w
w
n
n
n
fill urn
light urn
rub urn
get amber
drop rug
drop emerald
fly rug
get sapphire
fly rug
get emerald
drop ruby
get rug
get ruby
e
s
e
e
e
drop ruby
drop sapphire
drop amber
drop emerald
drop rug
get water
get keys
get food
plugh
s
s
sw
w
n
d
s
d
pour water
u
e
d
get oil
u
w
d
climb
w
get eggs
n
oil door
n
get trident
w
d
sw
u
toss eggs
cross
barren
e
feed bear
unlock chain
get chain
get bear
fork
ne
e
drop keys
get spices
fork
w
w
cross
free bear
cross
sw
d
bedquilt
w
w
w
d
climb
w
fee
fie
foe
foo
get eggs
s
d
u
e
e
ne
e
n
open clam
d
d
get pearl
shell
s
u
e
u
s
w
drop bottle
get coins
e
n
n
plugh
drop chain
drop spices
drop trident
drop pearl
drop eggs
drop coins
plugh
s
d
w
d
e
get magazine
e
drop magazine
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
no
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
no
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
look
no
look
look
get water
get bottle
inven
sw
get cage
# In the original game, the bird is in the cage at this point
inven
get bird
inven
quit
yes

444
tests/fail_hint_maze.chk Normal file
View file

@ -0,0 +1,444 @@
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 25508795
Seed set to 25508795
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.
> take lamp
OK
> xyzzy
>>Foof!<<
It is now pitch dark. If you proceed you will likely fall into a pit.
> on
Your lamp is now on.
You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone
has scrawled, "MAGIC WORD XYZZY".
A three foot black rod with a rusty star on an end lies nearby.
> e
You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage.
There is a small wicker cage discarded nearby.
> take cage
OK
> w
You're in debris room.
A three foot black rod with a rusty star on an end lies nearby.
> w
You are in an awkward sloping east/west canyon.
> w
You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber.
A cheerful little bird is sitting here singing.
> take
OK
> w
At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on.
Rough stone steps lead down the pit.
> d
You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist
swaying to and fro almost as if alive. A cold wind blows up the
staircase. There is a passage at the top of a dome behind you.
Rough stone steps lead up the dome.
> d
You are in the Hall of the Mountain King, with passages off in all
directions.
A huge green fierce snake bars the way!
> free bird
The little bird attacks the green snake, and in an astounding flurry
drives the snake away.
> w
You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here.
There are many coins here!
> w
You are at a crossover of a high n/s passage and a low e/w one.
> w
You are at the east end of a very long hall apparently without side
chambers. To the east a low wide crawl slants up. To the north a
round two foot hole slants down.
> e
You are at the west end of the Hall of Mists. A low wide crawl
continues west and another goes north. To the south is a little
passage 6 feet off the floor.
> s
You are in a maze of twisty little passages, all alike.
> s
A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away.
You are in a maze of twisty little passages, all alike.
There is a little axe here.
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
> z
OK
>
You scored 59 out of a possible 430, using 93 turns.
Your score qualifies you as a novice class adventurer.
To achieve the next higher rating, you need 62 more points.

98
tests/fail_hint_maze.log Normal file
View file

@ -0,0 +1,98 @@
## Fail to get maze hint by being empty-handed (fuzzed)
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
n
seed 25508795
in
take lamp
xyzzy
on
e
take cage
w
w
w
take
w
d
d
free bird
w
w
w
e
s
s
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z

Some files were not shown because too many files have changed in this diff Show more