home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1993 December / 1993-12.d64 / chain.bas (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  118 lines

  1. 5 rem copyright 1993 - compute publications intl ltd - all rights reserved
  2. 10 rem setup
  3. 20 poke53281,0:poke53280,0:poke53282,11:poke53283,1:geta$:geta$
  4. 30 dimag(8,9):printchr$(8)
  5. 40 s=54272:fort=stos+24:poket,.:nextt:pokes+5,9
  6. 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$="       "
  7. 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]"
  8. 70 co$(1)="[149]":co$(2)="[150]":co$(3)="[151]":co$(4)="[152]":co$(5)="[153]":co$(6)="[155]"
  9. 80 sc=0:at=0:fort=1to7:fori=1to8:ag(t,i)=.:nexti:nextt:di=1:ds=0:ba$="[146]  [157][157]  [145]"
  10. 90 di$(1)="practice":di$(2)="easy":di$(3)="moderate":di$(4)="hard"
  11. 100 r=0:v=0:c=2:de$="n":xp$="[151]lm[157][157]no"
  12. 110 rem draw screen
  13. 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]"
  14. 130 printzg$za$"[195][195][195][195][195]";
  15. 140 fort=1to16:print"     [194]"spc(14)"[194]":nextt:print"     [196]"za$"[197]"spc(30)"[151][146][210][212][214]";
  16. 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]";
  17. 160 print"[157][157][157][157][177][178][184][180][181]"zc$"[182][183][184][185][177]"zb$""zd$;:fort=1to6:fori=1to7
  18. 170 printco$(int(rnd(0)*6)+1)at$;:nexti:print:printzd$"";:nextt
  19. 180 rem start
  20. 190 poke53247,0:sys49323:pokes+24,15
  21. 200 printzb$""spc(28)""zf$""zc$"[157]"zf$""zc$"[157]"zf$:gosub280
  22. 210 printzb$""zd$"[159]f1-gameplay:":printzd$ze$ze$;"[145]"
  23. 220 printzd$spc(7-len(di$(di))/2)di$(di):ifdi=1thends=0
  24. 230 printzd$"[159] press return":printzd$"   to start"
  25. 240 ifa$=""thengosub960:goto240
  26. 250 ifa$="[133]"thendi=di+1:ifdi=5thendi=1
  27. 260 ifa$=chr$(13)then310
  28. 270 a$="":ds=2*di-3:goto210
  29. 280 rem print score
  30. 290 printzb$"":jj=hs:gosub300:jj=sc*ds:gosub300:jj=at:gosub300:return
  31. 300 print""spc(35-len(str$(jj)))mid$(str$(jj),2,10):return
  32. 310 rem clear area
  33. 320 printzb$"";:fort=1to16:printzd$"[146]"ze$ze$:nextt
  34. 330 rem new atom
  35. 340 printzb$""zg$:co=c:d$="n"
  36. 350 fort=22to18step-1:printzb$spc(t)co$(co)at$;:ift=19thenprint"[199][157][199]":goto370
  37. 360 print" [157] ":gosub960:v=0:r=7:tm=10:re=0
  38. 370 gosub960:nextt:c=int(rnd(0)*6)+1:printzb$spc(23)co$(c)"[208][209][157][157]  ":gosub960
  39. 380 printzb$spc(23)co$(c);at$:gosub960
  40. 390 rem input from joystick
  41. 400 jv=peek(56320):fr=jvand16:jv=15-(jvand15):a=r:v=0:b=v
  42. 410 ifjv=4thenr=r-1:ifr=0thenr=1
  43. 420 ifjv=4then460
  44. 430 ifjv=8thenr=r+1:ifr=8thenr=7
  45. 440 ifjv=8then460
  46. 450 iffr<>16then490
  47. 460 ifa<>rthengosub1090
  48. 470 tm=tm-1:iftm=0then490
  49. 480 gosub1120:gosub960:goto400
  50. 490 rem drop atom
  51. 500 printzb$"     [151][193]"ze$ze$
  52. 510 a=r:b=v:v=v+1:ifag(r,v)<>0orv=9thenv=v-1:goto540
  53. 520 gosub1090:gosub1120:gosub960
  54. 530 goto510
  55. 540 ag(r,v)=co:ifv=0then1010
  56. 550 rem reaction
  57. 560 f$="n":fort=1to8:fori=1to7:ifag(i,t)=0orag(i,t)=10then610
  58. 570 ifag(i,t+1)=0andt<8thenag(i,t+1)=ag(i,t):ag(i,t)=0:f$="1":gosub630:goto610
  59. 580 ifag(i,t+1)=ag(i,t)andt<8thena=i:b=t+1:f$="2":gosub890
  60. 590 ifag(i-1,t)=ag(i,t)andi>1thena=i-1:b=t:f$="2":gosub890
  61. 600 iff$="2"thena=i:b=t:f$="1":gosub890:f$="1"
  62. 610 nexti:nextt:iff$="n"then660
  63. 620 goto550
  64. 630 rem pull atom down
  65. 640 printzb$""spc(i*2+4);:forj=1tot:print"";:nextj:printba$:printzb$"";
  66. 650 printspc(i*2+4);:forj=1tot+1:print"";:nextj:printco$(ag(i,t+1))at$:return
  67. 660 rem difficulty check
  68. 670 ifdi=2andd$="n"then750
  69. 680 ifdi=3andd$="n"then750
  70. 690 ifdi>2then710
  71. 700 goto330
  72. 710 rem draw block
  73. 720 i=int(rnd(0)*7)+1:t=int(rnd(0)*7)+2:ag(i,t)=10:printzb$""spc(4+i*2);
  74. 730 forz=1tot:print"";:nextz:printbl$
  75. 740 forz=10to1step-.5:pokes+4,32:pokes+1,z:pokes,10:pokes+4,33:nextz:goto330
  76. 750 rem draw zapper
  77. 760 a=int(rnd(0)*8)+1:ifa=2then760
  78. 770 ifdi=2thena=int(rnd(0)*5)+4
  79. 780 printzb$""spc(6);:fort=1toa:print"";:nextt:fort=1to7:print"[153][174][175]";
  80. 790 forz=1to100step50:pokes+4,33:pokes+1,z:pokes,10:pokes+4,32:nextz
  81. 800 ifag(t,a)<>0thenag(t,a)=int(rnd(0)*6)+1
  82. 810 nextt:d$="y":gosub820:goto550
  83. 820 rem redraw area
  84. 830 printzb$""spc(6);:fort=1to8:fori=1to7
  85. 840 ifag(i,t)=0thenprintba$;:goto870
  86. 850 ifag(i,t)=10thenprintbl$;:goto870
  87. 860 printco$(ag(i,t))at$;
  88. 870 nexti:print:printspc(6)"";:nextt:return
  89. 880 pokes+4,128:pokes+1,10:pokes,10:pokes+4,129
  90. 890 ifa=i and b=t and ag(i,t+1)=ag(i,t)thenreturn
  91. 900 ifa=i and b=t and ag(i+1,t)=ag(i,t)thenreturn
  92. 910 rem draw explosion
  93. 920 printzb$"";:forz=1tob:print"";:nextz:printspc(4+a*2)xp$
  94. 930 forz=10to20:pokes+4,33:pokes+1,z:pokes,10:pokes+4,32:nextz
  95. 940 printzb$"";:forz=1tob:print"";:nextz:printspc(4+a*2)ba$
  96. 950 ag(a,b)=0:re=re+1:at=at+1:sc=sc+re:gosub280:return
  97. 960 getb$:ifb$=chr$(147)then1140
  98. 970 ifb$<>"_"thena$=b$:return
  99. 980 print"[146]"spc(10)"paused"
  100. 990 getb$:ifb$<>""thenprint"[146]"spc(10)ze$:return
  101. 1000 goto990
  102. 1010 rem nuclear meltdown
  103. 1020 printzb$""spc(6);:fort=1to8:fori=1to7:printxp$"[145]";
  104. 1030 pokes+4,129:pokes+1,t*10+i*10:pokes,50:pokes+4,128
  105. 1040 nexti:print:printspc(6)"";:nextt
  106. 1050 fort=1to50:poke53281,0:poke53281,1
  107. 1060 pokes+4,129:pokes+1,t:pokes,50:pokes+4,128:nextt:poke53281,0:pokes+24,0
  108. 1070 fort=1to1000:nextt:ifsc*ds>hsthenhs=sc*ds
  109. 1080 goto1140
  110. 1090 rem redraw atom
  111. 1100 print"":ifb=0thenprintspc(4+a*2)ba$:return
  112. 1110 print"";:fort=1tob:print"";:nextt:printspc(4+a*2)ba$:return
  113. 1120 print"":ifv=0thenprintspc(4+r*2)co$(co)at$:return
  114. 1130 print"";:fort=1tov:print"";:nextt:printspc(4+r*2)co$(co)at$:return
  115. 1140 rem reset
  116. 1150 poke36866,hs/256:poke36867,hs-int(hs/256)*256:pokes+24,0:clr
  117. 1160 hs=peek(36866)*256+peek(36867):s=54272:goto20
  118.