Treasure Hunt

Date: 198x
Type: Program
Platform(s): TS 1000

Appears on

Assembled by Tim Ward from many sources. Contains programs 10122 – 10175.

Gallery

Treasure Hunt

Source Code

   1 REM %T%R%E%A%S%U%R%E% %H%U%N%T
   5 DIM D(3,2)
   7 DIM T(20)
   8 LET Z$="YOU ARE IN THE ENTRANCE HALL"
  10 LET LR=0
  11 LET C$="% % % % % % % % % % % % "
  13 LET C$=C$+"\##\##\##\##"
  15 LET C$=C$+"% % % % % % % % % % % % % % "
  20 LET ARR=5
  25 FOR I=1 TO 20
  30 LET T(I)=1
  35 NEXT I
  37 LET PS=0
  40 LET S=0
  55 LET Q=PEEK 16396+256*PEEK 16397+1
  60 LET TR=0
  65 RAND 
  68 LET NOW=INT (RND*5000)
  70 LET B$="9BE9AF9DG9CHAHIBIJ"
  72 LET B$=B$+"CJKDEKEFLFGMGHN"
  74 LET B$=B$+"IOQJOPKPTLMRMNS"
  76 LET B$=B$+"LRTOQUPTUNQS9RS"
  80 LET R1=0
  82 LET R2=0
  84 LET R3=0
  95 GOTO 1300
 150 CLS 
 160 REM %C%A%V%E% %P%L%O%T
 162 RAND (PR*10+NOW)
 165 FOR I=0 TO 20
 170 LET IY=RND*16+2
 175 LET IX=RND*27+2
 180 PRINT AT IY,IX;"% ";
 185 IF RND>.5 THEN PRINT AT IY-1,IX-1;CHR$ (128-RND*2);
 190 PRINT AT IY,IX+1;"\:.";
 195 PRINT AT IY+1,IX;CHR$ (128+RND*2);
 200 IF RND>.6 THEN PRINT AT IY+1,IX+1;CHR$ 130;
 205 PRINT AT I,0;"% ";AT I,31;"% ";
 210 NEXT I
 212 PRINT AT 0,1;C$;AT 20,1;C$;
 214 PRINT AT 0,17;R1;AT 20,17;R2
 215 LET N=11
 220 LET M=1
 222 IF T(PR)=1 THEN PRINT AT IY,IX+1;"*";
 224 LET T(PR)=0
 225 REM %D%E%M%O%N% %P%L%O%T
 230 LET DEM=INT (RND*4)
 235 FOR I=1 TO DEM
 240 LET D(I,1)=INT (RND*19+1)
 245 LET D(I,2)=INT (RND*30+1)
 250 PRINT AT D(I,1),D(I,2);"%M";
 255 NEXT I
 265 REM %H%E%R%O% %R%U%N
 275 PRINT AT N,M;"X";
 280 IF INKEY$<>"F" THEN GOTO 300
 285 IF ARR=0 THEN GOTO 300
 290 LET ARR=ARR-1
 295 GOSUB 1000
 298 PRINT AT 21,0;"ARROWS:";ARR;
 300 LET N1=N
 305 LET M1=M
 310 LET M=M+(1 AND INKEY$="8")-(1 AND INKEY$="5")
 315 LET N=N+(1 AND INKEY$="6")-(1 AND INKEY$="7")
 320 LET Q1=PEEK (Q+33*N+M)
 325 IF Q1>62 THEN GOTO 2000
 330 IF Q1=23 AND TR<50 THEN LET TR=TR+10
 335 IF Q1=8 THEN GOTO 300
 338 IF ABS (10-N)=10 THEN GOTO 2000
 339 IF PR=21 THEN GOTO 355
 340 IF DEM=0 AND RND<.03 THEN LET DEM=1
 342 IF RND<.3+TR/200 THEN GOSUB 1200
 345 PRINT AT N1,M1;" ";
 350 GOTO 265
 355 GOSUB 3000
 360 GOTO 345
 605 CLS 
 800 REM %R%O%O%M% %S%W%I%T%C%H
 810 LET LR=PR
 812 IF PR<>21 THEN GOTO 815
 813 LET PR=INT (RND*19+1)
 814 GOTO 825
 815 IF N=0 THEN LET PR=R1
 820 IF N=20 THEN LET PR=R2
 822 IF PR=0 THEN GOTO 1505
 825 PRINT AT 3,2;"YOU ARE IN THE TUNNEL"
 830 PRINT AT 5,2;"BETWEEN ";LR;" AND ";PR
 835 PRINT AT 8,2;"YOU HAVE ";ARR;" ARROWS";
 840 PRINT AT 11,2;"YOUR SCORE IS ";TR+S
 915 IF PR=21 THEN GOTO 2050
 920 LET R$=B$(PR*3-2)
 925 LET R1=CODE (R$)-37
 930 LET R$=B$(PR*3-1)
 935 LET R2=CODE (R$)-37
 940 LET R$=B$(PR*3)
 945 LET R3=CODE (R$)-37
 960 IF R1=LR THEN LET R1=R3
 965 IF R2=LR THEN LET R2=R3
 970 GOTO 150
