1 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
5 REM *** HUNT THE WUMPUS ***
10 DIM P(5)
15 PRINT "DO YOU WANT INSTRUCTIONS"
20 INPUT "(Type 0 for NO)";I
22 PRINT:PRINT:PRINT
25 IF I=0 THEN 35
30 GOSUB 375
35 GOTO 80
80 REM *** SET UP CAVE (DODECAHEDRAL NODE LIST) ***
85 DIM S(20,3)
90 FOR J=1 TO 20
95 FOR K=1 TO 3
100 READ S(J,K)
105 NEXT K
110 NEXT J
115 DATA 2,5,8,1,3,10,2,4,12,3,5,14,1,4,6
120 DATA 5,7,15,6,8,17,1,7,9,8,10,18,2,9,11
125 DATA 10,12,19,3,11,13,12,14,20,4,13,15,6,14,16
130 DATA 15,17,20,7,16,18,9,17,19,11,18,20,13,16,19
135 DEF FNA(X)=INT(20*RND(1))+1
140 DEF FNB(X)=INT(3*RND(1))+1
145 DEF FNC(X)=INT(4*RND(1))+1
150 REM *** LOCATE L ARRAY ITEMS ***
155 REM *** 1-YOU, 2-WUMPUS, 3&4-PITS, 5&6-BATS ***
160 DIM L(6)
165 DIM M(6)
170 FOR J=1 TO 6
175 L(J)=FNA(0)
180 M(J)=L(J)
185 NEXT J
190 REM *** CHECK FOR CROSSOVERS (IE L(1)=L(2), ETC) ***
195 FOR J=1 TO 6
200 FOR K=1 TO 6
205 IF J=K THEN 215
210 IF L(J)=L(K) THEN 170
215 NEXT K
220 NEXT J
225 REM *** SET NO. OF ARROWS ***
230 A=5
235 L=L(1)
240 REM *** RUN THE GAME ***
245 PRINT:PRINT:PRINT "HUNT THE WUMPUS"
250 REM *** HAZARD WARNING AND LOCATION ***
255 GOSUB 585
260 REM *** MOVE OR SHOOT ***
265 GOSUB 670
270 ON O GOTO 280,300
275 REM *** SHOOT ***
280 GOSUB 715
285 IF F=0 THEN 255
290 GOTO 310
295 REM *** MOVE ***
300 GOSUB 975
305 IF F=0 THEN 255
310 IF F>0 THEN 335
315 REM *** LOSE ***
320 PRINT:PRINT "HA HA HA - YOU LOSE!"
325 GOTO 340
330 REM *** MOVE ***
335 PRINT:PRINT "HEE HEE HEE - THE WUMPUS'LL GET YOU NEXT TIME!!"
340 FOR J=1 TO 6
345 L(J)=M(J)
350 NEXT J
355 PRINT:PRINT:PRINT "DO YOU WANT TO PLAY AGAIN"
357 INPUT "(Type 1 for YES)";F
359 IF F<>1 THEN 1150
360 PRINT:PRINT "DO YOU WANT THE SAME SETUP"
362 INPUT "(Type 1 for YES)";I
365 IF I<>1 THEN 170
370 GOTO 230
375 REM *** INSTRUCTIONS ***
380 PRINT "WELCOME TO 'HUNT THE WUMPUS'"
385 PRINT "  THE WUMPUS LIVES IN A CAVE OF 20 ROOMS. EACH ROOM"
390 PRINT "HAS 3 TUNNELS LEADING TO OTHER ROOMS. (LOOK AT A"
395 PRINT "DODECAHEDRON TO SEE HOW THIS WORKS-IF YOU DON'T KNOW"
400 PRINT "WHAT A DODECAHEDRON IS, ASK SOMEONE)"
405 PRINT
410 PRINT "     HAZARDS:"
415 PRINT " BOTTOMLESS PITS - TWO ROOMS HAVE BOTTOMLESS PITS IN THEM
420 PRINT "     IF YOU GO THERE, YOU FALL INTO THE PIT (& LOSE!)"
425 PRINT " SUPER BATS - TWO OTHER ROOMS HAVE SUPER BATS. IF YOU"
430 PRINT "     GO THERE, A BAT GRABS YOU AND TAKES YOU TO SOME OTHER"
435 PRINT "     ROOM AT RANDOM. (WHICH MAY BE TROUBLESOME)"
440 INPUT "TYPE <RETURN> TO CONTINUE ";W9
445 PRINT "     WUMPUS:"
450 PRINT " THE WUMPUS IS NOT BOTHERED BY HAZARDS (HE HAS SUCKER"
455 PRINT " FEET AND IS TOO BIG FOR A BAT TOO LIFT).  USUALLY"
460 PRINT " HE IS ASLEEP.  TWO THINGS WAKE HIM UP:YOU SHOOTING AN"
465 PRINT " ARROW OR YOU ENTERING HIS ROOM."
470 PRINT "     IF THE WUMPUS WAKES HE MOVES (P=.75) ONE ROOM"
475 PRINT " OR STAYS STILL (P=.25).  AFTER THAT, IF HE IS WHERE YOU"
480 PRINT " ARE, HE EATS YOU UP AND YOU LOSE!"
485 PRINT
490 PRINT "     YOU:"
495 PRINT " EACH TURN YOU MAY MOVE OR SHOOT A CROOKED ARROW"
500 PRINT "   MOVING:  YOU CAN MOVE ONE ROOM (THRU ONE TUNNEL)"
505 PRINT "   ARROWS:  YOU HAVE 5 ARROWS.  YOU LOSE WHEN YOU RUN OUT
510 PRINT "   EACH ARROW CAN GO FROM 1 TO 5 ROOMS. YOU AIM BY TELLIN
515 PRINT "   THE COMPUTER THE ROOM#S YOU WANT THE ARROW TO GO TO."
520 PRINT "   IF THE ARROW CAN'T GO THAT WAY (IF NO TUNNEL) IT MOVES"
525 PRINT "   AT RANDOM TO THE NEXT ROOM."
530 PRINT "     IF THE ARROW HITS THE WUMPUS, YOU WIN."
535 PRINT "     IF THE ARROW HITS YOU, YOU LOSE."
540 INPUT "TYPE <RETURN> TO CONTINUE ";W9
545 PRINT "    WARNINGS:"
550 PRINT "     WHEN YOU ARE ONE ROOM AWAY FROM A WUMPUS OR HAZARD,"
555 PRINT "     THE COMPUTER SAYS:"
560 PRINT " WUMPUS:  'I SMELL A WUMPUS'"
565 PRINT " BAT   :  'BATS NEARBY'"
570 PRINT " PIT   :  'I FEEL A DRAFT'"
575 PRINT
580 RETURN
585 REM *** PRINT LOCATION & HAZARD WARNINGS ***
590 PRINT
595 FOR J=2 TO 6
600 FOR K=1 TO 3
605 IF S(L(1),K)<>L(J) THEN 640
610 ON J-1 GOTO 615,625,625,635,635
615 PRINT "I SMELL A WUMPUS!"
620 GOTO 640
625 PRINT "I FEEL A DRAFT"
630 GOTO 640
635 PRINT "BATS NEARBY!"
640 NEXT K
645 NEXT J
650 PRINT "YOU ARE IN ROOM "L(1)
655 PRINT "TUNNELS LEAD TO "S(L,1);S(L,2);S(L,3)
660 PRINT
665 RETURN
670 REM *** CHOOSE OPTION ***
675 PRINT:PRINT "SHOOT OR MOVE "
680 INPUT "(Type 0 for SHOOT or 1 for MOVE)";I
685 IF I<>0 THEN 700
690 O=1
695 RETURN
700 IF I<>1 THEN 675
705 O=2
710 RETURN
715 REM *** ARROW ROUTINE ***
720 F=0
725 REM *** PATH OF ARROW ***
735 PRINT "NO. OF ROOMS (1-5)";
740 INPUT J9
745 IF J9<1 THEN 735
750 IF J9>5 THEN 735
755 FOR K=1 TO J9
760 PRINT "ROOM #";
765 INPUT P(K)
770 IF K<=2 THEN 790
775 IF P(K)<>P(K-2) THEN 790
780 PRINT "ARROWS AREN'T THAT CROOKED - TRY ANOTHER ROOM"
785 GOTO 760
790 NEXT K
795 REM *** SHOOT ARROW ***
800 L=L(1)
805 FOR K=1 TO J9
810 FOR K1=1 TO 3
815 IF S(L,K1)=P(K) THEN 895
820 NEXT K1
825 REM *** NO TUNNEL FOR ARROW ***
830 L=S(L,FNB(1))
835 GOTO 900
840 NEXT K
845 PRINT "MISSED"
850 L=L(1)
855 REM *** MOVE WUMPUS ***
860 GOSUB 935
865 REM *** AMMO CHECK ***
870 A=A-1
875 IF A>0 THEN 885
880 F=-1
885 RETURN
890 REM *** SEE IF ARROW IS AT L(1) OR AT L(2)
895 L=P(K)
900 IF L<>L(2) THEN 920
905 PRINT:PRINT "AHA! YOU GOT THE WUMPUS!"
910 F=1
915 RETURN
920 IF L<>L(1) THEN 840
925 PRINT:PRINT "OUCH! ARROW GOT YOU!"
930 GOTO 880
935 REM *** MOVE WUMPUS ROUTINE ***
940 K=FNC(0)
945 IF K=4 THEN 955
950 L(2)=S(L(2),K)
955 IF L(2)<>L THEN 970
960 PRINT:PRINT "TSK TSK TSK - WUMPUS GOT YOU!"
965 F=-1
970 RETURN
975 REM *** MOVE ROUTINE ***
980 F=0
985 PRINT "WHERE TO";
990 INPUT L
995 IF L<1 THEN 985
1000 IF L>20 THEN 985
1005 FOR K=1 TO 3
1010 REM *** CHECK IF LEGAL MOVE ***
1015 IF S(L(1),K)=L THEN 1045
1020 NEXT K
1025 IF L=L(1) THEN 1045
1030 PRINT "NOT POSSIBLE -";
1035 GOTO 985
1040 REM *** CHECK FOR HAZARDS ***
1045 L(1)=L
1050 REM *** WUMPUS ***
1055 IF L<>L(2) THEN 1090
1060 PRINT:PRINT "... OOPS! BUMPED A WUMPUS!"
1065 REM *** MOVE WUMPUS ***
1070 GOSUB 940
1075 IF F=0 THEN 1090
1080 RETURN
1085 REM *** PIT ***
1090 IF L=L(3) THEN 1100
1095 IF L<>L(4) THEN 1120
1100 PRINT:PRINT "YYYYIIIIEEEE . . . FELL IN PIT"
1105 F=-1
1110 RETURN
1115 REM *** BATS ***
1120 IF L=L(5) THEN 1130
1125 IF L<>L(6) THEN 1145
1130 PRINT:PRINT "ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!"
1135 L=FNA(1)
1140 GOTO 1045
1145 RETURN
1150 END
1145
1130 PRINT:PRINT "ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!"
1135 L=FNA(1)
1140 GOTO 1045
1145