10 REM* WUMPUS II from Lawrence Hall of Science 20 REM* Transfered to SOL EBASIC by David Fox 30 REM* MARIN COMPUTER CENTER 35 REM* COPYRIGHT BY CREATIVE COMPUTING 40 DIM I$(6),L(6),M(6),P(5),S(20,3) 50 PRINT "&K": CURSOR 6,6 60 PRINT "* * * T H E G A M E O F W U M P U S II * * *" 70 CURSOR 15,0: INPUT ,(1,0)"Would you like instructions? ",Z$ 80 IF Z$="N" THEN 110 90 IF Z$<>"Y" THEN 70 100 LET F3=1: GOSUB 2570 110 REM* CHOOSE AND SET UP CAVE 120 GOSUB 1880: LET F3=1 130 DEF FNA(X)=INT(20*RND(0))+1 140 DEF FNB(X)=INT(3*RND(0))+1 150 DEF FNC(X)=INT(4*RND(0))+1 160 REM* LOCATE L ARRAY ITEMS 170 REM* 1=YOU,2=WUMPUS,3&4=PITS,5&6=BATS 180 FOR J=1 TO 6 190 LET L(J)=FNA(0) 200 LET M(J)=L(J) 210 NEXT J 220 REM* CHECK FOR CROSSOVERS (IE L(1)=L(2),ETC) 230 FOR J=1 TO 6 240 FOR K=J TO 6 250 IF J=K THEN 270 260 IF L(J)=L(K) THEN EXIT 180 270 NEXT K 280 NEXT J 290 REM* SET # ARROWS 300 LET A=5 310 LET L=L(1) 320 REM* RUN THE GAME 330 REM* HAZARD WARNINGS & LOCATION 340 GOSUB 650 350 REM* MOVE OR SHOOT 360 GOSUB 820 370 ON OGOTO 390430 380 REM* SHOOT 390 GOSUB 910 400 IF F=0 THEN 360 410 GOTO 450 420 REM* MOVE 430 GOSUB 1470 440 IF F=0 THEN 340 450 IF F>0 THEN 500 460 REM* LOSE 470 PRINT "HA HA HA - YOU LOSE! "; 480 GOTO 520 490 REM* WIN 500 PRINT "HEE HEE HEE - THE WUMPUS'LL GETCHA NEXT TIME!!" 510 PRINT 520 FOR J=1 TO 6 530 LET L(J)=M(J) 540 NEXT J 550 INPUT (1,0)"Play again? ",I$: PRINT "&K" 560 IF I$<>"Y" THEN 2290 570 PRINT 580 INPUT (1,0)"Same set-up? ",I$ 590 PRINT 600 IF I$="Y" THEN 300 610 INPUT (1,0)"Same cave? ",I$ 620 PRINT 630 IF I$="Y" THEN 180 640 GOTO 110 650 REM* PRINT LOCATION & HAZARD WARNINGS 660 PRINT 670 FOR J=2 TO 6 680 FOR K=1 TO 3 690 IF S(L(1),K)<>L(J) THEN 760 700 ON J-1GOTO 710730730750750 710 PRINT "I SMELL A WUMPUS!" 720 GOTO 760 730 PRINT "I FEEL A DRAFT" 740 GOTO 760 750 PRINT "BATS NEARBY!" 760 NEXT K 770 NEXT J 780 PRINT "You are in room";L(1); 790 PRINT " Tunnels lead to";S(L,1);",";S(L,2);" and";S(L,3) 800 PRINT 810 RETURN 820 REM* CHOSE OPTION 830 INPUT (1,0)"Shoot or Move? ",I$ 840 PRINT 850 IF I$<>"S" THEN 880 860 LET O=1 870 RETURN 880 IF I$<>"M" THEN 830 890 LET O=2 900 RETURN 910 REM* ARROW ROUTINE 920 LET F=0 930 REM* PATH OF ARROW 940 INPUT (1,0)"Number of rooms? ",J9 950 PRINT 960 IF J9<1 THEN 940 970 IF J9>5 THEN 940 980 FOR K=1 TO J9 990 INPUT (2,0)"Room #",P(K) 1000 IF P(K)>0 THEN IF P(K)<21 THEN 1030 1010 PRINT " Enter room numbers from 1 to 20 only." 1020 GOTO 990 1030 PRINT " "; 1040 NEXT K 1050 PRINT 1060 REM* SHOOT ARROW 1070 LET A=A-1 1080 LET A9=L(1) 1090 FOR K=1 TO J9 1100 LET F1=0 1110 FOR K1=1 TO 3 1120 IF S(A9,K1)=P(K) THEN LET F1=1 1130 NEXT K1 1140 IF F1=1 THEN 1180 1150 REM* NO TUNNEL FOR ARROW 1160 LET A9=S(A9,FNB(1)) 1170 LET F1=2 1180 ON F1GOSUB 13001310 1190 IF ABS(F)=1 THEN EXIT 1280 1200 NEXT K 1210 PRINT "MISSED" 1220 PRINT 1230 REM* MOVE WUMPUS 1240 GOSUB 1390 1250 REM* AMMO CHECK 1260 IF A>0 THEN 1280 1270 LET F=-1 1280 RETURN 1290 REM* SEE IF ARROW IS AT L(1) OR L(2) 1300 LET A9=P(K) 1310 IF A9<>L(2) THEN 1360 1320 PRINT "AHA! YOU GOT THE WUMPUS!! He was in room";L(2) 1330 PRINT 1340 LET F=1 1350 RETURN 1360 IF A9<>L(1) THEN RETURN 1370 PRINT "OUCH! ARROW GOT YOU!!" 1380 GOTO 1270 1390 REM* MOVE WUMPUS ROUTINE 1400 LET K=FNC(0) 1410 IF K=4 THEN 1460 1420 LET L(2)=S(L(2),K) 1430 IF L(2)<>L THEN 1460 1440 PRINT "TSK TSK TSK - THE WUMPUS GOT YOU!": PRINT 1450 LET F=-1 1460 RETURN 1470 REM* MOVE ROUTINE 1480 LET F=0 1490 INPUT (2,0)"Where to? ",L 1500 PRINT 1510 IF L<1 THEN 1490 1520 IF L>20 THEN 1490 1530 FOR K=1 TO 3 1540 REM* CHECK IF LEGAL MOVE 1550 IF S(L(1),K)=L THEN 1610 1560 NEXT K 1570 IF L=L(1) THEN 1610 1580 PRINT "Not possible - "; 1590 GOTO 1490 1600 REM* CHECK FOR HAZARDS 1610 LET L(1)=L 1620 REM* WUMPUS 1630 IF L<>L(2) THEN 1700 1640 PRINT "... OOPS! BUMPED A WUMPUS!" 1650 REM* MOVE WUMPUS 1660 GOSUB 1400 1670 IF F=0 THEN 1700 1680 RETURN 1690 REM* PIT 1700 IF L<>L(3) THEN IF L<>L(4) THEN 1820 1710 PRINT "&K": SET DS=12 1720 CURSOR 0,0: PRINT "YYY": SET DS=10: PRINT " Y" 1730 SET DS=9: PRINT " Y": SET DS=8 1740 PRINT " Y": SET DS=7: PRINT " Y" 1750 PRINT TAB(11);"I";: SET DS=0: PRINT TAB(30);"FELL IN A PIT!!" 1760 FOR I=1 TO 4: SET DS=7-I: PRINT TAB(11);"I": NEXT 1770 FOR I=1 TO 2: SET DS=3-I: PRINT TAB(11);"E": NEXT 1780 FOR I=1 TO 18: PRINT TAB(11);".": NEXT : SET DS=0 1790 LET F=-1 1800 RETURN 1810 REM* BATS 1820 IF L<>L(5) THEN IF L<>L(6) THEN 1870 1830 PRINT "ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!" 1840 PAUSE 10 1850 LET L=FNA(1) 1860 GOTO 1610 1870 RETURN 1880 REM* SELECT CAVE 1890 IF F3=1 THEN 1920 1900 CURSOR 15,0: PRINT " "; 1910 CURSOR 15,5 1920 INPUT ,(1,0)"Cave #(0-6)? ",N 1930 IF N>=0 AND N<=6 THEN 1960 1940 IF F3=1 THEN PRINT 1950 GOTO 1890 1960 PRINT "&K" 1970 IF N=6 THEN 2050 1980 RESTORE 1990 IF N=0 THEN 2030 2000 FOR X9=1 TO N*60 2010 READ I9 2020 NEXT X9 2030 GOSUB 2220 2040 GOTO 2060 2050 GOSUB 2070 2060 RETURN 2070 REM* INPUT OWN CAVE 2080 FOR J=1 TO 20 2090 PRINT "Room #";J; 2100 INPUT ," is connected to: ",S(J,1) 2110 INPUT ,", ",S(J,2): INPUT " and ",S(J,3) 2120 PRINT 2130 LET F5=0 2140 FOR K=1 TO 3 2150 IF S(J,K)>0 THEN IF S(J,K)<21 THEN 2180 2160 PRINT "ERROR** Enter room numbers from 1 to 20 only!!" 2170 LET F5=1 2180 NEXT K 2190 IF F5=1 THEN 2090 2200 NEXT J 2210 RETURN 2220 REM* INPUT CAVE 2230 FOR J=1 TO 20 2240 FOR K=1 TO 3 2250 READ S(J,K) 2260 NEXT K 2270 NEXT J 2280 RETURN 2290 CURSOR 6,17: PRINT "Thank you for playing with me!" 2300 CURSOR 9,10: PRINT "To play again, type `RUN' and press `RETURN'" 2310 CURSOR 14,0: END 2320 REM* DODECAHEDRON 2330 DATA 2,5,8,1,3,10,2,4,12,3,5,14,1,4,6,5,7,15,6,8,17,1 2340 DATA 7,9,8,10,18,2,9,11,10,12,19,3,11,13,12,14,20,4,13 2350 DATA 15,6,14,16,15,17,20,7,16,18,9,17,19,11,18,20,13,16,19 2360 REM* MOBIUS STRIP 2370 DATA 20,2,3,19,1,4,1,4,5,2,3,6,3,6,7,4,5,8,5,8,9,6,7 2380 DATA 10,7,10,11,8,9,12,9,12,13,10,11,14,11,14,15,12,13 2390 DATA 16,12,16,17,14,15,18,15,18,19,16,17,20,2,17,20,1,18,19 2400 REM* STRING OF BEADS 2410 DATA 2,3,20,1,3,4,1,2,4,2,3,5,4,6,7,5,7,8,5,6,8,6,7 2420 DATA 9,8,10,11,9,11,12,9,10,12,10,11,13,12,14,15,13,15,1 2430 DATA 6,13,14,16,14,15,17,16,18,19,17,19,20,17,18,20,1,18,19 2440 REM* HEX NETWORK 2450 DATA 6,10,16,6,7,17,7,8,18,8,9,19,9,10,20,1,2,15,2,3,1 2460 DATA 1,3,4,12,4,5,13,1,5,14,7,16,20,8,16,17,9,17,18,10 2470 DATA 18,19,6,19,20,1,11,12,2,12,13,3,13,14,4,14,15,5,11,15 2480 REM* DENDRITE W/ DEGENERACIES 2490 DATA 1,1,5,2,2,5,3,3,6,4,4,6,1,2,7,3,4,7,5,6,10,8,9 2500 DATA 9,8,8,10,7,9,11,10,13,14,12,13,13,11,12,12,11,15,16 2510 DATA 14,17,18,14,19,20,15,17,17,15,18,18,16,19,19,16,20,20 2520 REM* ONE WAY LATTICE 2530 DATA 5,4,8,1,5,6,2,6,7,3,7,8,8,9,12,5,9,10,6,10,11,7 2540 DATA 11,12,12,13,16,9,13,14,10,14,15,11,15,16,16,17,20,13 2550 DATA 17,18,14,18,19,15,19,20,1,4,20,1,2,17,2,3,18,3,4,19 2560 REM* INSTRUCTIONS 2570 PRINT "&K" 2580 PRINT " The Wumpus lives in a cave of 20 rooms. Each room has 3" 2590 PRINT "tunnels leading to other rooms.": PRINT : PRINT "HAZARDS:" 2600 PRINT : PRINT "BOTTOMLESS PITS - Two rooms have Bottomless Pits in them. If" 2610 PRINT "you go there, you fall into the pit and lose!": PRINT 2620 PRINT "SUPER BATS - Two other rooms have Super Bats. If you go there," 2630 PRINT "a bat will grab you and take you away to somewhere else in the" 2640 PRINT "cave where you could run into the...": GOSUB 3400 2650 PRINT "WUMPUS:": PRINT 2660 PRINT "The Wumpus is not bothered by the hazards (he has sucker feet" 2670 PRINT "and is too big to lift). Usually he is asleep. Two things" 2680 PRINT "wake him up: your entering his room or your shooting an arrow." 2690 PRINT "If the Wumpus wakes, he might move one room or stay still." 2700 PRINT "But if he is where you are, he eats you up and you lose!" 2710 PRINT : PRINT "YOU:": PRINT 2720 PRINT "Each turn you may Move or you may Shoot a crooked arrow." 2730 PRINT "MOVING: you can go one room (thru one tunnel)." 2740 GOSUB 3400 2750 PRINT "SHOOTING: you have 5 arrows. You lose when you run out." 2760 PRINT " Each arrow can go from 1 to 5 rooms. You aim by telling the" 2770 PRINT " computer, first, the number of rooms you wish the arrow to" 2780 PRINT " travel thru and, second, the room numbers in their order of" 2790 PRINT " occurrence.": PRINT 2800 PRINT " Example: You are in room 2; tunnels lead to rooms 1, 3 and 10" 2810 PRINT " and you think the Wumpus is in one of them. You choose to" 2820 PRINT " shoot an arrow thru four rooms. When the computer asks" 2830 PRINT " `Number of rooms?', you type 4. Then the computer will say" 2840 PRINT " `Room #'. You then type the room number. Continue this" 2850 PRINT " process until 4 rooms have been entered.": GOSUB 3400 2860 PRINT " Note: The first room in the sequence must be an adjoining" 2870 PRINT " room, that is, one that has a tunnel connecting it with the" 2880 PRINT " room you are in, each succeeding room must also be connected" 2890 PRINT " to the previous room by a tunnel. If there is no connecting" 2900 PRINT " tunnel between two particular rooms you specify, the arrow" 2910 PRINT " randomly chooses one of the three tunnels from the room it" 2920 PRINT " is in and goes its own way until it has traveled four rooms." 2930 PRINT : PRINT "If the arrow hits the Wumpus, you win." 2940 PRINT "If the arrow hits you, you lose." 2950 GOSUB 3400: PRINT : PRINT "WARNINGS:": PRINT 2960 PRINT "When you move to within one room of the Wumpus or a Hazard," 2970 PRINT "the computer says:": PRINT : PRINT "WUMPUS - `I SMELL A WUMPUS'" 2980 PRINT "BAT - `BATS NEARBY'": PRINT "PIT - `I FEEL A DRAFT'": PRINT 2990 PRINT "BE CAREFUL! The Wumpus may sneak up on you!!" 3000 CURSOR 14,4: INPUT (1,0)"Would you like the description of the caves? ",Z$ 3010 GOSUB 3410 3020 IF Z$="N" THEN CURSOR 6,0: GOTO 3370 3030 PRINT "THE CAVES ARE:": PRINT 3040 PRINT "0 - DODECAHEDRON: The rooms of this cave are on a 12-sided" 3050 PRINT " object, each side forming a pentagon. The rooms are at the" 3060 PRINT " corners of the pentagons, each room having tunnels leading" 3070 PRINT " to 3 other rooms.": PRINT 3080 PRINT "1 - MOBIUS STRIP: This cave is two rooms wide and 10 rooms" 3090 PRINT " around (like a belt). You will notice there is a half-" 3100 PRINT " twist somewheres.": PRINT 3110 PRINT "2 - STRING OF BEADS: Five beads in a circle. Each bead is a" 3120 PRINT " diamond with a vertical cross-bar. The right and left" 3130 PRINT " corners lead to neighboring beads. (This one is difficult" 3140 PRINT " to play).": GOSUB 3400 3150 PRINT "3 - HEX NETWORK: Imagine a hex tile floor. Take a rectangle" 3160 PRINT " with 20 points (intersections) inside (4X5). Join right" 3170 PRINT " and left sides to make a cylinder. Then join top and bot-" 3180 PRINT " tom to form a torus (doughnut)." 3190 PRINT " Have fun imagining this one!": PRINT 3200 PRINT "Caves 0-3 are regular in the sense that each room goes to three" 3210 PRINT "other rooms and the tunnels allow two-way traffic." 3220 PRINT "Here are some irregular caves:": PRINT 3230 PRINT "4 - DENDRITE WITH DEGENERACIES: Pull a plant from the ground." 3240 PRINT " The roots and branches form a dendrite - ie, there are no" 3250 PRINT " looping paths. Degeneracy means A) some rooms connect to" 3260 PRINT " themselves or B) that two rooms have more than one tunnel" 3270 PRINT " between them ie, 12 has two tunnels to 13." 3280 GOSUB 3400 3290 PRINT "5 - ONE WAY LATTICE: Here all tunnels go one way only. To" 3300 PRINT " return, you must go around the cave (about 5 moves).": PRINT 3310 PRINT "6 - ENTER YOUR OWN CAVE: The computer will ask you for the" 3320 PRINT " rooms next to each room in the cave.": PRINT 3330 PRINT " For Example:": PRINT 3340 PRINT " To set Room #1 up with tunnels going to rooms 2, 3 and 4" 3350 PRINT " type `2' (RETURN) `3' (RETURN) `4' (RETURN) when prompted" 3360 PRINT " with `Room #1'" 3370 PRINT : PRINT TAB(24);"HAPPY HUNTING!!!" 3380 PRINT TAB(27);">>>---^--->" 3390 GOSUB 3400: RETURN 3400 CURSOR 15,20: INPUT "Press `RETURN' to continue ",Z$ 3410 PRINT "&K": CURSOR 0,0: RETURN