1000 REM %F%I%R%E
1003 IF PR=21 THEN GOSUB 3000
1005 IF RND<.5 THEN GOSUB 1200
1010 LET F$=INKEY$
1015 IF F$="" OR F$="F" THEN GOTO 1000
1020 LET Y1=N
1025 LET X1=M
1030 LET MY=0+(1 AND F$="6")-(1 AND F$="7")
1035 LET MX=0+(1 AND F$="8")-(1 AND F$="5")
1040 LET X1=X1+MX
1045 LET Y1=Y1+MY
1050 IF ABS (15-X1)=15 OR ABS (10-Y1)=10 THEN GOTO 1125
1053 IF PEEK (Q+33*Y1+X1)<>0 THEN GOTO 1070
1055 PRINT AT Y1,X1;"+";
1060 PRINT AT Y1,X1;" ";
1065 GOTO 1040
1070 LET DHIT=DEM
1075 FOR I=1 TO DHIT
1080 LET Y=D(I,1)
1085 LET X=D(I,2)
1090 IF X<>X1 OR Y<>Y1 THEN GOTO 1115
1095 PRINT AT Y1,X1;"%+";
1096 LET S=S+5
1100 LET D(I,1)=D(DEM,1)
1105 LET D(I,2)=D(DEM,2)
1110 LET DEM=DEM-1
1115 NEXT I
1117 IF PR=21 THEN LET FX=X1
1118 IF PR=21 THEN LET FY=Y1
1120 PRINT AT Y1,X1;" ";
1125 RETURN 
1200 REM %D%E%M%O%N% %R%U%N
1201 FOR I=1 TO DEM
1205 LET X=D(I,2)
1210 LET Y=D(I,1)
1215 PRINT AT Y,X;" ";
1220 LET Y=Y+SGN (N-Y)
1225 LET X=X+SGN (M-X)
1235 PRINT AT Y,X;"%M";
1238 IF X=M AND Y=N THEN GOTO 2000
1240 LET D(I,1)=Y
1245 LET D(I,2)=X
1250 NEXT I
1255 RETURN 
1295 REM %S%T%A%R%T
1300 PRINT "   THIS IS TREASURE-HUNT",,,
1305 PRINT "  YOU ARE IN A NETWORK OF CAVES.",,
1310 PRINT "YOU ARE LOOKING FOR GOLD.",,,
1315 PRINT "IF YOU ARE CAREFUL YOU MAY REACH",,
1320 PRINT "THE TREASURE ROOM, BUT BEWARE:",,,
1325 PRINT "THERE ARE MONSTERS WHICH WILL",,,
1330 PRINT "EAT YOU: EVEN TO TOUCH THE ROCKS",,
1335 PRINT "MEANS INSTANT DEATH.",,,,,
1340 PRINT Z$,,,
1342 PRINT "CHOOSE CAVE 1,2,3,OR 4?",,
1345 INPUT PR
1350 IF PR<1 OR PR>4 THEN GOTO 1345
1360 LET LR=0
1500 GOTO 915
1505 PRINT Z$,,,
1510 PRINT "YOUR TREASURE IS SAFE HERE,",,,
1515 PRINT "YOUR SCORE IS ";S+TR,,,,
1518 PRINT TAB 0;"YOU HAVE ";ARR;" ARROWS.",,,,
1520 PRINT TAB 0;"ARE YOU GOING BACK IN?",,,,,
1525 INPUT F$
1530 IF F$="NO" THEN PRINT "YOU SCORED ";S+TR
1535 IF F$="NO" THEN STOP 
1540 LET S=S+TR
1545 LET TR=0
1550 PRINT "HOW MANY ARROWS DO YOU WANT?",,,
1560 PRINT "THEY ARE 4 POINTS EACH",,,
1570 INPUT F
1580 IF F*4>S THEN GOTO 1650
1590 LET S=S-F*4
1600 LET ARR=ARR+F
1610 GOTO 1342
1650 CLS 
1655 PRINT "  YOU CANT AFFORD THEM",,,
1660 GOTO 1550
2000 REM %D%E%A%T%H% %O%F% %A% %H%E%R%O
2005 CLS 
2010 PRINT AT 5,1;"UNFORTUNATELY YOU HAVE PERISHED"
2015 PRINT AT 8,1;"YOU SCORED: ";S+TR
2018 PRINT 
2019 PRINT 
2020 IF S+TR<50+PS THEN STOP 
2025 LET S=S-15
2028 LET PS=S+TR
2029 PRINT "YOU PLAYED WELL:",,,
2030 PRINT "I SHALL DEDUCT 15"
2031 PRINT 
2032 PRINT "FOR DAMAGE TO THE BODY";
2033 PRINT 
2034 PRINT 
2035 PRINT "YOU MAY CONTINUE";
2036 FOR I=1 TO 50
2037 NEXT I
2038 CLS 
2040 GOTO 1505
2045 REM %T%R%E%A%S%U%R%E% %R%O%O%M
2050 PRINT AT 0,0;
2052 CLS 
2055 FOR I=-10 TO 10
2058 LET AI=ABS I
2060 PRINT TAB 0;C$( TO AI);
2065 PRINT TAB (30-AI);C$( TO AI)
2070 NEXT I
2075 PRINT AT 0,10;C$( TO 10)
2080 PRINT AT 20,10;C$( TO 10)
2085 PRINT AT 10,0;"% ";TAB 29;"\@@"
2086 LET DEM=1
2087 LET QW=INT (RND*4)
2090 FOR I=1 TO QW+1
2095 PRINT AT 12+I,12+(RND*2);"***";
2100 NEXT I
2105 LET N=10
2106 LET MY=-1
2107 LET MX=0
2108 LET K=18
2109 LET J=7
2110 LET M=2
2111 LET FX=J
2112 LET FY=K
2115 GOTO 265
2999 REM "%T%R%A%P"
3000 IF PEEK (Q+33*(K+MY)+K+MX)=P THEN GOTO 3015
3002 LET AD=MY
3005 IF AD=0 THEN LET MY=MX
3006 IF AD=0 THEN LET MX=0
3007 IF AD<>0 THEN LET MY=0
3008 IF AD<>0 THEN LET MX=0-AD
3015 LET J=J+MX
3020 LET K=K+MY
3025 PRINT AT K,J;"\'.";
3030 IF RND>.5 THEN PRINT AT FY,FX;"\'."
3032 IF RND<.25 THEN GOSUB 1200
3035 RETURN 
4000 SAVE "1014%7"
5000 RUN 

People

No people associated with this content.

Scroll to Top