5 rem *** hunt the wumpus *** 10 dim p(5) 15 print "instructions (y-n)"; 20 input i$ 25 if i$="n" 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(0))+1 140 def fnb(x)=int(3*rnd(0))+1 145 def fnc(x)=int(4*rnd(0))+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 "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 "ha ha ha - you lose!" 325 goto 340 330 rem *** move *** 335 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 "same setup (y-n)"; 360 input i$ 365 if i$<>"y"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 an e then return ";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 " 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 you, you lose." 540 input "type an e then return ";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 "shoot or move (s-m)"; 680 input i$ 685 if i$<>"s" then 700 690 o=1 695 return 700 if i$<>"m" 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 "aha! you got the wumpus!" 910 f=1 915 return 920 if l<>l(1) then 840 925 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 "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 "... 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 "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 "zap--super bat snatch! elsewhereville for you!" 1135 l=fna(1) 1140 goto 1045 1145 return 1150 end