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?oBo?bo?%?oo?%?%o?so?r?%?oo?~}#?%o?q}~o?r?#}~?oo@{@%o?_[?r@{@ot{$wq{'ou{~s%p{(oZ|=|nko?#~%?/?'?pC1C#p?#A1?
19 REM}A#pC#~&~(~#C#pA#?{O#?#pC{A#}@#}Fo?#pC{Oo?#pC{Oo?#pC{B&Go?#pC{B&Go?#pC{B%}oFo?#zBogqy^/u$^(~),}0|$*oE$}(|$&}%uD&|$Hx}&|$,o
20 REMD|Co@$~+u|'sHu|#~%r}HoE\%oBHo.sHv}#bs@(@v@%s@$}}$@t}(sIoErs-vFo&}&#o1oZ!

100 REM void - brick - wall
100 SETET 100,"00000000000000000000":SETET 101,"FEFEFEFE00EFEFEFEF00":SETET 102,"FFFFFFFFFFFFFFFFFF00"
103 brick trap (same graphic as brick 101) - cord - scale
103 SETET 103,"FEFEFEFE00EFEFEFEF00":SETET 104,"00FF0000000000000000":SETET 105,"42427E424242427E4242"
106 exit scale - treasury - ennemy
106 SETET 106,"40427E420202427E4240":SETET 107,"000000007EA5A58181FF":SETET 108,"1C3E2A3E1C1C2A1C1436"
109 REM hero standing 127 - decor gold part 1 - decor gold part 2
109 SETET 109,"1C2236221C1C2A1C1436":SETET 126,"0000070A1F356F54FBD6":SETET 127,"080836C868B0F8D8FCB4"

110 REM hero running left 1 - hero running left 2 - hero running right 1
110 SETET 110,"1C2232221C1C281C1236":SETET 111,"1C2232221C1C0A1C242C":SETET 112,"1C2226221C1C0A1C2436"
113 REM hero running right 2 - hero brick trap 1 = same as brick - hero brick trap 2 = same as brick
113 SETET 113,"1C2226221C1C281C121A":SETET 116,"FEFEFEFE00EFEFEFEF00":SETET 117,"FEFEFEFE00EFEFEFEF00"
118 REM hero cord 1 - hero cord 2 - hero scale 1
118 SETET 118,"C3FF6236221C141C2448":SETET 119,"C3FF6236221C141C1209":SETET 120,"BAC667477A52527E6A46"
121 REM hero scale 2 - hero exit scale 1 = same as hero scale 1 - hero exit scale 2 = same as hero scale 2
121 SETET 121,"5D63E6E25E4A4A7E5662":SETET 122,"BAC667477A52527E6A46":SETET 123,"5D63E6E25E4A4A7E5662"
124 REM hero treasury 1 - hero treasury 2 = same as hero treasury 1 - border
124 SETET 124,"1C22B6A35D3E081C1436":SETET 125,"1C22B6A35D3E081C1436":SETET  99,"FFFFFFFFFFFFFFFFFFFF"

130 DIM CO(10),T(29,17),ZX(18),ZY(18)
131 DIM EX(6),EY(6),EO(6),EP(6),EM(6),EL(6),ED(6)

132 DATA 0,1,1,1,7,7,0,3,5,7
133 FOR I=0 TO 9:READ CO(I):NEXT I
134 FOR I=1 TO 28:T(I,17)=2:NEXT I
135 DEFFN MD=INT(((NX+NY)/2)-INT((NX+NY)/2)+0.5)
136 T=1:SX=5:SY=3:S=0:G=0:D=0:A=&"4A02"+38:OS=0

