!======================================== != Hunt the Wumpus = != Version 1.0 for Metal = != by Terry R. Olsen = != Date: October 18, 2002 = !======================================== ! 1 2 3 4 5 6 7 8 !234567890123456789012345678901234567890123456789012345678901234567890j1234567890 Enter Global ? "Do you want instructions? ";:get mode(1,"YN") x$ if x$="Y" then gosub Instructions !============================================ ! Set up the caves (Dodecahedral Node List) !============================================ SetupCaves open #1,"caves.dat" For j=1 to 20 for k=1 to 3 input #1,s(j,k) next next close #1 !============================================ ! Locate L Array Items ! 1-You, 2-Wumpus, 3&4-Pits, 5&6-Bats !============================================ Locate for j=1 to 6 l(j)=int(20*rnd(1))+1 m(j)=l(j) next !============================================ ! Check for crosswovers (ie. l(1)=l(2), etc) !============================================ for j=1 to 6 for k=1 to 6 if j=k then goto ]next if l(j)=l(k) then goto Locate ]next next next !============================================ ! Set number of arrows !============================================ a=5 l=l(1) !============================================ ! Run the game !============================================ clear vid ?" Hunt the Wumpus" gosub Warnings gosub MoveOrShoot on o gosub Shoot,Move !============================================ ! Shoot! This is the arrow routine !============================================ Shoot f=0 ?"Number of rooms for arrow to travel? ";:input (["12345"]) j9 for k=1 to j9 ]L ?"Room #";:input p(k) if k<=2 then goto ]next if p(k)<>P(k-2) then goto ]next ?"Arrows aren't that corrked - Try another room" goto ]L ]next next !============================================ ! Let the arrow fly! !============================================ l=l(1) for k=1 to j9 for k1=1 to 3 if s(l,k1)=p(k) then goto ]895 next !============================================ ! No Tunnel for arrow !============================================ l=s(l,int(3*rnd(1))+1) goto ]900 next ?"Missed!" l=l(1) !============================================ ! Move the Wumpus !============================================ k=int(4*rnd(1))+1 if k<>4 then l(2)=s(l(2),k) if l(2)<>l then goto ]done ?"TSK TSK TSK - The Wumpus got you!" f=-1 return !============================================ ! Choose to Move or Shoot !============================================ MoveOrShoot ?"(S)hoot or (M)ove: ";:get mode(1,"SM") x$ long if x$="S" then ?"Shoot":o=1 else ?"Move":o=2 end if return !============================================ ! Print Location & Hazard Warnings !============================================ Warnings ? for j=2 to 6 for k=1 to 3 if s(l(1),k)<>l(j) then goto ]next on j-1 gosub WarnWumpus,WarnPit,WarnPit,WarnBat,WarnBat ]next next next ?"You are in room ";l(1) ?"Tunnels lead to ";s(l,1);" ";s(l,2);" ";s(l,3) ? return WarnWumpus ?"I smell a Wumpus!" return WarnPit ?"I feel a draft" return WarnBat ?"Bats nearby!" return Instructions ?" Welcome to 'Hunt the Wumpus'. The Wumpus lives in a cave of 20 rooms. Each room has 3 tunnels leading to other rooms. (Look at a dodecahedron to see how this works. If you don't know what a dodecahedron is, ask someone!). These are the hazards: Bottomless Pits - Two room have bottomless pits in them. If you go there, you fall into the pit (and lose the game!). Super Bats - Two other rooms have super bats. If you go there, a bat grabs you and takes you to some other room at random (which may be troublesome). The Wumpus: The Wumpus is not bothered by hazards, he has sucker feet and is too big for a bat to lift. Usually he is asleep. Two things wake him up: you shooting an arrow or you entering his room. If the Wumpus wakes up, he either stays where he is, or moves one room. If he moves into the room where you are, he eats you and you lose! You: Each turn you may move or shoot a crooked arrow. Moving - You can move one room (through one tunnel) Arrows - You have 5 arrows. You lose when you run out. Each arrow can go from 1 to 5 rooms. You aim by telling the computer the room numbers you want the arrow to go to. If the arrow can't go that way (no tunnel), it moves at random to the next room. If the arrow hits the Wumpus, you win. If the arrow hits you, you lose. Warnings: When you are one room away from a Wumpus or hazard, the computer says: Wumpus: 'I smell a Wumpus' Bat: 'Bats nearby' Pit: 'I feel a draft' That's it. Have fun! Press a key to continue...";get x$ return