home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1987 January & February / rerun-1987-01-02.d64 / crosswords (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  7KB  |  235 lines

  1. 10 sc=1024:v=53248:s=sc+v:cc=sc+s:sp$="          ":dn$=""
  2. 20 a=rnd(-ti/100):fori=stos+24:pokei,0:next:pokes+24,15:poke788,52
  3. 30 print"[147][144]";:poke53280,14:poke53281,14:deffnr(x)=int(rnd(1)*100)+1
  4. 40 fori=828to866:reada:pokei,a:ck=ck+a:next
  5. 50 ifck<>5301thenprint"error in data (lines 2200-2240)":end
  6. 60 i=2:gosub2090:fori=0to15
  7. 70 print""spc(11)"crosswords"
  8. 80 print""spc(11)"c[157]r[157]o[157]s[157]s[157]w[157]o[157]r[157]d[157]s"
  9. 90 printdn$spc(7)"[159]crosswords"
  10. 100 printleft$(dn$,6)spc(25)"[158]c[157]r[157]o[157]s[157]s[157]w[157]o[157]r[157]d[157]s";
  11. 110 gosub2050:poke828,i:sys829:gosub2050:next
  12. 120 fori=1to11:gosub2050:poke828,i:sys829:next:fori=stos+6:pokei,0:next
  13. 130 dimla%(100):y=0
  14. 140 readi,a:ifi<0then160
  15. 150 forj=1toi:y=y+1:la%(y)=a:next:goto140
  16. 160 fori=1to75:x=fnr(0):y=fnr(0)
  17. 170 la%(0)=la%(x):la%(x)=la%(y):la%(y)=la%(0):next
  18. 180 poke198,0:print"[147][144]this game can be played by one to eight[144] players."
  19. 190 print"how many will be playing this game?  ";
  20. 200 geta$:ifa$=""then200
  21. 210 printa$:np=val(a$)
  22. 220 ifnp>0andnp<9then240
  23. 230 gosub2140:printspc(10)" not 1 to 8 - try again.  [146] ^[145][145]"spc(39);:goto200
  24. 240 dimpn$(np),ll%(np,8)
  25. 250 fori=0to63:reada:poke896+i,a:next
  26. 260 fori=1tonp:print"[147][151]when player prompt appears enter your   name.  ";
  27. 270 print"eight(8) alphabetic characters   or less."
  28. 280 ifnp=1then310
  29. 290 print"when your name appears followed by [158]code?[151]press any two ";
  30. 300 print"keys.  remember which keysyou press they will be needed later."
  31. 310 open1,0:print"player #"i"name? ";:input#1,a$:close1:print
  32. 320 x=asc(left$(a$,1)+chr$(0)):ifx<65orx>90thengosub2140:goto310
  33. 330 iflen(a$)>8thenprinta$", is more than eight letters.":gosub2140:goto310
  34. 340 forj=1tolen(a$):ifmid$(a$,j,1)=chr$(32)then360
  35. 350 ifmid$(a$,j,1)>chr$(64)andmid$(a$,j,1)<chr$(91)then370
  36. 360 a$=left$(a$,j-1)+chr$(96)+mid$(a$,j+1)
  37. 370 nextj
  38. 380 iflen(a$)<8thena$=a$+chr$(96):goto380
  39. 390 pn$(i)=a$:ifnp=1then450
  40. 400 poke198,0:print"   "pn$(i)"[158]code? --[146][157][157][151]";
  41. 410 geta$:ifa$=""then410
  42. 420 print" ";
  43. 430 getb$:ifb$=""then430
  44. 440 print" ":pn$(i)=pn$(i)+a$+b$:nexti
  45. 450 nt=int(40/np+.7):print"[147]"right$(dn$,9)"enter number of turns 1 to"nt"[144]";
  46. 460 open1,0:input#1,a$:close1:a$=a$+chr$(0):x=val(a$)
  47. 470 ifx<1orx>ntthengosub2140:printleft$(dn$,10)spc(30);:goto460
  48. 480 nt=x:print:print"[151]press any key to start.":poke198,0
  49. 490 geta$:ifa$=""then490
  50. 500 fori=1tonp:forj=1to8:ll%(i,j)=la%(fnr(0)):nextj,i
  51. 510 print"[147]";:i=0:gosub2090:poke828,15:sys829
  52. 520 poke2040,14:pokev+39,1:pokev,138:pokev+1,134:pokev+21,1:a$=""
  53. 530 fori=1to5:gosub2160:next:fori=1to8:a$=a$+right$(str$(i),1)+"-[157][157]"
  54. 540 next:print""spc(36)a$"";
  55. 550 printleft$(dn$,9)spc(33)"[158]score  "spc(33)"rnd    "spc(33)"h/score";
  56. 560 forj=1tont:forj1=1tonp:a=1
  57. 570 fori=0to280step40:pokesc+33+i,asc(mid$(pn$(j1),a,1))-64:pokecc+33+i,6
  58. 580 pokesc+38+i,ll%(j1,a):pokecc+38+i,6
  59. 590 ifnp=1then650
  60. 600 j2=j1+1:ifj2>npthenj2=1
  61. 610 pokesc+713+i,asc(mid$(pn$(j2),a,1))-64:pokecc+713+i,0
  62. 620 ck=0:ifj=ntthenifj2=1thenck=14:goto640
  63. 630 pokesc+716+i,ll%(j2,a)
  64. 640 pokecc+716+i,ck
  65. 650 a=a+1:nexti
  66. 660 printleft$(dn$,10)spc(33)""left$(str$(ll%(j1,0))+sp$,7);
  67. 670 printspc(36)"[158]"left$(str$(j)+sp$,4);
  68. 680 printspc(33)"[158]"left$(str$(ll%(0,0))+sp$,7);
  69. 690 gosub1320:ifa$<>"p"then720
  70. 700 ifnp>1thengosub840
  71. 710 goto800
  72. 720 gosub1480:ifa$="p"then700
  73. 730 ifnp>1thengosub840
  74. 740 printdn$spc(33)"[144]okay   "spc(33)"[y/n]? ";
  75. 750 geta$:ifa$="n"then720
  76. 760 ifa$<>"y"then750
  77. 770 iflk=-1then800
  78. 780 gosub1030:ford=stos+6:poked,0:next:ford=1to2000:next:sys829
  79. 790 ifll%(j1,0)>ll%(0,0)thenll%(0,0)=ll%(j1,0)
  80. 800 fori=0to7:ck=peek(cc+38+i*40)and15
  81. 810 ifck=14thenll%(j1,i+1)=la%(fnr(0))
  82. 820 next
  83. 830 lk=-1:nextj1,j:goto930
  84. 840 printleft$(dn$,13)spc(33)"[144]enter  "spc(33)"code.  ";
  85. 850 printspc(33)"--[146]     [157][157][157][157][157][157][157]";
  86. 860 geta$:ifa$=""then860
  87. 870 print" ";
  88. 880 getb$:ifb$=""then880
  89. 890 print" ";
  90. 900 a$=a$+b$
  91. 910 ifa$<>right$(pn$(j2),2)thengosub2140:printdn$"";:goto850
  92. 920 printdn$spc(33)"       ";spc(33)"       ";:return
  93. 930 pokev+21,0:pokev+16,0
  94. 940 print"";:fori=1to24:printspc(33)left$(sp$,7);:next:printspc(33)"    ";
  95. 950 printleft$(dn$,11)spc(33)" press "spc(33)"any key"spc(33)"to  see";
  96. 960 printspc(33)"scores";:poke198,0
  97. 970 geta$:ifa$=""then970
  98. 980 print"[147]":fori=1tonp:printleft$(pn$(i),8)">"ll%(i,0):print:next
  99. 990 print"another game [y/n]?":poke198,0
  100. 1000 geta$:ifa$="y"thenrun
  101. 1010 ifa$<>"n"then1000
  102. 1020 sys2048
  103. 1030 gosub1290:ifpeek(sl)=32thensl=sl-d1
  104. 1040 ifpeek(p1-d1/2)<>c1andpeek(p1-d1)<>32thenfl=fl+.5
  105. 1050 ifpeek(p1+d1/2)<>c1andpeek(p1+d1)<>32thenfl=fl+.5
  106. 1060 iffl>0thenfl=0:goto1080
  107. 1070 fl=dx:dx=dy:dy=fl:gosub1290
  108. 1080 ifpeek(p1-d1/2)<>c1andpeek(p1-d1)<>32thenp1=p1-d1:fl=fl+.5:goto1080
  109. 1090 fori=p1tosl-d1stepd1
  110. 1100 if(peek(i+s)and15)+(peek(i+s+d1)and15)=30thenfl=fl+1:goto1120
  111. 1110 next
  112. 1120 fori=p1toslstepd1
  113. 1130 if(peek(i+s)and15)=15then1160
  114. 1140 ifpeek(i-d2/2)<>c2andpeek(i-d2)<>32thend2=-d2:goto1190
  115. 1150 ifpeek(i+d2/2)<>c2andpeek(i+d2)<>32then1190
  116. 1160 gosub1260
  117. 1170 next:iffl>.5andlu>1thenfori=sptoslstepd1:gosub1250:next
  118. 1180 fl=0:return
  119. 1190 p2=i:ifd2>0then1230
  120. 1200 ifpeek(i+d2/2)<>c2andpeek(i+d2)<>32theni=i+d2:goto1200
  121. 1210 ifi<p2thengosub1260:i=i-d2:goto1210
  122. 1220 d2=-d2
  123. 1230 ifpeek(i)<>32thengosub1260:ifpeek(i+d2/2)<>c2theni=i+d2:goto1230
  124. 1240 i=p2:goto1160
  125. 1250 if(peek(i+s)and15)=15or(peek(i+s)and15)=0thenreturn
  126. 1260 ll%(j1,0)=ll%(j1,0)+1:pokei+s,(peek(i+s)and15)+1
  127. 1270 printleft$(dn$,10)spc(33)""left$(str$(ll%(j1,0))+sp$,7);
  128. 1280 gosub2180:return
  129. 1290 c1=64:c2=93:d1=80:d2=2:p1=sp:fl=0
  130. 1300 ifdxthenc1=93:c2=64:d1=2:d2=80
  131. 1310 return
  132. 1320 poke198,0:printdn$spc(33)"cursor "spc(33)" keys. ";
  133. 1330 printspc(33)"dir h/v[146]"spc(33)"p=pass [146]";:goto1350
  134. 1340 gosub1930:iffl=1thengosub2140:fl=0
  135. 1350 geta$:ifa$=""then1350
  136. 1360 dx=16*(a$="[157]")-16*(a$=""):dy=16*(a$="[145]")-16*(a$=""):ifdxordythen1340
  137. 1370 ifa$="p"thenfori=0to7:pokecc+38+i*40,14:next:goto1470
  138. 1380 ifa$<>"h"anda$<>"v"thengosub2140:goto1350
  139. 1390 gosub2010:ifpeek(sl)<>32thengosub2140:goto1350
  140. 1400 dx=-16*(a$="h"):dy=-16*(a$="v"):sp=sl:ifll%(0,0)=0thenlk=0:goto1470
  141. 1410 ifdxthen1450
  142. 1420 ifpeek(sp-40)=64then1470
  143. 1430 ifpeek(sp-80)<>32thenlk=0
  144. 1440 goto1470
  145. 1450 ifpeek(sp-1)=93then1470
  146. 1460 ifpeek(sp-2)<>32thenlk=0
  147. 1470 fl=0:printdn$spc(33)left$(sp$,7)spc(33)""left$(sp$,7);:return
  148. 1480 lu=0:poke198,0:printdn$spc(33)"spell  "spc(33)" [1-8] ";:
  149. 1490 printspc(33)"d[146]elete "spc(33)"return [146]";
  150. 1500 geta$:ifa$=""then1500
  151. 1510 ifa$=chr$(13)then1630
  152. 1520 ifa$="d"then1770
  153. 1530 ifval(a$)<1orval(a$)>8orfl=1thengosub2140:goto1500
  154. 1540 ck=peek(cc+38+40*(val(a$)-1))and15
  155. 1550 ifck=14thengosub2140:goto1500
  156. 1560 pokesl,peek(sc+38+40*(val(a$)-1)):pokesl+s,0:lu=lu+1
  157. 1570 pokecc+38+40*(val(a$)-1),14:iflk=-1thengosub1660
  158. 1580 gosub1930
  159. 1590 iffl=1then1500
  160. 1600 ifpeek(sl)=32then1500
  161. 1610 iflk=-1thenlk=sl-sp+1
  162. 1620 goto1580
  163. 1630 iflk=-1thengosub2140:goto1500
  164. 1640 ifsp=slandpeek(sl)=32thengosub2140:goto1500
  165. 1650 fl=0:printdn$spc(33)left$(sp$,7)spc(33)""left$(sp$,7);:return
  166. 1660 ifdxthen1720
  167. 1670 ifpeek(sl-1)=93then1690
  168. 1680 ifpeek(sl-2)<>32thenlk=sl-sp+1:goto1760
  169. 1690 ifpeek(sl+1)=93then1740
  170. 1700 ifpeek(sl+2)<>32thenlk=sl-sp+1
  171. 1710 goto1760
  172. 1720 ifpeek(sl-40)=64then1740
  173. 1730 ifpeek(sl-80)<>32thenlk=sl-sp+1:goto1760
  174. 1740 ifpeek(sl+40)=64then1760
  175. 1750 ifpeek(sl+80)<>32thenlk=sl-sp+1
  176. 1760 return
  177. 1770 poke198,0:printdn$spc(33)"[153]w[146]ord   "spc(33)"l[146]etter ";:
  178. 1780 printspc(33)"n[146]one   "spc(33)"       [146]";
  179. 1790 dx=-dx:dy=-dy:lu=lu-1
  180. 1800 geta$:ifa$=""then1800
  181. 1810 ifa$="n"then1910
  182. 1820 ifa$<>"w"anda$<>"l"thengosub2140:goto1800
  183. 1830 ifpeek(sl)<>32then1860
  184. 1840 ifsl=spthen1910
  185. 1850 gosub1930
  186. 1860 ck=peek(sl+s)and15:ifck=15then1840
  187. 1870 a=peek(sl):pokesl,32:ifsl-sp+1=lkthenlk=-1
  188. 1880 fori=1062to1342step40:ck=peek(i+s)and15
  189. 1890 ifpeek(i)=aandck=14thenpokei+s,6:pokesl+s,14:i=1342
  190. 1900 next:ifa$="w"thenlk=-1:lu=0:goto1840
  191. 1910 fl=0:dx=-dx:dy=-dy:ifa$="w"thengosub1320:ifa$="p"then1650
  192. 1920 goto1480
  193. 1930 ifdxthen1960
  194. 1940 y=peek(v+1)+dy:ify<50ory>245the