137 INIT 0,0:DISPLAY 255:PAGE:ET 3
138 FOR I=0 TO 29:CURSORX I+SX:CURSORY SY:PRINT CHR$(99):CURSORX I+SX:CURSORY SY+17:PRINT CHR$(99):NEXT I
139 FOR I=1 TO 16:CURSORX SX:CURSORY I+SY:PRINT CHR$(99):CURSORX SX+29:CURSORY I+SY:PRINT CHR$(99):NEXT I
140 TX 7:CURSORX SX:CURSORY SY+19:PRINT "SCORE":GOSUB 420:TX 1:CURSORX SX+13:CURSORY SY+19:PRINT "HIGH SCORE":GOSUB 423
141 GOSUB 435
142 ET 1,3:D$=CHR$(101)+CHR$(101)+CHR$(101)+CHR$(101)
143 CURSORX 5:CURSORY 1:PRINT D$:CURSORX 30:CURSORY 1:PRINT D$
144 CURSORX 5:CURSORY 2:PRINT D$:CURSORX 30:CURSORY 2:PRINT D$
145 TX 3,3:CURSORX 9:CURSORY 1:PRINT "LLOODDEE  RRUUNNNNEERR":CURSORX 9:CURSORY 2:PRINT "LLOODDEE  RRUUNNNNEERR"
146 CURSORX 1:CURSORY 23:TX 4:PRINT "Original game 1983 (c)Douglas E. Smith" 
147 CURSORX 1:CURSORY 24:PRINT "VG5000 version 1986 (c)Guillaume Ramey"
148 G$=CHR$(126)+CHR$(127)
149 ET 3:FOR I=3 TO 20 STEP 2:CURSORX INT(RND(1)*4):CURSORY I:PRINT G$:CURSORX INT(RND(1)*4)+35:CURSORY I:PRINT G$:NEXT I
150 TX 2:FOR I=4 TO 20 STEP 2:CURSORX INT(RND(1)*5):CURSORY I:PRINT "$":CURSORX INT(RND(1)*5)+35:CURSORY I:PRINT "$":NEXT I

200 REM READ LEVEL DATA
200 X=1:Y=1:ZN=0:EN=0:BS=1000:CURSORX 28+SX:CURSORY 18+SY:TX 7:PRINT "--"  
201 ET 0

202 D$=""
203 V=PEEK(A+OS+(INT(OS/123)*6)):OS=OS+1
204 IF V=33 THEN TX 4:CURSORX 7+SX:CURSORY 7+SY:PRINT "-GAME COMPLETED-":GOTO 595
205 IF V>=35 AND V<=62 THEN C$=CHR$(100):L=V-34:E=0
206 IF V>=63 AND V<=90 THEN C$=CHR$(101):L=V-62:ET CO(1):E=1
207 IF V>=91 AND V<=95 THEN C$=CHR$(102):L=V-90:ET CO(2):E=2
208 IF V>=96 AND V<=110 THEN C$=CHR$(104):L=V-95:ET CO(4):E=4
209 IF V>=111 AND V<=122 THEN CURSORX X+SX:CURSORY Y+SY:ET CO(5):PRINT CHR$(105):T(X,Y)=5:X=X+1:C$=CHR$(100):L=V-111:E=0
210 IF V=123 THEN C$=CHR$(103):L=1:ET CO(3):E=3
211 IF V>=124 AND V<=127 THEN C$=CHR$(V-18):L=1:ET CO(V-118):E=V-118

212 IF L=0 GOTO 223
213 FOR J=0 TO L-1
214 D$=D$+C$
215 T(X+J,Y)=E
216 IF E=6 THEN ZN=ZN+1:ZX(ZN)=X+J:ZY(ZN)=Y
217 IF E=7 THEN G=G+1
218 IF E=8 AND EN<ME THEN EN=EN+1:EX(EN)=X+J:EY(EN)=Y:EO(EN)=X+J:EP(EN)=Y:EM(EN)=0:EL(EN)=INT(RND(1)*5)+5:T(X+J,Y)=0
219 IF E=8 AND EN=ME THEN D$=CHR$(100):T(X+J,Y)=0
220 IF E=9 THEN NX=X+J:NY=Y:O=X:P=Y
221 NEXT J

222 CURSORX X+SX:CURSORY Y+SY:PRINT D$:X=X+L

223 IF X>28 THEN X=1:Y=Y+1
224 IF Y<17 GOTO 202

