home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er 1989 February
/
64er_Magazin_89-02_1989_Markt__Technik_de_Disk_2_of_2_Side_A.d64
/
labyrinth
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
7KB
|
216 lines
0 rem@ \integer #
1 rem@ \word a,b,c,x,p,tc,bc,dw:\byte co,z,y
2 poke53281,0:poke53280,6
3 s=54272:gosub7000:gosub9000
4 vp=54272:co=1
5 goto900
9 rem@ \fastfor
10 y=peek(tc-u):z=peek(tc-u+ll):ifabs(u)=1ordc=0then30
20 ify=32andz=32thenfora=tc-u+lltobc-v-llstep40:pokea,w3:pokea+vp,co:next
30 poketc,tw:pokebc,bw:poketc+vp,co:pokebc+vp,co
31 b=b+1:ifb<dwthentc=tc+u:bc=bc+v:goto30
40 ifabs(u)=1thenpoketc,t1:pokebc,b1:poketc+vp,co:pokebc+vp,co
50 iftc=bc-llthenreturn
60 forb=tc+lltobc-llstep40:pokeb,sw:pokeb+vp,5:next:return
65 dw=int(dv/3)+1
70 f=ml:u=ll+1:v=1-ll:t1=80:b1=122:sw=103
80 forx=4to6step2:tw=77:bw=78:b=0:ifx=4then100
90 f=mr:u=ll-1:v=-ll-1:sw=101:t1=79:b1=76:tw=78:bw=77
100 lm=m(f):ld=w(f)
101 iff=3andop=ecthen140
104 ifld=0thenld=2
105 ifq-ld*int(q/ld)=0thentc=m(x):bc=m(x+1):gosub10:goto130
110 tw=99:bw=100:u=u-ll:v=v+ll:n=peek(op+lm)
120 ifn-d*int(n/d)=0thentc=m(x)+dw*ll:bc=m(x+1)+dw*-ll:gosub10
130 ifabs(u)=1thenu=u+ll:v=v-ll
140 m(x)=m(x)+dw*u:m(x+1)=m(x+1)+dw*v:next
150 ifm=3andop=ecthenreturn
160 ifq-d*int(q/d)=0then180
170 op=op+m(m):q=peek(op):dc=dc+1
172 ifdc>=cdthenreturn
173 zx=zx+1
174 dw=dv-zx+1:goto70
175 ifdc=cdthenreturn
180 r=peek(m(4)-1)
185 ifr=32thenm(4)=m(4)-1:m(5)=m(5)-1:ifm(4)<>tl+dw*llthen180
190 r=peek(m(6)+1)
195 ifr=32thenm(6)=m(6)+1:m(7)=m(7)+1:ifm(6)<>tr+dw*llthen190
200 wk=1:fortc=m(4)tom(6):poketc,w1:poketc+vp,co:next
210 forbc=m(5)tom(7):pokebc,w2:pokebc+vp,co:next:return
240 cx=zx:zx=0:gk=wk:wk=0
241 rem@ \slowfor
242 fori=0to10:geta$:next
243 print"o2:"ox"[157] "
245 gosub15000
247 ifa$="p"thengosub5000 :goto245
250 np=p:q=peek(p):ifa$="g"thennp=p+m(m)
260 ifnp=pthen320
270 iftt=1andcx=0andgk=0thengosub6000:gosub4000:run
285 ifq-d*int(q/d)<>0thenp=np:goto380
305 pokes+13,15*16+12:pokes+7,90:pokes+8,4:pokes+11,129:pokes+11,128
320 nm=m:ifa$="r"thennm=m+1
330 ifa$="o"thennm=m+2
340 ifa$="l"thennm=m+3
345 ifa$="k"thengosub600:poke198,0:wait198,1:poke198,0:goto360
350 ifnm=mthen242
360 ifnm>3thennm=nm-4*int(nm/4)
370 m=nm
380 d=w(m):q=peek(p):op=p:ml=m-1:mr=m+1
390 ifml+30000<30000thenml=3
400 ifmr>3thenmr=0
410 ox=ox-ol
415 ifox+30000<30000thenprint"luft verbraucht!":gosub6800:gosub4000:run
420 t=t+1:tt=1
430 iftt=1thendc=0:gosub2000:gosub65
440 m(4)=tl:m(5)=bl:m(6)=tr:m(7)=br:goto240
500 p=p+1:ifp>emthenp=sm
510 a=int(rnd(1)*4):dc=0
520 a=a+1:dc=dc+1:ifdc>3then500
530 ifa>3thena=0
540 m=p+m(a):ifm<smorm>emthen520
550 cp=peek(p):cm=peek(m):ifc+10000>10000andcp=210thenp=m:goto510
560 tm=m-sm:if(cp=cmorcm<210)andc+10000>10000then520
570 me=tm-l*int(tm/l):if(me=0andm(a)=1)or(me=gandm(a)=-1)then520
580 od=int(15/w(a)):cp=cp/w(a):pokep,cp:cm=cm/od:pokem,cm
590 printtab(17);h-c"[157] [145]"
594 p=m:c=c+1:ifc<hthen510
595 return
600 gosub2000
602 rem@ \fastfor
605 a=1025+ll:ms=a:dc=sm:dd=sm+g
610 forb=dctodd:forc=0to3:cb=peek(b):cb=cb-w(c)*int(cb/w(c))
620 aa=1:ifc=1orc=3thenaa=ll
630 ifc>1thenaa=-aa
640 bb=ll/aa:p2=a+aa:p1=p2+bb:p3=p2-bb
645 ifb=pthenpokea,w4:pokea+vp,co
650 ifcb=0thenpokep1,w3:pokep2,w3:pokep3,w3
651 ifcb=0thenpokep1+vp,co:pokep2+vp,co:pokep3+vp,co
660 next:a=a+2:next:dc=dc+l:dd=dd+l:a=ms+(2*ll):ms=a
670 ifdd<=emthen610
680 gosub7000:return
690 rem@ \slowfor
900 print"[147][154]sie verstecken sich auf einem planeten in einem labyrinth"
910 print"finden sie den ausgang bevor ihnen der sauerstoff ausgeht."
920 print"[150]sie benuetzen den joystick oder:"
922 print"l = links r = rechts"
923 print"o = drehung um 180 gradg = gehen"
924 print"[129]p = drucker[154]"
925 print"[129]k = karte[154]"
930 print"[152]wollen sie die groesse eingeben(j/n)?"
932 print"[153][129]ansonsten berechnungn durch zufall"
934 geta$:ifa$="n"then940
935 ifa$<>"j"then934
936 input"[147][152]laenge:";lz:iflz<1orlz>12then936
937 input"breite:";bz
938 ifbz<1orbz>19thenprint"[145][145][145][145][145][145][145][145]":goto937
940 print"[147][156]eingabe der sauerstoffmenge"
941 print"fuer berechnung return druecken"
942 gx=0:input"sauerstoff:";gx
943 ifgx>999then940
945 print"[147]bitte warten[129]"
950 tl=1032:bl=1992:tr=tl+24:br=bl+24:ll=40:dv=4:cd=5
955 w1=99:w2=100:w3=160:w4=88
960 w(0)=5:w(1)=7:w(2)=3:w(3)=2:l=int(rnd(1)*5+6):ifbz>0thenl=bz
970 m(0)=1:m(1)=l:m(2)=-1:m(3)=-l:m(4)=tl:m(5)=bl:m(6)=tr:m(7)=br
975 w=int(rnd(1)*5+6):iflz>0thenw=lz
980 h=l*w-1:g=l-1:c=0:dc=0:t=0:rm=0
995 sm=25000:em=sm+h:fora=smtoem:pokea,210:next:p=sm+int(rnd(1)*h)
1000 ec=sm+int(rnd(1)*l):mc=int(rnd(1)*h)+sm
1003 ifox>0then1010
1005 ox=int(h/3)+1
1010 ifp<oxthenox=-ox
1015 ox=ox+h:ol=1:tt=int(rnd(1)*h/8)+1:gosub500:gosub2000
1017 ifgx>0thenox=gx+1
1030 m=0:np=p:ce=peek(ec):ce=ce/w(3):pokeec,ce:goto380
2000 print"[147]":return
3000 forx=0to1000:print"[145]":next:return
4000 geta$:ifa$=""then4000
4010 poke53281,11:co=8:print"[147][154]karte(j/n)?"
4020 geta$:ifa$="n"then4500
4030 ifa$<>"j"then4020
4040 print"[147]";:gosub605
4060 print"-taste-"
4065 fori=1to11:geta$:next
4070 geta$:ifa$=""then4070
4500 print"[147][129]noch einmal(j/n)?[154]"
4510 geta$:ifa$="j"thenreturn
4520 ifa$<>"n"then4510
4530 print"[147]";:poke53280,14:poke53281,6:end
5000 open4,4:print#4,chr$(14)
5005 fori=1024to2023step40:p$=""
5010 forj=0to39:x=peek(j+i)
5020 ifx<32thenx=x+64:goto5100
5025 ifx<64then5100
5030 ifx<96thenx=x+32:goto5100
5035 ifx<128thenx=x+64:goto5100
5100 p$=p$+chr$(x)
5150 next:print#4,p$:next
5155 close4
5160 return
6000 :
6001 print"ausgang erreicht"
6010 gosub3000
6720 return
6800 pokes+13,15*16+12:pokes+11,129
6805 pokes+24,15+16:pokes+23,15*16+1:pokes+6,15*16:pokes,200:pokes+1,3
6810 pokes+4,129:fori=3000to0step-5:poke53280,7:pokes+7,iand255:pokes+8,i/256
6815 poke53280,6:next:pokes+1,1:pokes,170
6820 gosub8000:gosub7000:return
7000 fori=0to24:pokes+i,0:next:pokes+6,15*16+11:pokes+24,15:pokes,162:pokes+1,14
7010 return
7500 pokes+23,2+15*16:pokes+24,15+16:return
8000 print"[147]";
8002 a$="[129][159][156][158][129][149][150][151][152][153][154][155]":fori=1to35:printmid$(a$,(iand15)+1,1);:gosub8008
8003 nexti:return
8008 print"";
8009 print" [164][164][164][164] ";
8010 print" [206] [206][165] ";
8020 print" [207][183][183][208] [165] ";
8030 print" [175][175][175][165] [167] [204][175][175][175] ";
8040 print" [206] [165] [167][206] [206][180] ";
8050 print" [207][183][183][183] [183][183][183][208] [180] ";
8060 print" [180] [170] [180] ";
8070 print" [204][175][175][175] [175][175][175][186][206] ";
8080 print" [180] [170] [180] ";
8090 print" [180] [170] [180] ";
8100 print" [180] [170] [180] ";
8110 print" [180] [170] [180] ";
8120 print" [180] [170] [180] ";
8130 print" [180] [170] [180] ";
8140 print" [204][175][175][186][206] ";
8150 print" ";
8160 print" ";
8170 print"[158] ruhe in frieden "
8180 return
9000 print"[147] demo zum basic-boss compiler
9001 [153]" 'labyrinth' wurde ausschliesslich in
9002 print" basic geschrieben !
9004 [153]" (thilo herrmann, 1988)
9006 printchr$(142)chr$(8)
9007 goto9200
9008 print"";
9009 print"[161] ";
9010 print"[161] [161] [161] [161] ";
9020 print"[161] [161] [211] [161] [161] ";
9030 print"[161] [162][162][162] [161] [184][207][184] [161] ";
9040 print" [146] [161][207][184][184][205] [161] [161][182][206][190][161][182][184][205] [161] [207][184][205] ";
9050 print" [146] [206][184][184][161][161] [182] [161] [161][182] [161][182] [161] [161] [161] [182] ";
9060 print" [146] [161] [161][161] [206] [161] [161][182] [161][182] [161] [161] [161] [182] ";
9070 print"[184][184][184][184] [184][184][184] [184][184][184] [184][184][184][161] ";
9080 print" [161] ";
9090 print" [162][206]"
9095 return
9200 a$="[159][156][158][129][149][150][151][152][153][154][155][129]":i=0
9202 getb$:ifb$<>""thenreturn
9205 i=i+1:printmid$(a$,(iand15)+1,1);
9210 gosub9008:goto9202
9220 return
15000 a$=""
15005 if(peek(56320)and1)=0thena$="g"
15010 if(peek(56320)and2)=0thena$="o"
15020 if(peek(56320)and4)=0thena$="l"
15030 if(peek(56320)and8)=0thena$="r"
15040 if(peek(56320)and16)=0thena$="k"
15050 if a$=""thengeta$:goto15005
15090 return