home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1993 December
/
1993-12.d64
/
chain.bas
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
118 lines
5 rem copyright 1993 - compute publications intl ltd - all rights reserved
10 rem setup
20 poke53281,0:poke53280,0:poke53282,11:poke53283,1:geta$:geta$
30 dimag(8,9):printchr$(8)
40 s=54272:fort=stos+24:poket,.:nextt:pokes+5,9
50 za$="[195][195][195][195][195][195][195][195][195][195][195][195][195][195]":zb$="":zc$="[157][157][157][157][157]":zd$="":ze$=" "
60 zf$="000000":zg$=" [151][193][192][192][192][192][192][192][192][192][192][192][192][192][192][192][193]":at$="[206][207][157][157][208][209][146][145]":bl$="[154][170][171][157][157][172][173][145]"
70 co$(1)="[149]":co$(2)="[150]":co$(3)="[151]":co$(4)="[152]":co$(5)="[153]":co$(6)="[155]"
80 sc=0:at=0:fort=1to7:fori=1to8:ag(t,i)=.:nexti:nextt:di=1:ds=0:ba$="[146] [157][157] [145]"
90 di$(1)="practice":di$(2)="easy":di$(3)="moderate":di$(4)="hard"
100 r=0:v=0:c=2:de$="n":xp$="[151]lm[157][157]no"
110 rem draw screen
120 print"[147][151][146]"spc(22)"[201][202][202][203]"zc$"[198][204][205][205][200]"zc$"[199] [150][206][207][151][200]"zc$"[199] [150][208][209][151][200]"
130 printzg$za$"[195][195][195][195][195]";
140 fort=1to16:print" [194]"spc(14)"[194]":nextt:print" [196]"za$"[197]"spc(30)"[151][146][210][212][214]";
150 print"[216][218]"zc$"[211][213][215][217][219]"zc$"[157][157][220][221][255][223][160][161][162][163][164]"zc$"[157][157][168][169][165][166][167]":printspc(22)"[187][188][189][190]";
160 print"[157][157][157][157][177][178][184][180][181]"zc$"[182][183][184][185][177]"zb$""zd$;:fort=1to6:fori=1to7
170 printco$(int(rnd(0)*6)+1)at$;:nexti:print:printzd$"";:nextt
180 rem start
190 poke53247,0:sys49323:pokes+24,15
200 printzb$""spc(28)""zf$""zc$"[157]"zf$""zc$"[157]"zf$:gosub280
210 printzb$""zd$"[159]f1-gameplay:":printzd$ze$ze$;"[145]"
220 printzd$spc(7-len(di$(di))/2)di$(di):ifdi=1thends=0
230 printzd$"[159] press return":printzd$" to start"
240 ifa$=""thengosub960:goto240
250 ifa$="[133]"thendi=di+1:ifdi=5thendi=1
260 ifa$=chr$(13)then310
270 a$="":ds=2*di-3:goto210
280 rem print score
290 printzb$"":jj=hs:gosub300:jj=sc*ds:gosub300:jj=at:gosub300:return
300 print""spc(35-len(str$(jj)))mid$(str$(jj),2,10):return
310 rem clear area
320 printzb$"";:fort=1to16:printzd$"[146]"ze$ze$:nextt
330 rem new atom
340 printzb$""zg$:co=c:d$="n"
350 fort=22to18step-1:printzb$spc(t)co$(co)at$;:ift=19thenprint"[199][157][199]":goto370
360 print" [157] ":gosub960:v=0:r=7:tm=10:re=0
370 gosub960:nextt:c=int(rnd(0)*6)+1:printzb$spc(23)co$(c)"[208][209][157][157] ":gosub960
380 printzb$spc(23)co$(c);at$:gosub960
390 rem input from joystick
400 jv=peek(56320):fr=jvand16:jv=15-(jvand15):a=r:v=0:b=v
410 ifjv=4thenr=r-1:ifr=0thenr=1
420 ifjv=4then460
430 ifjv=8thenr=r+1:ifr=8thenr=7
440 ifjv=8then460
450 iffr<>16then490
460 ifa<>rthengosub1090
470 tm=tm-1:iftm=0then490
480 gosub1120:gosub960:goto400
490 rem drop atom
500 printzb$" [151][193]"ze$ze$
510 a=r:b=v:v=v+1:ifag(r,v)<>0orv=9thenv=v-1:goto540
520 gosub1090:gosub1120:gosub960
530 goto510
540 ag(r,v)=co:ifv=0then1010
550 rem reaction
560 f$="n":fort=1to8:fori=1to7:ifag(i,t)=0orag(i,t)=10then610
570 ifag(i,t+1)=0andt<8thenag(i,t+1)=ag(i,t):ag(i,t)=0:f$="1":gosub630:goto610
580 ifag(i,t+1)=ag(i,t)andt<8thena=i:b=t+1:f$="2":gosub890
590 ifag(i-1,t)=ag(i,t)andi>1thena=i-1:b=t:f$="2":gosub890
600 iff$="2"thena=i:b=t:f$="1":gosub890:f$="1"
610 nexti:nextt:iff$="n"then660
620 goto550
630 rem pull atom down
640 printzb$""spc(i*2+4);:forj=1tot:print"";:nextj:printba$:printzb$"";
650 printspc(i*2+4);:forj=1tot+1:print"";:nextj:printco$(ag(i,t+1))at$:return
660 rem difficulty check
670 ifdi=2andd$="n"then750
680 ifdi=3andd$="n"then750
690 ifdi>2then710
700 goto330
710 rem draw block
720 i=int(rnd(0)*7)+1:t=int(rnd(0)*7)+2:ag(i,t)=10:printzb$""spc(4+i*2);
730 forz=1tot:print"";:nextz:printbl$
740 forz=10to1step-.5:pokes+4,32:pokes+1,z:pokes,10:pokes+4,33:nextz:goto330
750 rem draw zapper
760 a=int(rnd(0)*8)+1:ifa=2then760
770 ifdi=2thena=int(rnd(0)*5)+4
780 printzb$""spc(6);:fort=1toa:print"";:nextt:fort=1to7:print"[153][174][175]";
790 forz=1to100step50:pokes+4,33:pokes+1,z:pokes,10:pokes+4,32:nextz
800 ifag(t,a)<>0thenag(t,a)=int(rnd(0)*6)+1
810 nextt:d$="y":gosub820:goto550
820 rem redraw area
830 printzb$""spc(6);:fort=1to8:fori=1to7
840 ifag(i,t)=0thenprintba$;:goto870
850 ifag(i,t)=10thenprintbl$;:goto870
860 printco$(ag(i,t))at$;
870 nexti:print:printspc(6)"";:nextt:return
880 pokes+4,128:pokes+1,10:pokes,10:pokes+4,129
890 ifa=i and b=t and ag(i,t+1)=ag(i,t)thenreturn
900 ifa=i and b=t and ag(i+1,t)=ag(i,t)thenreturn
910 rem draw explosion
920 printzb$"";:forz=1tob:print"";:nextz:printspc(4+a*2)xp$
930 forz=10to20:pokes+4,33:pokes+1,z:pokes,10:pokes+4,32:nextz
940 printzb$"";:forz=1tob:print"";:nextz:printspc(4+a*2)ba$
950 ag(a,b)=0:re=re+1:at=at+1:sc=sc+re:gosub280:return
960 getb$:ifb$=chr$(147)then1140
970 ifb$<>"_"thena$=b$:return
980 print"[146]"spc(10)"paused"
990 getb$:ifb$<>""thenprint"[146]"spc(10)ze$:return
1000 goto990
1010 rem nuclear meltdown
1020 printzb$""spc(6);:fort=1to8:fori=1to7:printxp$"[145]";
1030 pokes+4,129:pokes+1,t*10+i*10:pokes,50:pokes+4,128
1040 nexti:print:printspc(6)"";:nextt
1050 fort=1to50:poke53281,0:poke53281,1
1060 pokes+4,129:pokes+1,t:pokes,50:pokes+4,128:nextt:poke53281,0:pokes+24,0
1070 fort=1to1000:nextt:ifsc*ds>hsthenhs=sc*ds
1080 goto1140
1090 rem redraw atom
1100 print"":ifb=0thenprintspc(4+a*2)ba$:return
1110 print"";:fort=1tob:print"";:nextt:printspc(4+a*2)ba$:return
1120 print"":ifv=0thenprintspc(4+r*2)co$(co)at$:return
1130 print"";:fort=1tov:print"";:nextt:printspc(4+r*2)co$(co)at$:return
1140 rem reset
1150 poke36866,hs/256:poke36867,hs-int(hs/256)*256:pokes+24,0:clr
1160 hs=peek(36866)*256+peek(36867):s=54272:goto20