401 CURSORX 22+SX:CURSORY 18+SY:TX 7:PRINT "LEVEL "+RIGHT$("00"+MID$(STR$(T),2,2),2):SOUND 100,10:SOUND 150,10
402 CURSORX SX:CURSORY 18+SY:TX 7:PRINT "BONUS ":GOSUB 418
405 DISPLAY DR
406 REM SCROLL
410 X=NX:Y=NY:T(X,Y)=0
411 GOTO 900

418 REM == DISPLAY TIME BONUS ==
418 CURSORX 8+SX:CURSORY 18+SY:TX 7:PRINT RIGHT$("0000"+MID$(STR$(BS),2,4),4)
419 RETURN

420 REM == DISPLAY SCORE ==
420 TX7:CURSORX 6+SX:CURSORY 19+SY:PRINT RIGHT$("000000"+MID$(STR$(S),2,6),6):RETURN
421 REM == DISPLAY HIGH SCORE ==
421 IF S<=HS THEN RETURN
422 HS=S:PLAY "T30O4BABA"
423 TX1:CURSORX 24+SX:CURSORY 19+SY:PRINT RIGHT$("000000"+MID$(STR$(HS),2,6),6):RETURN

435 == DISPLAY NUMBER OF LIVES
435 D$="":IF NL>0 THEN FOR I=1 TO NL:D$=D$+CHR$(109):NEXT I
436 D$=D$+CHR$(100):ET 2:CURSORX SX+15:CURSORY SY+18:PRINT D$
437 RETURN 

500 REM == HERO MOVES ==
500 IF STICKX(2)=1 THEN NX=X+1:C=0:D=0:GOTO 509
501 IF STICKX(2)=255 THEN NX=X-1:C=0:D=0:GOTO 510
502 IF STICKY(2)=1 THEN NY=Y+1:D=0:GOTO 510
503 IF STICKY(2)=255 THEN NY=Y-1:D=0:GOTO 510
504 IF ACTION(2)=1 THEN GOTO 585
505 IF KEY(0)=115 THEN GOTO 560
506 C=C+1:IF C>30 THEN BS=BS-20:SOUND 180,1:C=0:D=1:E=T(X,Y):IF E=0 THEN CURSORX X+SX:CURSORY Y+SY:ET CO(9):PRINT CHR$(109)
507 IF BS<0 THEN BS=0
508 GOSUB 418:RETURN
509 IF T(NX,NY)=0 THEN D=2

510 W=0:IF NX<1 THEN NX=1
511 IF NX>28 THEN NX=28
512 IF NY<1 THEN NY=1
513 IF NY>16 THEN NY=16
514 IF NX=X AND NY=Y GOTO 500
515 E=T(NX,NY)
516 IF E=1 OR E=2 THEN NX=X:NY=Y:GOTO 500
517 IF E=7 THEN SOUND 140,2:G=G-1:S=S+100:T(NX,NY)=0:GOSUB 420
518 IF E=7 AND G=0 THEN GOSUB 580
529 CURSORX NX+SX:CURSORY NY+SY:ET CO(9)
530 IF E=6 AND G>0 THEN PRINT CHR$(110+FNMD(NX)+D):GOTO 532
531 PRINT CHR$(110+E*2+FNMD(NX)+D)
532 E=T(X,Y):CURSORX X+SX:CURSORY Y+SY:ET CO(E):PRINT CHR$(100+E)
533 X=NX:Y=NY
534 GOSUB 550
536 E=T(X,Y):F=T(X,Y+1)
537 IF (E=0ORE=3OR(E=6ANDG<>0))AND(F=0ORF=3ORF=4OR(F=6ANDG<>0)ORF=7ORF=8) THEN NY=Y+1:D=0:SOUND 200-W*8,1:W=W+1:GOTO 510
538 IF E=0 THEN SOUND 10+FNMD(NX)*10,1
539 IF (E=5 OR E=6) AND Y=1 AND G=0 GOTO 590
540 RETURN

