Colossal Cave Adventure (Adventure 350) http://forums.delphiforums.com/n/mb/message.asp?webtag=xyzzy&msg=175.1 adv350-pdp10.tar.gz Program build and execution session log by retro98se at gmail.com for asun.net Script started on Thu Jun 18 17:23:12 2009 $ telnet localhost 2020 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Connected to the PDP-10 simulator DZ device, line 0 PDP10 17:23:25 TTY0 system 4097 Connected to Node CENTRA(0) Line # 0 Please LOGIN .login 100,100 Job 3 PDP10 TTY0 Password: [LGNLAS Last access to [100,100] succeeded on 18-Jun-109:17:02:51] 17:23 18-Jun-109 Thursday . .; The compiler to build Adventure will be Fortran-10 Version 6 .; for the TOPS-10 operating system. Circa 1981. . .dir sys:for* FORDDT REL 46 <055> 11-Dec-81 DSKB: [1,4] FORLIB REL 403 <055> 3-Dec-81 FORTB EXE 196 <055> 3-Dec-81 6(1144) FORTC EXE 120 <055> 3-Dec-81 6(1144) FORTD EXE 240 <055> 3-Dec-81 6(1144) FORTE EXE 204 <055> 3-Dec-81 6(1144) FORTF EXE 172 <055> 3-Dec-81 6(1144) FORTG EXE 148 <055> 3-Dec-81 6(1144) FORTRA EXE 80 <055> 3-Dec-81 6(1144) FOROT6 EXE 120 <055> 3-Dec-81 6(2033) Total of 1729 blocks in 10 files on DSKB: [1,4] .set tty fill 0 .set tty lc .set tty tab .r setsrc *cp [,,adv2] *^Z EXIT . .; The original Crowther and Woods PDP-10 FORTRAN source code of the .; Colossal Cave Adventure (350 points). .; adv350-pdp10.tar.gz . .dir ADVEN F4 102 <057> 16-Apr-91 DSKB: [100,100,ADV2] ADVN2 F4 32 <057> 16-Apr-91 ADVEN DAT 90 <057> 16-Apr-91 Total of 224 blocks in 3 files on DSKB: [100,100,ADV2] . .; Adventure performs a CALL IFILE(1,'TEXT') to read the game database .; DAT file, but the code doesn't define IFILE. .; .; IFILE may have originally been part of a 3rd party IOFIL library. .; Without the library, we'll create the file IFILE.F4 with the .; Fortran code for this function. .; .; Function argument FNAME is a file name string of length up to 10 .; characters. The required type depends on the Fortran compiler. .; Fortran 6 expects FNAME to be an array. In later Fortran versions, .; FNAME needs to be type "character" instead. . .sos ifile.f4 Creating IFILE.F4[100,100,ADV2] 00100 SUBROUTINE IFILE(UNUM,FNAME) 00200 00300 IMPLICIT INTEGER(A-Z) 00400 DIMENSION FNAME(2) 00500 C CHARACTER FNAME*10 00600 00700 OPEN(UNIT=UNUM,NAME=FNAME,ACCESS='SEQIN') 00800 RETURN 00900 END 01000 $ *eu [DSKB:IFILE.F4[100,100,ADV2]] .type ifile.f4 SUBROUTINE IFILE(UNUM,FNAME) IMPLICIT INTEGER(A-Z) DIMENSION FNAME(2) C CHARACTER FNAME*10 OPEN(UNIT=UNUM,NAME=FNAME,ACCESS='SEQIN') RETURN END . .; Adventure initializes its arrays by reading data from file text.dat. .; Since we'll edit the data due to reasons noted below, we copy .; adven.dat to be text.dat. . .copy text.dat=adven.dat . .; The text.dat modifications account for changes in the way the Fortran .; library interprets fields read from input files. .; .; Fortran v6 (v5 and later) considers one or more white space characters .; to delimit fields. This is undesirable because some of the strings .; in text.dat have leading spaces and tabs. When the Fortran library .; reads those strings, it discards the leading spaces. To work around .; this, we'll replace the tab field delimiter with a comma delimiter .; in the lines containing strings with leading white space. .; .; Three lines require changes. The editing below locates strings with .; leading spaces, then replaces the first tab with a comma. .; The sos editor commands to accomplish this are: .; find: f .; substitute: s11,. .; find: f .; substitute: s8282,. .; find: f .; substitute: s130130,. . .sos /start:1/step:1/nonum text.dat Editing TEXT.DAT[100,100,ADV2] *p^ 1 *f $ 1 - - - *s1 $1,$. 1, - - - *f $ 82 --- POOF!! --- *s82 $82,$. 82, --- POOF!! --- *f $ 130 "THIS EXIT IS CLOSED. PLEASE LEAVE VIA MAIN OFFICE." *s130 $130,$. 130, "THIS EXIT IS CLOSED. PLEASE LEAVE VIA MAIN OFFICE." *eub [DSKB:TEXT.DAT[100,100,ADV2]] . .; Compare the original advent.dat with the changes for text.dat. .; Verify the editing results are correct. . .r filcom *tty:=adven.dat,text.dat File 1) DSKB:ADVEN.DAT[100,100,ADV2] created: 0325 16-Apr-91 File 2) DSKB:TEXT.DAT[100,100,ADV2] created: 1727 18-Jun-109 1)1 1 - - - 1) 1 THIS PROGRAM WAS ORIGINALLY DEVELOPED BY WILLIE CROWTHER. MOST OF THE **** 2)1 1, - - - 2) 1 THIS PROGRAM WAS ORIGINALLY DEVELOPED BY WILLIE CROWTHER. MOST OF THE ************** 1)1 82 --- POOF!! --- 1) 82 YOU ARE ENGULFED IN A CLOUD OF ORANGE SMOKE. COUGHING AND GASPI NG, **** 2)1 82, --- POOF!! --- 2) 82 YOU ARE ENGULFED IN A CLOUD OF ORANGE SMOKE. COUGHING AND GASPI NG, ************** 1)1 130 "THIS EXIT IS CLOSED. PLEASE LEAVE VIA MAIN OFFICE." 1) 131 IT LOOKS AS THOUGH YOU'RE DEAD. WELL, SEEING AS HOW IT'S SO CLO SE TO **** 2)1 130, "THIS EXIT IS CLOSED. PLEASE LEAVE VIA MAIN OFFICE." 2) 131 IT LOOKS AS THOUGH YOU'RE DEAD. WELL, SEEING AS HOW IT'S SO CLO SE TO ************** %files are different *^Z .dir ADVEN F4 102 <057> 16-Apr-91 DSKB: [100,100,ADV2] ADVN2 F4 32 <057> 16-Apr-91 ADVEN DAT 90 <057> 16-Apr-91 IFILE F4 1 <057> 18-Jun-09 TEXT DAT 90 <057> 18-Jun-09 Total of 315 blocks in 5 files on DSKB: [100,100,ADV2] .r fortra *adven=adven.f4 00074 LOGICAL TOTING,HERE,AT,BITSET,FORCED,DARK,PCT,WZDARK,LMWARN, %FTNSOD Line:00074 LOGICAL statement out of order 00075 1 CLOSNG,PANIC,CLOSED,GAVEUP,SCORNG,DEMO,YEA 00726 IF(TOTING(J))GOTO 6022 %FTNDIM Line:00726 Possible DO index modification inside loop 00727 6020 IF(HERE(J))K=1 %FTNDIM Line:00727 Possible DO index modification inside loop 00739 IF(AT(J).AND.FIXED(J).EQ.0)CALL CARRY(J,LOC) %FTNDIM Line:00739 Possible DO index modification inside loop %FTNDIM Line:00739 Possible DO index modification inside loop 00740 IF(TOTING(J))CALL DROP(J,CHLOC) %FTNDIM Line:00740 Possible DO index modification inside loop %FTNDIM Line:00740 Possible DO index modification inside loop 00846 IF(.NOT.BITSET(LOC,HINT))HINTLC(HINT)=-1 %FTNDIM Line:00846 Possible DO index modification inside loop 00861 2604 IF(TOTING(I).AND.PROP(I).LT.0)PROP(I)=-1-PROP(I) %FTNDIM Line:00861 Possible DO index modification inside loop 01479 IF(PLACE(OBJ).EQ.PLAC(DRAGON).OR.PLACE(OBJ).EQ.FIXD(DRAGON)) 01480 1 CALL MOVE(OBJ,K) %FTNDIM Line:01480 Possible DO index modification inside loop 01620 IF(I.EQ.BEAR.OR..NOT.TOTING(I))GOTO 8201 %FTNDIM Line:01620 Possible DO index modification inside loop 01623 CALL PSPEAK(I,-1) %FTNDIM Line:01623 Possible DO index modification inside loop 01935 11010 IF(TOTING(I))CALL DSTROY(I) %FTNDIM Line:01935 Possible DO index modification inside loop %FTNDIM Line:01935 Possible DO index modification inside loop %FTNWRN MAIN. No fatal errors and 14 warnings *advn2=advn2.f4 SPEAK PSPEAK RSPEAK MSPEAK GETIN YES YESM YESX A5TOA1 VOCAB DSTROY JUGGLE MOVE PUT CARRY DROP START MAINT WIZARD HOURS HOURSX NEWHRS 00024 5 NEWHRX=(NEWHRX.OR.SHIFT(1,I)) %FTNDIM Line:00024 Possible DO index modification inside loop %FTNWRN NEWHRX No fatal errors and 1 warning MOTD POOF SHIFT RAN DATIME CIAO BUG *ifile=ifile.f4 IFILE *^Z .r link *adven/save=adven,advn2,ifile/go EXIT .dir ADVEN F4 102 <057> 16-Apr-91 DSKB: [100,100,ADV2] ADVN2 F4 32 <057> 16-Apr-91 ADVEN DAT 90 <057> 16-Apr-91 IFILE F4 1 <057> 18-Jun-09 TEXT DAT 90 <057> 18-Jun-09 ADVEN REL 96 <057> 18-Jun-09 ADVN2 REL 52 <057> 18-Jun-09 IFILE REL 1 <057> 18-Jun-09 ADVEN EXE 104 <057> 18-Jun-09 Total of 568 blocks in 9 files on DSKB: [100,100,ADV2] .run adven INITIALISING... TABLE SPACE USED: 9626 OF 9650 WORDS OF MESSAGES 741 OF 750 TRAVEL OPTIONS 297 OF 300 VOCABULARY WORDS 140 OF 150 LOCATIONS 53 OF 100 OBJECTS 31 OF 35 ACTION VERBS 201 OF 205 RTEXT MESSAGES 10 OF 12 CLASS MESSAGES 9 OF 20 HINTS 32 OF 35 MAGIC MESSAGES PAUSE INIT DONE Type G to Continue, X to Exit, T To Trace. *x CPU time 0.06 Elapsed time 7.35 EXIT .save adven ADVEN saved .day Thursday 18-Jun-109 17:30:07 .run adven I'M TERRIBLY SORRY, BUT COLOSSAL CAVE IS CLOSED. OUR HOURS ARE: MON - FRI: 0:00 TO 8:00 18:00 TO 24:00 SAT - SUN: OPEN ALL DAY HOLIDAYS: OPEN ALL DAY ONLY WIZARDS ARE PERMITTED WITHIN THE CAVE RIGHT NOW. ARE YOU A WIZARD? no VERY WELL. WE DO ALLOW VISITORS TO MAKE SHORT EXPLORATIONS DURING OUR OFF HOURS. WOULD YOU LIKE TO DO THAT? yes VERY WELL. WELCOME TO ADVENTURE!! WOULD YOU LIKE INSTRUCTIONS? yes SOMEWHERE NEARBY IS COLOSSAL CAVE, WHERE OTHERS HAVE FOUND FORTUNES IN TREASURE AND GOLD, THOUGH IT IS RUMORED THAT SOME WHO ENTER ARE NEVER SEEN AGAIN. MAGIC IS SAID TO WORK IN THE CAVE. I WILL BE YOUR EYES AND HANDS. DIRECT ME WITH COMMANDS OF 1 OR 2 WORDS. I SHOULD WARN YOU THAT I LOOK AT ONLY THE FIRST FIVE LETTERS OF EACH WORD, SO YOU'LL HAVE TO ENTER "NORTHEAST" AS "NE" TO DISTINGUISH IT FROM "NORTH". (SHOULD YOU GET STUCK, TYPE "HELP" FOR SOME GENERAL HINTS. FOR INFOR- MATION ON HOW TO END YOUR ADVENTURE, ETC., TYPE "INFO".) - - - THIS PROGRAM WAS ORIGINALLY DEVELOPED BY WILLIE CROWTHER. MOST OF THE FEATURES OF THE CURRENT PROGRAM WERE ADDED BY DON WOODS (DON @ SU-AI). CONTACT DON IF YOU HAVE ANY QUESTIONS, COMMENTS, ETC. 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. magic mode ARE YOU A WIZARD? yes PROVE IT! SAY THE MAGIC WORD! dwarf THAT IS NOT WHAT I THOUGHT IT WAS. DO YOU KNOW WHAT I THOUGHT IT WAS? no TUPRI bijkl OH DEAR, YOU REALLY *ARE* A WIZARD! SORRY TO HAVE BOTHERED YOU . . . DO YOU WISH TO SEE THE HOURS? yes MON - FRI: 0:00 TO 8:00 18:00 TO 24:00 SAT - SUN: OPEN ALL DAY HOLIDAYS: OPEN ALL DAY DO YOU WISH TO CHANGE THE HOURS? yes NEW HOURS SPECIFIED BY DEFINING "PRIME TIME". GIVE ONLY THE HOUR (E.G. 14, NOT 14:00 OR 2PM). ENTER A NEGATIVE NUMBER AFTER LAST PAIR. PRIME TIME ON WEEKDAYS: FROM: -1 PRIME TIME ON WEEKENDS: FROM: -1 PRIME TIME ON HOLIDAYS: FROM: -1 NEW HOURS FOR COLOSSAL CAVE: MON - FRI: OPEN ALL DAY SAT - SUN: OPEN ALL DAY HOLIDAYS: OPEN ALL DAY DO YOU WISH TO (RE)SCHEDULE THE NEXT HOLIDAY? no LENGTH OF SHORT GAME (NULL TO LEAVE AT 30): NEW MAGIC WORD (NULL TO LEAVE UNCHANGED): NEW MAGIC NUMBER (NULL TO LEAVE UNCHANGED): LATENCY FOR RESTART (NULL TO LEAVE AT 90): DO YOU WISH TO CHANGE THE MESSAGE OF THE DAY? no OKAY. YOU CAN SAVE THIS VERSION NOW. BE SURE TO SAVE YOUR CORE-IMAGE... CPU time 0.05 Elapsed time 1:03.68 EXIT .save adven2 ADVEN2 saved .dir ADVEN F4 102 <057> 16-Apr-91 DSKB: [100,100,ADV2] ADVN2 F4 32 <057> 16-Apr-91 ADVEN DAT 90 <057> 16-Apr-91 IFILE F4 1 <057> 18-Jun-09 TEXT DAT 90 <057> 18-Jun-09 ADVEN REL 96 <057> 18-Jun-09 ADVN2 REL 52 <057> 18-Jun-09 IFILE REL 1 <057> 18-Jun-09 ADVEN EXE 320 <057> 18-Jun-09 ADVEN2 EXE 312 <057> 18-Jun-09 Total of 1096 blocks in 10 files on DSKB: [100,100,ADV2] .kjob Job 3 User USER [100,100] Logged-off TTY0 at 17:31:53 on 18-Jun-109 Runtime: 0:00:00, KCS:17, Connect time: 0:08:17 Disk Reads:1459, Writes:1268, Blocks saved:2730 .kjob Line hangup Connection to localhost closed by foreign host. $ exit script done on Thu Jun 18 17:31:59 2009 Feb 2 2011 For magic mode, each letter of the challenge's response is based on the alphabetic distance in two neighboring letters from a five letter challenge, multiplied by a digit from a magic number, and adding a digit from the current time of day. Numeric values for letters are A=0, B=1, C=2, ..., and Z=25. The magic number is five digits and the time of day is also five digits in 0hhm0 format. Alphabetic distances are always positive absolute values and computed values over 25 are reduced modulo 26. The algorithm associates each digit in the magic number and the time of day number, in right to left order, with each successive letter (left to right) in the challenge and response. In the example above, the time of day is Thursday 18-Jun-109 17:30:07 and its numeric representation is 01730. The default magic number is 11111. Given the random challenge "TUPRI", the response computation is as follows: challenge: TUPRI time: 01730 magic number: 11111 "T" - "U" 1 * 1 + 0 mod 26 = 1 "B" "U" - "P" 5 * 1 + 3 mod 26 = 8 "I" "P" - "R" 2 * 1 + 7 mod 26 = 9 "J" "R" - "I" 9 * 1 + 1 mod 26 = 10 "K" "I" - "T" 11 * 1 + 0 mod 26 = 11 "L" response: BIJKL The response to the challenge is valid for up to 10 minutes, since the algorithm always sets zero as the least significant digit in the number representing the time of day.