550 REM == CHECK IF HERO IS SAME POSITION AS ENNEMIES ==
550 FOR I=1 TO EN
551 IF X=EX(I) AND Y=EY(I) GOTO 560
552 NEXT I
553 RETURN

560 == HERO KILLED ==
560 TX 3
561 FOR I=1 TO 10
562 CURSORX X+SX:CURSORY Y+SY:PRINT "X"
563 FOR J=1 TO 200:NEXT J
564 CURSORX X+SX:CURSORY Y+SY:PRINT "#"
565 FOR J=1 TO 200:NEXT J
566 NEXT I:CURSORX X+SX:CURSORY Y+SY:PRINT " ":PLAY "T15O3GFEFEDEDCBAA"
567 NL=NL-1:GOSUB 435:IF NL<1 GOTO 593
569 FOR I=1 TO EN
570 E=T(EX(I),EY(I)):CURSORX EX(I)+SX:CURSORY EY(I)+SY:ET CO(E):PRINT CHR$(100+E)
571 EX(I)=EO(I):EY(I)=EP(I):CURSORX EX(I)+SX:CURSORY EY(I)+SY:ET CO(8):PRINT CHR$(108)
572 NEXT I
573 E=T(X,Y):CURSORX X+SX:CURSORY Y+SY:ET CO(E):PRINT CHR$(100+E)
574 X=O:Y=P:NX=X:NY=Y:CURSORX X+SX:CURSORY Y+SY:ET CO(9):PRINT CHR$(109)
575 GOTO 900

580 REM === DISPLAY EXIT SCALE ===
580 CO(6)=7:ET CO(6)
581 FOR I=1 TO ZN
582 CURSORX ZX(I)+SX:CURSORY ZY(I)+SY:PRINT CHR$(106):SOUND 50+I*2,2
583 NEXT I
584 RETURN

585 REM === DIG ===
585 IF (X+D-1)<1 OR (X+D-1)>28 OR Y=16 THEN RETURN
586 ET 7:F=T(X+D-1,Y+1):IF F<>1 GOTO 510
587 T(X+D-1,Y+1)=0:CURSORXX+D-1+SX:CURSORYY+1+SY:PRINTCHR$(100):NY=NY+1:FORI=1TO20:SOUND 255-2*I,1:NEXTI
588 IF S>24 THEN S=S-25:GOSUB 420
589 GOTO 510

590 REM == LEVEL CHANGE ==
590 PLAY "T30O3A20RC10D10R20C10D30":IF BS>0 THEN FOR I=1 TO BS STEP 20:S=S+20:GOSUB 420:BS=BS-20:GOSUB 418:SOUND 110,1:NEXT I
591 GOSUB 421:CO(6)=0:T=T+1:IF INT(RND(1)*2)=0 THEN SETET 101,"FEFEFEFE00EFEFEFEF00":SETET 103,"FEFEFEFE00EFEFEFEF00":GOTO 200
592 SETET 101,"FFFF183C66C381FFFF00":SETET 103,"FFFF183C66C381FFFF00":GOTO 200
593 GOSUB 421:TX 4:CURSORX 7+SX:CURSORY 7+SY:PRINT "G A M E  O V E R"
595 CURSORX 7+SX:CURSORY 8+SY:PRINT "REPLAY?    (Y/N)"
596 REM CURSORX 10+SX:CURSORY 18+SY:PRINT " "
597 IF KEY(0)=78 OR KEY(0)=110 THEN INIT 6,6:END
598 IF KEY(0)=89 OR KEY(0)=121 THEN NL=3:GOTO 136
599 GOTO 597

600 EL(N)=EL(N)-1
601 IF EL(N)<1 THEN EM(N)=INT(RND(1)*3):GOTO 890
602 ON EM(N)+1 GOTO 610,630,630 REM 720
603 RETURN

610 REM == WAITING MODE ==
610 GOSUB 692
611 RETURN

630 REM == EXPLORING MODE == 1 LEFT 2 RIGHT 3 UP 4 DOWN
630 AX=EX(N):AY=EY(N)
632 IF ED(N)=1 THEN IE=-1:ES=2:GOTO 650
633 IF ED(N)=2 THEN IE=1:ES=1:GOTO 650
634 IF ED(N)=3 THEN IE=-1:ES=4:GOTO 670
635 IF ED(N)=4 THEN IE=1:ES=3:GOTO 670
686 RETURN

650 EX(N)=EX(N)+IE
651 IF EX(N)<1 THEN EX(N)=1:ED(N)=2:RETURN
652 IF EX(N)>28 THEN EX(N)=28:ED(N)=1:RETURN
653 E=T(EX(N),EY(N)):B=T(EX(N),EY(N)+1):U=T(EX(N),EY(N)-1)
654 IF E=1 OR E=2 OR E=3 THEN EX(N)=AX:ED(N)=ES:RETURN
655 IF E=0 AND (B=0 OR B>5) THEN EX(N)=AX:ED(N)=ES:RETURN
656 GOSUB 690
659 IF B=5 AND U=5 AND INT(RND(1)*4)=0 THEN ED(N)=INT(RND(1)*2)+3:RETURN
660 IF B=5 AND INT(RND(1)*4)=0 THEN ED(N)=4:RETURN
661 IF U=5 AND INT(RND(1)*4)=0 THEN ED(N)=3:RETURN
662 RETURN

670 EY(N)=EY(N)+IE
671 IF EY(N)<1 THEN EY(N)=1:ED(N)=4:RETURN
672 IF EY(N)>16 THEN EY(N)=16:ED(N)=3:RETURN
673 E=T(EX(N),EY(N)):B=T(EX(N),EY(N)+1)
674 IF NOT ((E=0 AND B<>0) OR E=5) THEN EY(N)=AY:ED(N)=ES:RETURN
675 L=T(EX(N)-1,EY(N)):R=T(EX(N)+1,EY(N)):LB=T(EX(N)-1,EY(N)+1):RB=T(EX(N)+1,EY(N)+1)
676 GOSUB 690
679 LL=((L=0 OR L>=5) AND (LB=1 OR LB=2 OR LB=3 OR LB=5))
680 RR=((R=0 OR R>=5) AND (RB=1 OR RB=2 OR RB=3 OR RB=5))
681 IF LL AND RR AND INT(RND(1)*4)=0 THEN ED(N)=INT(RND(1)*2)+1:RETURN
682 IF LL AND INT(RND(1)*4)=0 THEN ED(N)=1:RETURN
683 IF RR AND INT(RND(1)*4)=0 THEN ED(N)=2:RETURN
684 RETURN

690 E=T(AX,AY)
691 CURSORX AX+SX:CURSORY AY+SY:ET CO(E):PRINT CHR$(100+E)
692 CURSORX EX(N)+SX:CURSORY EY(N)+SY:ET CO(8):PRINT CHR$(108)
693 IF EX(N)=X AND EY(N)=Y GOTO 560
694 RETURN

720 REM == CHASING MODE ==
720 GOSUB 692
722 RETURN

890 REM == ENNEMY CHANGE OF MODE ==
890 ON EM(N) GOTO 891,892,895
891 EL(N)=1
892 IF T(EX(N),EY(N))=0 THEN ED(N)=INT(RND(1)*2)+1:
893 IF T(EX(N),EY(N))=5 THEN ED(N)=INT(RND(1)*2)+3:
894 EL(N)=INT(RND(1)*10)+10:RETURN
895 IF EM(N)=2 THEN EL(N)=1
896 RETURN

900 REM == MAIN LOOP ==
900 GOSUB 500
901 IF EN>=1 THEN N=1:GOSUB 600
902 GOSUB 500
903 IF EN>=2 THEN N=2:GOSUB 600
904 GOSUB 500
905 IF EN>=3 THEN N=3:GOSUB 600
906 GOSUB 500
907 IF EN>=4 THEN N=4:GOSUB 600
908 GOSUB 500
909 IF EN>=5 THEN N=5:GOSUB 600
910 GOSUB 500
911 IF EN>=6 THEN N=6:GOSUB 600
913 GOTO 900

