home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 73 / 073.d81 / alphametix (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1990-01-01  |  23.9 KB  |  958 lines

  1. 10 rem alphametix
  2. 20 rem (c)ian adam 1990
  3. 40 ifathenrun50
  4. 48 gosub9000
  5. 50 gosub9100
  6. 100 gosub10000
  7. 110 gosub12900
  8. 120 onregosub20000,200,7000,8000,11000,9500
  9. 140 goto100
  10. 200 clr:gosub5000
  11. 210 ifefthen13000
  12. 220 gosub6000
  13. 230 ifefthen13000
  14. 250 gosub12700:ifre=1then350
  15. 260 ifre=2orre=3thengosub6290:goto250
  16. 265 ifre=6thenifpeek(828)thengosub16000:goto250
  17. 270 ifre=7thenrun50
  18. 275 ifre-4thenrun200
  19. 295 sys51200:tj=co:sj=10:pokepr+3,lr
  20. 300 fori=.to10:u(i)=.:l(i)=.:cl(i)=.:un$(i)="":next
  21. 310 aa=.:ef=.:cc=.:nc=.:ma=.:s=.:x$="[150]< [212]he end >
  22. 315 [153]"load":[141]14000
  23. 320 [129]i[178]1[164]r:d$[178]" "[170]rw$(i):[141]5800:[130]:[141]6020:[137]230
  24. 350 [141]6500
  25. 360 [139][194](pr[170]1)[178].[167] 700
  26. 400 [139][194](2)[167][141]2000
  27. 410 [139]ef[167]530
  28. 500 [141]2200
  29. 510 [139]re[178]7[167]600
  30. 520 [139]b[178]20[167][141]15000:[141]2400:[141]14500:[139]re[178]7[167]600
  31. 530 [158]51203:[141]6800
  32. 540 [137]360
  33. 600 [151]pr[170]1,.:m[178]1
  34. 610 x$[178]"def <(NULL)utput terminated>
  35. 620 print""x$
  36. 630 goto820
  37. 700 ifsthen800
  38. 730 print"[159]   [211]orry.. no solution to be found   [155]
  39. 740 [139][194](829)[167][141]11900
  40. 760 [137]840
  41. 800 [153]"open  no more solutions ... "
  42. 810 [139][194](829)[167][151]2,3:[141]7910
  43. 820 b[178]s[171]20[172][181]((s[171]1)[173]20)
  44. 830 [141]4300
  45. 840 [141]12300
  46. 850 [139]re[178]1[167][139]s[167][141]4000
  47. 860 [139]re[178]3[167]295
  48. 870 [139]re[178]4[167]920
  49. 880 [139]re[178]5[167][138]200
  50. 890 [139]re[178]7[167][138]50
  51. 900 [137]840
  52. 920 [151]832,[194](832)[176][194](829)
  53. 930 [151]829,1[171][194](829)
  54. 940 [141]6900:[137]840
  55. 1000 cs$(21)[178]"prime":cs$(22)[178]"not prime":cs$(23)[178]"square":cs$(24)[178]"not square
  56. 1010 cs$(26)="even":cs$(27)="odd":cs$(28)="1 or 2":cs$(29)="unknown
  57. 1020 [153]"load":[141]14000
  58. 1030 [153]""
  59. 1040 [129]i[178]1[164]r[171]1
  60. 1050 [153]i
  61. 1060 [130]
  62. 1070 [153]:[153]i
  63. 1080 [139]nc[179]9[167]1140
  64. 1100 [153]"open"[163]99)"valnough!
  65. 1110 printtab(59)"[159][208]ress a key.[155]
  66. 1120 [146]k,15:[161]a$:[142]
  67. 1140 [153]"open"[163]60)"right$f you have a clue
  68. 1150 print,,"for one letter,"tab(60)"press that letter.
  69. 1160 [153][163]60)"right$f the clue is for":[153],,"a line in the
  70. 1170 print,,"puzzle, press the"tab(60)"line #.
  71. 1180 [153][163]60)"(NULL)o more clues:  asc1list
  72. 1190 waitk,15:geta$
  73. 1200 a1$=chr$(asc(a$)+32):xx$="                   "
  74. 1210 ifval(a$)then1530
  75. 1220 ifa$="[133]"thenreturn
  76. 1240 fori=1tonm
  77. 1250 ifun$(i)=a1$then1280
  78. 1260 next
  79. 1270 printtab(60)"[150][212]hanks a lot![155]":gosub10200
  80. 1274 fori=1to1500:next:goto1020
  81. 1280 print"[159]",,"[208]ress a number for
  82. 1284 [153],,"the letter " a1$ ", or:
  83. 1286 print,,xx$
  84. 1288 print,,"a  if even   "
  85. 1290 print,,"b  if odd         "
  86. 1295 print,,"c  if it could be "
  87. 1296 print,,"   one or two     [155]
  88. 1298 [153],,xx$:[153],,xx$:[153],,xx$
  89. 1300 [146]k,15:[161]b$:[141]10200
  90. 1305 tj[178][198](b$)[171]48[170]7[172](b$[177]"9"):[139]tj[179].[176]tj[177]12[167]1270
  91. 1310 sj[178]so(i):[139]tj[179]10[167]1410
  92. 1320 [139]sj[179]10[167]1390
  93. 1330 [145]sj[171]9[137]1340,1350,1360,1480,1370,1480,1380
  94. 1340 [145]tj[171]9[137]1270,1510,1720
  95. 1350 [145]tj[171]9[137]1510,1270,1700
  96. 1360 [145]tj[171]9[137]1720,1700,1270
  97. 1370 [145]tj[171]9[137]1510,1480,1700
  98. 1380 [145]tj[171]9[137]1480,1480,1700
  99. 1390 [153][163]60)a1$" is"sj"  ok?":[146]k,15:[161]a$
  100. 1395 [139]a$[178]"n"[167]ef[178]6:[142]
  101. 1400 [137]1020
  102. 1410 [139]sj[178]tj[167]1270
  103. 1420 [139]sj[179]10[167]ef[178]6:[142]
  104. 1430 [141]1900:[139]a1[178].[167]ef[178]6:[142]
  105. 1440 nc[178]nc[170]1:cs$(nc)[178]a1$[170]" must be"[170][196](tj)
  106. 1445 u(tj)[178]1:l(i)[178]1:tr(i)[178]tj:so(i)[178]tj
  107. 1450 [129]n[178]1[164]nm:[139]i[178]n[167]1470
  108. 1460 [139]tj[178]so(n)[167]ef[178]5:[142]
  109. 1470 [130]:[137]1020
  110. 1480 so(i)[178]tj:nc[178]nc[170]1:cs$(nc)[178]a1$[170]" must be "[170]cs$(tj[170]16)
  111. 1490 :
  112. 1500 [137] 1020
  113. 1510 ef[178]6:[142]
  114. 1530 a[178][197](a$):[139]a[179]1[176]a[177]r[167]1270
  115. 1532 [153]"open",,xx$
  116. 1540 [153],,"on(NULL)ine"a"cmd:  "rw$(a)
  117. 1542 [153],,xx$:[153],,"(NULL)ell me.. is it:  "
  118. 1544 [153],,"a  even           "
  119. 1546 [153],,"b  odd            "
  120. 1548 [153],,"c  prime          "
  121. 1550 [153],,"d  not prime      "
  122. 1552 [153],,"e  square         "
  123. 1554 [153],,"f  not square      "
  124. 1556 [153],,"0  none of these   "
  125. 1560 [153],,xx$:[153],,"(NULL)lease press a key.list
  126. 1565 waitk,15:getb$
  127. 1570 gosub10200:b=asc(b$)-64:i=co(a,1):ifb<1orb>6then1270
  128. 1580 ifb>2then1600
  129. 1590 nc=nc+1:cs$(nc)=rw$(a)+" is "+cs$(25+b):tj=9+b
  130. 1595 a1$=un$(i):goto1310
  131. 1600 b=b-2:cl(a)=b:poke50288+a,b:nc=nc+1:cs$(nc)=rw$(a)+" is "+cs$(b+20)
  132. 1610 iflen(rw$(a))<9then1620
  133. 1615 cl(a)=.:print"[195]an't be sure":cs$(nc)=cs$(nc)+"..?
  134. 1620 [139]b[178]1[167][139][195](rw$(a))[178]1[167]1690
  135. 1630 [145]b[137]1640,1020,1670,1020
  136. 1640 [145]so(i)[170]1[137]1510,1020,1510,1020,1510,1510,1510,1020,1510,1020
  137. 1645 [145]so(i)[171]9[137]1510,1660,1700
  138. 1650 [139]so(i)[178]16[167]1510
  139. 1660 so(i)[178]14:[137]1020
  140. 1670 [145]so(i)[170]1[137]1020,1020,1510,1510,1020,1020,1020,1510,1510,1020
  141. 1680 [145]so(i)[171]9[137]1020,1020,1700,1710,1510,1710
  142. 1690 [145]so(i)[170]1[137]1510,1020,1020,1020,1510,1020,1510,1020,1510,1510
  143. 1695 [145]so(i)[171]9[137]1720,1020,1020,1020
  144. 1700 so(i)[178]1:tr(i)[178]1:u(1)[178]1:l(i)[178]1:nc[178]nc[170]1:cs$(nc)[178]un$(i)[170]" is 1":[137]1450
  145. 1710 so(i)[178]16:[137]1020
  146. 1720 so(i)[178]2:tr(i)[178]2:u(2)[178]1:l(i)[178]1:nc[178]nc[170]1:cs$(nc)[178]un$(i)[170]" is 2":[137]1450
  147. 1900 a1[178].:[145] sj[171]9[137]1910,1910,1920,1940,1950,1960,1970
  148. 1910 a1[178]sj[170]tj[170]1[175]1:[142]
  149. 1920 [139]tj[179]3[167]a1[178]tj
  150. 1930 [142]
  151. 1940 a1[178]1:[142]
  152. 1950 a1[178][182](3[171][182](tj[171]5))[178]1:[142]
  153. 1960 a1[178]tj:[142]
  154. 1970 a1[178][182](k2[171][182](tj[171]5))[171]k1:[142]
  155. 2000 [129]i[178]1[164]r
  156. 2010 n[178]cl(i):[139]n[178].[176]n[177]4[167]2080
  157. 2020 a[178].:c[178]10
  158. 2030 [129]a1[178][195](rw$(i))[164]1[169][171]1:a[178]c[172]a[170]tr(co(i,a1)):[130]
  159. 2040 [139]n[177]2[167]2070
  160. 2050 [141]7800:[139]n[170](a1[177].)[178]1[167]2080
  161. 2060 ef[178]c:[142]
  162. 2070 b[178][181]([186](a)[172]a2):[139] n[178]3[171](a[178]b[172]b) [167] ef[178]c:[142]
  163. 2080 [130]
  164. 2090 ef[178].:[142]
  165. 2200 a[178]36:s[178]s[170]1:a$[178]""
  166. 2210 [153]""[163]16)s""
  167. 2220 [129]i[178]1[164]nm
  168. 2230 [153][163]a)tr(i)
  169. 2240 [130]
  170. 2250 b[178]s[171]20[172][181]((s[171]1)[173]20)
  171. 2260 [129]i[178]1[164]nm:sl(b,i)[178]tr(i):[130]
  172. 2270 [129]a1[178]1[164]lr:a$[178][201]([196](tr(co(r,a1))),1)[170]a$:[130]
  173. 2280 sl$(b)[178]a$
  174. 2300 [139][194](829)[167][141]11900
  175. 2330 [139][194](832)[170][194](k)[178].[167][142]
  176. 2340 [161]a$:[141]12000
  177. 2400 [139]re[178]1[167][142]
  178. 2410 [139]re[178]3[167][151]832,1[171][194](832):[137]6900
  179. 2420 [139]re[178]5[167][151]832,[194](832)[176][194](829):[151]829,1[171][194](829):[137]6900
  180. 2430 [142]
  181. 4000 cs$(1)[178]"prime":cs$(2)[178]"odd":cs$(3)[178]"even":cs$(4)[178]"square":cs$(5)[178]"not sqr
  182. 4010 m1$="[150][198]1 [205]ore analysis":sj=1
  183. 4020 print"[147][150]  [208]uzzle [193]nalysis:
  184. 4030 [153]"  ================list
  185. 4040 print" #  "rw$(r)tab(14)"factor square
  186. 4050 [129]i[178]sj[164]sj[170]19
  187. 4060 [153]sj[163]4)ts$(sj);
  188. 4070 a[178][197](ts$(sj)):[141]7800
  189. 4080 [139]a1[177]2[167]a1[178]1
  190. 4090 b[178][181]([186](a)[172]a2)
  191. 4100 [153][163]14)cs$(a1[170]1)[163]21)cs$((a[178]b[172]b)[170]5)
  192. 4110 [139]sj[177][178]s[167][153]x$;:[142]
  193. 4120 sj[178]sj[170]1
  194. 4130 [130]
  195. 4140 [139]sj[177]59[167][153]x$;:[142]
  196. 4150 [139]sj[179][178]s[167][153]"...more";
  197. 4200 [141]12310
  198. 4210 [139](re[178]1)[172](sj[179][178]s)[167]4020
  199. 4220 [142]
  200. 4300 [139]s[179]61[167][129]i[178]1[164]b:ts$(i[170]s[171]b)[178]sl$(i):[130]:[142]
  201. 4310 x$[178]"end memory":[142]
  202. 4500 [160]1:[159]1,8,15
  203. 4510 [160]2:[159]2,8,8,"puzzles.tst
  204. 4520 input#1,a,b$
  205. 4530 ifa>19thenprint:input"[206]eed program disk";a$:close2:close1:run200
  206. 4540 get#2,a$:r=asc(a$)
  207. 4600 fori=1tor
  208. 4610 input#2,rw$(i)
  209. 4620 rt(i)=12-len(rw$(i))
  210. 4630 next
  211. 4640 b$="":nc=.:za=.:zb=.:cs$(1)="":input#2,b$
  212. 4650 ifb$>" "thencs$(1)=mid$(b$,3):za=asc(b$):zb=asc(mid$(b$,2)):nc=1
  213. 4660 lr=len(rw$(r)):cc=.
  214. 4670 get#2,a$:aa=asc(a$+chr$(0))
  215. 4700 print"[147]":gosub14000
  216. 4705 ifaa=.thenprint"[204]ast puzzle![155]
  217. 4710 [153]" asc1  atnccept this
  218. 4720 ifaathenprint" [198]3  [206]ext puzzle
  219. 4730 [153]" asc5  (NULL)uit
  220. 4750 gosub 12900
  221. 4760 ifre=3thenifaathenr=aa:goto4600
  222. 4770 close2:close1
  223. 4780 ifre-1thenrun50
  224. 4800 fori=1tor:print"*"
  225. 4810 d$=" "+rw$(i)
  226. 4820 gosub5800
  227. 4830 next
  228. 4840 pokepr+3,lr:print"[147]
  229. 4890 [142]
  230. 5000 [134]i,c,n,tj,a1,sj,r,lr,ma,nm,b,nc,p,cc,m,x$,xx$,ef,aa
  231. 5010 [141]9100:[151]bg,6:[151]bg[170]1,.
  232. 5020 [153]"loaddef":[153][163]5)"valnter a puzzle"[163]45)"--------------list
  233. 5030 print"[200]ow many lines in the puzzle,
  234. 5040 [153]"including the sum?
  235. 5050 print"[208]ress a key for 3 to 9 lines
  236. 5060 [153]:[153]"asc1: puzzle from disk
  237. 5070 print"[198]7: quit"
  238. 5100 co=50336:ru=50176:tr=ru+32:sx=ru+16:nd=ru+48:so=ru+64:rp=ru+80:ln=rp+16
  239. 5110 cl=rp+32:pr=50688:di=50496:dimtr(10),co(10,10),so(10)
  240. 5120 dimrw$(9),sl(20,10),u(10),cl(10),l(10),cs$(29),sl$(20),ts$(60),rt(9)
  241. 5130 tj=co:sj=10:sys51200
  242. 5150 waitk,15:geta$
  243. 5160 ifa$="[133]"then4500
  244. 5170 r=val(a$):printr:ifr<3thenef=1:return
  245. 5200 print"[147][150]"tab(45)"[197]nter the puzzle"tab(45)"----------------[155]
  246. 5220 [153]"(NULL)ress (NULL)val(NULL)(NULL)(NULL)(NULL) after each line:
  247. 5240 fori=1tor-1
  248. 5250 print"line"i
  249. 5260 next
  250. 5270 print," -------
  251. 5280 [153]"the sum
  252. 5300 fori=1tor
  253. 5310 gosub5600
  254. 5320 rw$(i)=mid$(d$,2)
  255. 5330 rt(i)=12-b:lr=b
  256. 5340 ifefthenreturn
  257. 5350 next
  258. 5370 pokepr+3,lr
  259. 5380 ifma>lrorlr>ma+1thenef=3
  260. 5390 ifnm<2thenef=4
  261. 5400 return
  262. 5600 b$="":d$=" "
  263. 5610 syscr,i+6,18
  264. 5620 print"                  "
  265. 5630 syscr,i+7-(i=r),17
  266. 5640 print"[158]*[159] _ [197]nter this line
  267. 5650 [137]5680
  268. 5670 [158]cr,i[170]7[171](i[178]r),18[171][195](d$):[153]"sys"d$
  269. 5680 [146]k,15:[161]a$:c$[178]a$
  270. 5690 [139][195](b$)[179]1[167]5740
  271. 5700 [139]a$[178][199](13)[167]5800
  272. 5710 [139]a$[178][199](20)[167]b$[178][200](b$,[195](b$)[171]1):d$[178][200](d$,[195](d$)[171]1):[137]5670
  273. 5720 [139]a$[178]" "[167]5760
  274. 5740 [139]a$[179]"!"[176]a$[177]"_"[167]5680
  275. 5750 [139]a$[177]"@"[167][139]a$[179]"["[167]c$[178][199]([198](a$)[170]32)
  276. 5760 b$[178][200](b$,8)[170]a$:d$[178][200](d$,9)[170]c$
  277. 5770 [137]5670
  278. 5800 tj[178]tj[170]12:b[178][195](d$)[171]1:[151]ln[170]i,b
  279. 5810 [139]i[178]r[167]5850
  280. 5820 aa[178]aa[171](b[178]ma)
  281. 5830 [139]b[177]ma[167]aa[178].:ma[178]b
  282. 5850 [129]n[178]1[164]b
  283. 5860 c$[178][200]([201](d$,n),1)
  284. 5870 [139]c$[179][199](97)[167]a[178].:un$(.)[178]c$:l(.)[178]1:[137]5940
  285. 5880 [129]a[178]1[164]sj
  286. 5890 [139]un$(a)[178]c$[167]5940
  287. 5900 [139]un$(a)[178]""[167]un$(a)[178]c$:nm[178]a:[137]5940
  288. 5910 [130]
  289. 5920 ef[178]2:[142]
  290. 5940 co(i,n)[178]a:[151] tj[170]n,a
  291. 5950 [130]n
  292. 5960 [153]"list";:[142]
  293. 6000 [153]"load":[141]14000
  294. 6020 [153]"right$nteresting problem.
  295. 6030 print"[201]t has"nm"letters:
  296. 6040 [129]i[178]1[164]nm
  297. 6050 [153]" "un$(i);
  298. 6060 so(i)[178]13:tr(i)[178]sj
  299. 6070 [130]:[153]
  300. 6080 cs$(.)[178]"no leading zeros":nc[178].
  301. 6090 [153]"right$ assume the first letter in
  302. 6100 print"a line can't be zero.
  303. 6140 [139]lr[178]ma[167]6200
  304. 6145 a[178]co(r,lr)
  305. 6150 [139]aa[178]1[167]so(a)[178]12
  306. 6155 [139]aa[167]6200
  307. 6160 tr(a)[178]1:so(a)[178]1:u(1)[178]1:l(a)[178]1:nc[178]1
  308. 6170 cs$(1)[178][200](rw$(r),1)[170]" is 1
  309. 6180 print"[201] also find that "cs$(1)
  310. 6200 ifzbthenpoke631,za:poke632,zb:poke198,2:a$="y":goto6220
  311. 6210 print"[159][193]ny clues?  y/n
  312. 6215 [146]k,15:[161]a$
  313. 6220 [139]a$[178]"y"[167][153]a$;:cc[178]1:[141]1000:cc[178].
  314. 6240 [129]i[178]1[164]r
  315. 6250 a[178]co(i,[195](rw$(i)))
  316. 6260 [139]so(a)[178]13[167]so(a)[178]15
  317. 6270 [139]so(a)[178].[167]6450
  318. 6280 [130]
  319. 6290 [153]"load":[141]14000
  320. 6300 [153]"",,"list(NULL)ow ready to solve
  321. 6310 print,,"the puzzle.
  322. 6320 [139][194](829)[178].[167]6340
  323. 6330 [153]:[153],,"atnll solutions will":[153],,"be auto-printed.":[137]6360
  324. 6340 [139][194](828)[178].[167]6360
  325. 6350 [153]:[153],,"(NULL)olutions will not":[153],,"be auto-printed.
  326. 6360 print:print,,"[212]here will";
  327. 6370 ifpeek(832)=.thenprint" not";
  328. 6380 print:print,,"be a pause after
  329. 6390 [153],,"each solution.
  330. 6400 print:print,,"[213]se the function
  331. 6410 [153],,"keys to change
  332. 6420 print,,"these settings.
  333. 6430 [142]
  334. 6450 x$[178]""[170]cs$(0)[170][199](13)[170]un$(a)[170]" can't be 0!":ef[178]7:[142]
  335. 6500 [129]c[178]1[164]ma:i[178].
  336. 6510 [129]n[178]1[164]r[171]1
  337. 6520 [139]c[177][195](rw$(n))[167]6600
  338. 6530 a[178]co(n,c):[139]l(a)[176]a[178].[167]6600
  339. 6540 [139][194](rp[170]c)[178].[167][139]a[178]co(r,c)[167][151]rp[170]c,n:[137]6600
  340. 6550 i[178]i[170]1:l(a)[178]1
  341. 6560 [151]di[170]12[172]c[170]i,a
  342. 6600 [130]
  343. 6610 [151]nd[170]c,i:[139]l(co(r,c))[176][194](rp[170]c)[167]6630
  344. 6620 l(co(r,c))[178]1:[151]sx[170]c,1
  345. 6630 [130]
  346. 6640 [139]lr[177]ma[167][139]l(co(r,lr))[178].[167]l(co(r,lr))[178]1:[151]sx[170]lr,1
  347. 6650 [141]14500:n[178].
  348. 6660 [129]c[178]1[164]ma
  349. 6670 a[178]co(r,c):[139]l(a)[167]6700
  350. 6680 n[178]n[170]1:l(a)[178]1:[151]50640[170]n,a
  351. 6700 [130]
  352. 6710 [151]nd[170]12,n:[151]pr,r:[151]pr[170]2,ma
  353. 6720 [129]i[178].[164]10:[151]ru[170]i,u(i):[151]tr[170]i,tr(i):[151]so[170]i,so(i):[130]
  354. 6730 [158]51212
  355. 6740 m1$[178]"defasc1 lenontinue
  356. 6750 m6$="[198]6 [208]rint this
  357. 6760 m7$[178]"asc7 (NULL)uit
  358. 6770 gosub6900
  359. 6800 fori=1tonm
  360. 6810 tr(i)=peek(tr+i)
  361. 6820 next
  362. 6830 return
  363. 6900 ifpeek(832)thenm3$="[198]3 [206]o [193]uto-pause
  364. 6910 [139][194](832)[178].[167]m3$[178]"asc3 atnuto pause
  365. 6920 ifpeek(829)thenm5$="[198]5 [206]o [193]uto-print":return
  366. 6930 m5$="[198]5 [193]uto print":return
  367. 7000 pokebg,6:pokebg+1,.
  368. 7010 print"[147]"tab(90)"[146][150][208]rime numbers":print,"-------------[155]
  369. 7020 [153]"(NULL)ould you like to...
  370. 7030 print" 1. [212]est a number
  371. 7040 [153]" 2. (NULL)ist primes
  372. 7050 print" 3. [204]ist non-primes
  373. 7060 [153]" 4. (NULL)eturn to main menu
  374. 7070 gosub12900:fx=.
  375. 7080 onregoto7100,7200,7400:return
  376. 7100 print"[147][150] [212]est primes":print" -----------[155]
  377. 7110 [141]7600
  378. 7120 [139]c[178].[167]7000
  379. 7130 a[178][182](c):[141]7800
  380. 7140 [139]a1[178].[167][153]c"cmd is a prime";:[137]7170
  381. 7150 [153]c"cmd is not prime, being
  382. 7160 print"divisible by"a1;:ifc-a1*a1thenprint"and"c/a1;
  383. 7170 print:print "next?"
  384. 7180 gosub7630:goto7120
  385. 7200 print"[147][150] [204]ist primes":print" -----------[155]
  386. 7210 [141]7600
  387. 7220 [139]c[178].[176]c[177]1e9[167]7000
  388. 7230 tb[178].:[153]"loaddef (NULL)rime numbers:":[158]cr,24:[153]" (any key=stop)list
  389. 7240 ford=1to69
  390. 7250 a=abs(c):gosub7800:c=c+1
  391. 7260 ifa1then7250
  392. 7270 ifd=24ord=47thentb=tb+13:print"":ifa>9.9e8then7300
  393. 7280 printtab(tb)c-1
  394. 7290 ifpeek(k)=.thennext
  395. 7300 syscr,24:geta$
  396. 7310 ifpeek(828)thenprint"[150][198]1 [208]rint this   ";
  397. 7320 print"[150][198]3 [195]ontinue   [198]5 [209]uit[155]";
  398. 7330 gosub12900
  399. 7340 ifre=1thengosub7900
  400. 7350 ifre=3then7220
  401. 7360 ifre=5then7000
  402. 7370 goto7330
  403. 7400 print"[147][150] [204]ist non-primes":print" ---------------[155]
  404. 7410 [141]7600
  405. 7420 [139]c[178].[176]c[177]1e9[167]7000
  406. 7430 tb[178].:[153]"loaddef (NULL)on-prime numbers:":[158]cr,24:[153]" (any key=stop)list
  407. 7440 ford=1to69
  408. 7450 a=abs(c):gosub7800:c=c+1
  409. 7460 ifa1=.then7450
  410. 7470 ifd=24ord=47thentb=tb+13:print"":ifa>3.2e4then7500
  411. 7480 printtab(tb)c-1
  412. 7490 ifpeek(k)=.thennext
  413. 7500 syscr,24:geta$
  414. 7510 ifpeek(828)thenprint"[150][198]1 [208]rint this   ";
  415. 7520 print"[150][198]3 [195]ontinue   [198]5 [209]uit[155]";
  416. 7530 gosub12900
  417. 7540 ifre=1thengosub7900
  418. 7550 ifre=3then7420
  419. 7560 ifre=5then7000
  420. 7570 goto7530
  421. 7600 print" [197]nter 0 to stop
  422. 7610 [153]"(NULL)hat number would you like
  423. 7620 print"to start with?
  424. 7630 c[178].:b$[178]" "
  425. 7640 [153]b$" on":[146]k,15:[161]a$
  426. 7650 [139]a$[178][199](20)[167][139]c[167]b$[178][200](b$,c):c[178]c[171]1
  427. 7660 [139]a$[178]"-"[167][139]c[170]fx[178].[167]c[178]1:b$[178]" -"
  428. 7670 [139]a$[178][199](13)[167]c[178][197](b$):[137]7710
  429. 7680 [139]a$[179]"0"[176]a$[177]"9"[167]7640
  430. 7690 [139]c[177]8[167]c[178]8
  431. 7700 c[178]c[170]1:b$[178][200](b$,c)[170]a$:[137] 7640
  432. 7710 [139][182](c)[177]4e5[167][139]fx[178].[167][153]"openthinking...list
  433. 7720 return
  434. 7800 a1=.:ifa<4thenreturn
  435. 7810 ifa/t=int(a/t)thena1=t:return
  436. 7820 fora1=3tosqr(a)stept:ifa/a1=int(a/a1)thenreturn
  437. 7830 next:a1=.:return
  438. 7900 poke2,24
  439. 7910 gosub11800:ifathenreturn
  440. 7920 open4,4,peek(830):syspd
  441. 7930 close4:return
  442. 8000 pokebg,6:pokebg+1,.
  443. 8010 print"[147]"tab(90)"[146][150][211]quare numbers":print,"--------------[155]
  444. 8020 [153]"(NULL)ould you like to...
  445. 8030 print" 1. [212]est a number
  446. 8040 [153]" 2. (NULL)ist squares
  447. 8050 print" 3. [210]eturn to main menu
  448. 8060 k3[178]1[170]2e[171]7:fx[178]1
  449. 8070 [141]12900:[153]"load
  450. 8080 onregoto8100,8400:return
  451. 8100 print"[150] [212]est squares":print" ------------[155]
  452. 8110 [141]7600
  453. 8120 [139]c[178].[167]8000
  454. 8130 b[178][186](c):d[178][181](b[172]k3)
  455. 8140 [153]c"cmd is ";
  456. 8150 [139]c[171]d[172]d[167][153]"not square;":[153]" its root is";:[137]8200
  457. 8160 b[178]d:[153]"the square of";
  458. 8200 [153]b:[153]"next?
  459. 8210 gosub 7630:goto 8120
  460. 8400 print"[150] [204]ist squares":print " ------------[155]
  461. 8410 [141]7600
  462. 8420 [139]c[178].[167]8000
  463. 8430 c[178][181]([186](c[171]1))[170]1
  464. 8440 [153]"loaddef (NULL)quare"[163]18)"(NULL)ootlist
  465. 8450 forc=ctoc+22
  466. 8460 if c>31622thenprint"[159][211]ize limit for squares!":goto8500
  467. 8470 printc*ctab(17)c
  468. 8480 next
  469. 8500 syscr,24
  470. 8510 ifpeek(828)thenprint"[150][198]1 [208]rint this   ";
  471. 8520 print"[150][198]3 [195]ontinue   [198]5 [209]uit[155]";
  472. 8530 gosub12900
  473. 8540 ifre=1thengosub7900
  474. 8550 ifre=3then8440
  475. 8560 ifre=5then8000
  476. 8570 goto8530
  477. 9000 gosub11800
  478. 9010 poke829,peek(828)
  479. 9020 poke832,1-peek(828)
  480. 9030 close1:open 1,8,15
  481. 9040 close2:open 2,8,8,"alphametix.ml
  482. 9050 [132]1,a,b$:[160]2:[160]1
  483. 9060 [139]a[179][178]19[167]9070
  484. 9065 [153]"right$nsert program disk and press (NULL)(NULL)atnlenval.":[151]198,0
  485. 9067 [161]a$:[139]a$[178]""[167]9067
  486. 9068 [138]
  487. 9070 [151]830,7:[151]808,225
  488. 9080 a[178]1:[147]"alphametix.ml",8,1
  489. 9100 bg[178]53280:k[178]198:[158]51200
  490. 9110 k1[178].5:k2[178]2.5:a2[178]1[170]2e[171]7:t[178]2
  491. 9120 cr[178]51209:du[178]cr[171]3:pd[178]cr[170]12:s1[178]54276:x$[178]"def< (NULL)he end >
  492. 9130 pokes1-3,70:pokes1+11,41:pokes1+14,17:pokes1+1,7:pokes1+2,217
  493. 9140 close4:poke204,1
  494. 9150 return
  495. 9500 pokebg+1,.:sys51215
  496. 9510 syscr,19
  497. 9520 printtab(24)"[150][209]uit [193]lphametix
  498. 9530 [153][163]25)"-atnre you sure?
  499. 9540 printtab(65)"[198]1 [195]ontinue
  500. 9550 [153][163]25)"asc7 (NULL)eturn":[153][163]27)"to (NULL)oadstar";
  501. 9580 [141]12900
  502. 9590 [139]re[171]7[167][142]
  503. 9600 [158]58451:[151]808,237
  504. 9610 [153]"loadchr$oodbye from atn(NULL)(NULL)left$atn(NULL)val(NULL)right$(NULL)
  505. 9700 close1:open1,8,15
  506. 9730 close2:open2,8,8,"hello connect
  507. 9740 [132]1,a,b$
  508. 9750 [160]2:[160]1
  509. 9760 [139]a[177]19[167][155][171]20
  510. 9800 [147]"hello connect",8
  511. 9810 [128]
  512. 10000 [141]10800
  513. 10040 [153][163]5)"(NULL)ress:
  514. 10050 printtab(5)"1  [201]nstructions
  515. 10060 [153][163]5)"2  (NULL)olve alphametic puzzle
  516. 10070 printtab(5)"3  [208]rime numbers
  517. 10080 [153][163]5)"4  (NULL)quare numbers
  518. 10090 printtab(5)"5  [208]rinter controls
  519. 10100 [153][163]5)"6  (NULL)uit atnlphametix
  520. 10120 printtab(205)"[194]y [201]an [193]dam      [214]ancouver [194][195]
  521. 10130 [153][163]14)"and (NULL)oadstar
  522. 10140 pokebg+1,2:pokebg-15,27
  523. 10200 pokes1,21:pokes1+20,143
  524. 10210 pokes1,20:return
  525. 10800 pokebg,.:pokebg-15,11:pokebg-11,.
  526. 10810 a$="[144]                                       [157][148] "
  527. 10820 b$="[144]   [146]                                    [157][148] "
  528. 10830 print"[147]"a$
  529. 10840 printb$:printb$:printb$:printb$:printb$
  530. 10850 printa$:printa$
  531. 10860 fori=1to11:printb$:next
  532. 10870 printa$:printa$
  533. 10880 fori=1to3:printb$:next:printb$"[155]
  534. 10890 [153][163]8)"atn (NULL) (NULL) left$ atn (NULL) val (NULL) right$ (NULL)
  535. 10900 print:printtab(8)"... [212]he [193]lphametic [197]xpress
  536. 10920 [142]
  537. 11000 [141]10800
  538. 11040 [153][163]5)"(NULL)rinter lenontrols:
  539. 11050 gosub11800
  540. 11060 pokebg+1,6:pokebg-15,27
  541. 11070 ifathen11600
  542. 11100 printtab(45)"[212]he secondary address is set
  543. 11110 [153][163]5)"to"[194](830)"for upper/lower case,
  544. 11120 printtab(5)"text mode, auto line feed.
  545. 11130 [139][194](829)[167][153][163]85)"atnll solutions will be printed.":[137]11160
  546. 11140 [153][163]45)"(NULL)olutions will be printed
  547. 11150 printtab(5)"only when requested.
  548. 11160 [153][163]165)"asc1  change secondary address
  549. 11170 ifpeek(829)thenprinttab(5)"[198]3  print on request only
  550. 11180 [139][194](829)[178].[167][153][163]5)"asc3  auto-print all solutions
  551. 11190 printtab(5)"[198]5  main menu";
  552. 11300 gosub12900:if(reand1)=.then11300
  553. 11310 ifre=5orre=7thenreturn
  554. 11320 ifre=3thenpoke829,1-peek(829):ifpeek(829)thenpoke832,.
  555. 11330 ifre-1then11000
  556. 11340 gosub10800
  557. 11380 printtab(45)"[212]he secondary address must be
  558. 11390 [153][163]5)"set for upper & lower case,
  559. 11400 printtab(5)"text mode, auto line feed.
  560. 11410 [153][163]85)"right$f necessary, check your
  561. 11420 printtab(5)"printer or interface manual.
  562. 11430 [153][163]205)"valnter secondary address:";
  563. 11440 [151]bg[171]15,27:a$[178]"
  564. 11500 syscr,22,30:printa$"  "
  565. 11510 waitk,15:getb$
  566. 11520 ifb$=chr$(20)theniflen(a$)thena$=left$(a$,len(a$)-1)
  567. 11530 ifb$=chr$(13)thenpoke830,val(a$)and255:goto11000
  568. 11540 ifb$<"0"orb$>"9"then11500
  569. 11550 iflen(a$)>2thena$=left$(a$,2)
  570. 11560 a$=a$+b$:goto11500
  571. 11600 printtab(45)"[212]here is no printer active.
  572. 11610 [153][163]45)"right$f you have a printer,
  573. 11620 printtab(5)"check it is properly
  574. 11630 [153][163]5)"connected, has paper available,
  575. 11640 printtab(5)"and turned on.
  576. 11650 [153][163]165)"asc1  activate printer
  577. 11660 printtab(5)"[198]3  main menu
  578. 11670 [141]12900:[139] re[178]1[167]11000
  579. 11680 [139] re[178]3[167][142]
  580. 11690 [137]11670
  581. 11800 [159]4,4,0:[151]781,4:[158]65481
  582. 11810 a[178]st [175]128:[158]65484:[160]4
  583. 11820 [151]828,[171](a[178]0)
  584. 11830 [151]829,(a[178]0)[172]([194](829)[177]0)
  585. 11840 [142]
  586. 11900 [141]11800
  587. 11910 [139]a[178].[167][159]4,4,[194](830):[158]du
  588. 11920 [160]4:[142]
  589. 12000 [158]51215
  590. 12010 [158]cr,19,23:[153]m1$
  591. 12020 [153][163]23)m3$
  592. 12030 [139][194](828)[167][153][163]23)m5$:[153][163]23)m6$
  593. 12040 [153][163]23)m7$
  594. 12100 [141]10200:[141]12900
  595. 12120 [139] re[178]6[167][158]51218:[141]11900:[137]12000
  596. 12130 [139] re[175]1[167][158]51218:[142]
  597. 12140 [137]12100
  598. 12300 m1$[178]"defasc1 atnnalyze this
  599. 12310 m3$="[150][198]3 [211]olve again
  600. 12320 m5$[178]"asc5 atn new puzzle
  601. 12330 m7$="[198]7 [194]ack to menu
  602. 12340 [139][194](828)[178].[167]fx[178].:[137]12400
  603. 12360 fx[178]3:m6$[178]"asc6 (NULL)rint this
  604. 12370 ifpeek(829)thenm4$="[198]4 [206]o [193]uto-print":goto12400
  605. 12380 m4$="[198]4 [193]uto print
  606. 12400 [158]51215
  607. 12410 [158]cr,19
  608. 12420 [139]fx[178].[167][153]
  609. 12430 [139]s[167][153][163]23)m1$
  610. 12440 [153][163]23)m3$
  611. 12450 [139]fx[175]2[167][153][163]23)m4$
  612. 12460 [153][163]23)m5$
  613. 12470 [139]fx[175]1[167][153][163]23)m6$
  614. 12480 [153][163]23)m7$;
  615. 12500 [141]10200:[141]12900:[158]51218
  616. 12510 [139] re[178]6[167][139]fx[175]1[167][141]11900:[137]12400
  617. 12520 [142]
  618. 12700 [158]51215
  619. 12710 [158]cr,19,.
  620. 12720 [153][163]23)"defasc1 (NULL)olve this":[139][194](828)[178].[167]12750
  621. 12730 [139][194](829)[178].[167][153][163]23)"asc2 atnuto print "
  622. 12740 [139][194](829)[167][153][163]23)"asc2 (NULL)o atnuto-print
  623. 12750 ifpeek(832)=.thenprinttab(23)"[198]3 [193]uto pause "
  624. 12760 ifpeek(832)thenprinttab(23)"[198]3 [206]o [193]uto-pause
  625. 12770 [153][163]23)"asc4 (NULL)edo clues
  626. 12790 ifpeek(828)thenprinttab(23)"[198]6 [208]rint puzzle
  627. 12800 [153][163]23)"asc7 peekack to menu";
  628. 12810 [141]10200:[141]12900
  629. 12820 [139]re[178]2[167][151]829,1[171][194](829)
  630. 12830 [139]re[178]3[167][151]832,1[171][194](832)
  631. 12840 [158]51218:[142]
  632. 12900 [153]"":[146]k,15
  633. 12910 [141]12940
  634. 12920 [139] re[167][139]re[179]8[167][142]
  635. 12930 [137]12900
  636. 12940 [161]a$:re[178][197](a$)
  637. 12950 [139]a$[177]"input#"[167][139]a$[179]"restore"[167]re[178]2[172][198](a$)[171]265:[139] re[177]7[167]re[178]re[171]7
  638. 12960 [139]a$[178][199](13)[167]re[178]1
  639. 12970 [142]
  640. 13000 [141]10200
  641. 13010 [145]ef[137]13100,13200,13300,13400,13500,13600,13600
  642. 13100 [138]50
  643. 13200 [153]"load":[141]14000
  644. 13210 [153]"(NULL)oo many letters!
  645. 13220 print"[197]ach letter represents a
  646. 13230 [153]"digit (NULL) to 9, so there can't
  647. 13240 print"be over 10 different letters.
  648. 13250 [137] 13900
  649. 13300 [153]"load":[141]14000
  650. 13310 [153]"(NULL)our puzzle can't be solved!
  651. 13320 ifma>lrthen13350
  652. 13330 print"[211]um line is too long, compared
  653. 13340 [153]"to the other lines.":[137] 13900
  654. 13350 [153]"(NULL)o line in the puzzle can be longerclose
  655. 13360 print"than the sum.
  656. 13370 [137]13900
  657. 13400 [153]"load":[141]14000
  658. 13410 [153]"(NULL)our puzzle can't be solved!  right$t needs
  659. 13430 print"at least 2 letters.
  660. 13440 [137]13900
  661. 13500 [153]"load":[141]14000
  662. 13510 [153]"lenlues are not compatible."
  663. 13520 [153]a1$" & "un$(n)" can't both be"tj
  664. 13530 [137]13900
  665. 13600 [153]"load":[141]14000
  666. 13610 [153]"(NULL)our puzzle & clues can't be solved!"
  667. 13620 [139]ef[177]6[167][153]x$
  668. 13900 [153]"(NULL)ress a key."
  669. 13910 [146]k,15:[161]a$
  670. 13920 [138]200
  671. 14000 [153]"sys";
  672. 14010 [129]i[178]1[164]r[171]1
  673. 14020 [153][163]rt(i))rw$(i)
  674. 14030 [130]
  675. 14040 [153][163]12[171]lr)[200]("---------",lr)
  676. 14050 [153][163]12[171]lr)rw$(r);
  677. 14060 [139]cc[167][129]i[178]r[170]1[164]9:[153]:[130]
  678. 14070 [139]cc[178].[167][153]
  679. 14090 [129]i[178].[164]nc
  680. 14100 [153]:[153]cs$(i);
  681. 14110 [130]:[153] "list":[142]
  682. 14500 [153]"openloaddefwait    (NULL)olution no."s
  683. 14520 [153]"  def++++++++++++++++++wait   time:   :  :  .
  684. 14530 print:gosub14000
  685. 14540 syscr,r+2,26-lr
  686. 14550 printleft$("----------",lr)
  687. 14560 print"
  688. 14570 [129]i[178]1[164]nm
  689. 14580 [153][163]33)un$(i)" =
  690. 14590 next
  691. 14610 ifnm<r+2thenfori=nmtor+1:print:next
  692. 14620 printtab(18)"[159][200]old [195][212][210][204] for
  693. 14630 [153][163]18)"step-by-step
  694. 14640 printtab(18)"[210][197][211][212][207][210][197] to exit
  695. 14650 [139][194](832)[178].[167][153][163]18)"left$old a key to pause";
  696. 14660 [142]
  697. 15000 [153]"loaddef(NULL)emory full-
  698. 15010 gosub4300
  699. 15020 fori=1tonm:printun$(i)" ";:next
  700. 15030 printrw$(r):print
  701. 15040 forj=1tob:printmid$(str$(sl(j,1)),2);
  702. 15050 fori=2tonm:printsl(j,i)"[157]";:next
  703. 15060 print" "sl$(j)
  704. 15070 next
  705. 15100 goto12000
  706. 16000 print"[147][208]rint puzzle format:
  707. 16010 [153]"printlenheck printer is at top of page;
  708. 16020 print"press [210][197][212][213][210][206], [198]7 to quit:
  709. 16040 [146]k,15:[161]a$:[139]a$[178]"let"[167]16900
  710. 16050 [141]11800:[139]a[167]16900
  711. 16100 [159]4,4,[194](830)
  712. 16110 [152]4,"        atn (NULL) (NULL) left$ atn (NULL) val (NULL) right$ (NULL)":[152]4
  713. 16120 [152]4,"        ... (NULL)he atnlphametic valxpress":[152]4
  714. 16130 [152]4,"        atn puzzle for you to solve:":[152]4
  715. 16140 [153]"load
  716. 16200 fori=1tor
  717. 16210 ifi<rthen16230
  718. 16220 print:printtab(78-4*lr)left$("-----------------------------------",4*lr);
  719. 16230 print:print:printtab(4*rt(i)-10);
  720. 16240 forj=1tolen(rw$(i))
  721. 16250 printchr$(asc(mid$(rw$(i),j,1))+96)"...";
  722. 16260 next
  723. 16270 next
  724. 16280 sysdu
  725. 16300 print"[147]
  726. 16310 [129]i[178].[164]nc
  727. 16320 [153]cs$(i)
  728. 16330 [130]
  729. 16340 [158]du
  730. 16400 [153]"load
  731. 16410 fori=1tonm
  732. 16420 print:printun$(i)" = .....
  733. 16430 [130]
  734. 16440 [158]du
  735. 16450 [152]4,[199](12);
  736. 16460 [160]4:[153]"load
  737. 16500 print"[147][215]ould you like...
  738. 16510 [153]" asc1  a timer to solve puzzle
  739. 16520 print" [198]3  race the computer
  740. 16530 [153]" asc5  back to atnlphametix
  741. 16550 gosub12900
  742. 16560 if re=3thenpoke631,133:pokek,1
  743. 16570 if re-1thenprint"[147]":goto14000
  744. 16600 print"[147][208]ress:
  745. 16610 [153]" asc1  start the timer
  746. 16620 print" [198]3  finished
  747. 16630 [153]" asc5  back to atnlphametix
  748. 16640 syscr,1,29:print" 0:00:00.0[155]
  749. 16700 [141]12900
  750. 16710 [139] re[178]5[167]16900
  751. 16720 [139] re[171]1[167]16700
  752. 16800 [129]i[178]56331[164]56328[169][171]1
  753. 16810 [151]i,.
  754. 16820 [130]
  755. 16850 a[178]51224
  756. 16860 [129]i[178].[164]1:[158]a:i[178][194](k):[130]
  757. 16870 [141]12940:[139]re[167]16710
  758. 16880 [137]16850
  759. 16900 [153]"load":[137]14000
  760. 20000 [153]"load
  761. 20010 pokebg-15,11:pokebg,6:pokebg+1,6:aa=6
  762. 20030 ifpeek(828)then20050
  763. 20040 d$="    [198]1 [195]ontinue         [198]3 [205]ain menu   [157][148] ":goto20100
  764. 20050 d$="  [198]1 [195]ontinue  [198]3 [209]uit  [198]5 [208]rint page  [157][148] "
  765. 20100 fori=1to11
  766. 20110 onigosub21000,22000,23000,24000,25000,26000,27000,28000,29000,30000,31000
  767. 20130 gosub20800
  768. 20140 next
  769. 20150 gosub11800:ifathenreturn
  770. 20160 print"[147]     [198]1 [194]ack to menu
  771. 20170 [153]"     asc3 (NULL)rint the instructions
  772. 20175 pokebg-15,27:gosub12900
  773. 20180 ifre-3thenreturn
  774. 20200 open4,4,peek(830):cmd4:rem printchr$(12);
  775. 20210 fori=1to11
  776. 20220 onigosub21000,22000,23000,24000,25000,26000,27000,28000,29000,30000,31000
  777. 20230 ifi/3=int(i/3)thenprintchr$(12);
  778. 20240 next
  779. 20250 print#4:print#4,chr$(12)
  780. 20260 close4:return
  781. 20800 syscr,24
  782. 20810 printd$;:pokebg-15,27
  783. 20820 rem aa=aa+6+3*(aa=6)+4*(aa=9):ifaa>11 then aa=.
  784. 20830 gosub12900
  785. 20840 ifre=5thengosub7900
  786. 20850 ifre=3thenrun50
  787. 20860 pokebg-15,11:pokebg,aa:pokebg+1,aa
  788. 20870 print"[147]":return
  789. 20990 :
  790. 21000 print"  [193] [204] [208] [200] [193] [205] [197] [212] [201] [216]
  791. 21010 [153]:[153]"     ... (NULL)he atnlphametic valxpress":[153]
  792. 21020 [153]"  (NULL)hat is an alphametic?":[153]
  793. 21030 [153]"  right$'m glad you asked!":[153]
  794. 21040 [153]"  atnn alphametic is a type of puzzle
  795. 21050 print"  in which the numbers in a standard
  796. 21060 [153]"  addition format have been replaced
  797. 21070 print"  by letters.  [197]ach letter uniquely
  798. 21080 [153]"  replaces a different digit.":[153]
  799. 21090 [153]"  (NULL)he challenge is to deduce the
  800. 21100 print"  original numbers, given only
  801. 21110 [153]"  the letters of the puzzle.
  802. 21120 print:return
  803. 21990 :
  804. 22000 print"[195]onsider this sample puzzle:":print
  805. 22010 print"       [196][207][206][212]
  806. 22020 [153]"         str$(NULL)
  807. 22030 print"         [201][212]
  808. 22040 [153]"       (NULL)atnright$str$
  809. 22050 print"      -----
  810. 22060 [153]"      str$(NULL)(NULL)(NULL)atn
  811. 22070 print:print"[200]ere, each letter represents
  812. 22080 [153]"a number, and the first 4 lines
  813. 22090 print"must add up to equal [196][207][206][206][193].
  814. 22100 [153]:[153]"(NULL)his is fairly simple to solve, and you
  815. 22110 print"can[160]deduce some clues quickly.":print
  816. 22120 print"[204]ook at the left column.  [196] and [211] must
  817. 22130 [153]"add up to at least 10, but less than
  818. 22140 print"20, so a 1 carries over to form
  819. 22150 [153]"the last digit.  (NULL)hen you know that
  820. 22160 print"[196] must represent the number 1.
  821. 22200 [153]:[142]
  822. 23000 [153]"(NULL)o mentally replace str$ with 1, and
  823. 23005 print"eliminate [206] above and below the line:":print
  824. 23010 print"       [196][207][206][212]          1[207].[212]
  825. 23020 [153]"         str$(NULL)            1(NULL)
  826. 23030 print"         [201][212]            [201][212]
  827. 23040 [153]"       (NULL)atnright$str$          (NULL)atnright$1
  828. 23050 print"      -----         -----
  829. 23060 [153]"      str$(NULL)(NULL)(NULL)atn         1(NULL)(NULL).atn
  830. 23070 print:print:print"[194]y examining the left column, you can
  831. 23080 [153]"figure that the letter (NULL) must be
  832. 23090 print"8 or 9, to ensure that [196]+[211]
  833. 23100 [153]"adds up to at least 10.":[153]
  834. 23110 [153]:[153]"atnlso, the letter (NULL) must be
  835. 23120 print"0 or 1.  [211]ince 1 is already
  836. 23130 [153]"taken (str$ is 1), then (NULL) must be 0.
  837. 23200 return
  838. 24000 print"[204]et's make those changes:":print:print
  839. 24010 print"       [196][207][206][212]          10.[212]
  840. 24020 [153]"         str$(NULL)            10
  841. 24030 print"         [201][212]            [201][212]
  842. 24040 [153]"       (NULL)atnright$str$          *atnright$1
  843. 24050 print"      -----         -----
  844. 24060 [153]"      str$(NULL)(NULL)(NULL)atn         10(NULL).atn
  845. 24070 print:print"      * = 8 or 9
  846. 24080 [153]:[153]"(NULL)ou could keep going like this.":[153]
  847. 24090 [153]"ascrom the column on the right, you
  848. 24100 print"know that [212] must be at least 6, and
  849. 24110 [153]"that atn must be an odd digit,
  850. 24120 print"3, 5, or 7.":print
  851. 24130 print"[198]rom the next column, you can find
  852. 24140 [153]"that right$ must be 4 or 9.":[153]
  853. 24200 [142]
  854. 25000 [153]"(NULL)he solution is then close.
  855. 25010 print:print"[215]ith a little experimenting,
  856. 25020 [153]"it is found to be:":[153]:[153]
  857. 25030 [153]"       str$(NULL)(NULL)(NULL)          1067
  858. 25040 print"         [196][207]            10
  859. 25050 [153]"         right$(NULL)            47
  860. 25060 print"       [211][193][201][196]          9541
  861. 25070 [153]"      -----         -----
  862. 25080 print"      [196][207][206][206][193]         10665
  863. 25090 [153]:[153]:[153]"(NULL)imple, right?":[153]
  864. 25100 [153]"(NULL)ost puzzles are not as easy
  865. 25110 print"as that!  [213]sually, you need
  866. 25120 [153]"a lot of trial and error to
  867. 25130 print"get the answer.":return
  868. 26000 print:print:print"[212]his is where you and the computer
  869. 26010 [153]"make a good team.   (NULL)he computer is
  870. 26020 print"good at experimenting.   [201]n theory,
  871. 26030 [153]"up to 3.6 million trials  (and
  872. 26040 print"3.6 million errors!) may be required
  873. 26050 [153]"before a solution is found.   (NULL)he
  874. 26060 print"computer is thorough at this.
  875. 26070 [153]"right$t is also good at keeping track
  876. 26080 print"of complex things like rows of
  877. 26090 [153]"letters and numbers.":[153]:[153]
  878. 26100 [153]"peekut the computer is not good
  879. 26110 print"at finding clues, nor at making
  880. 26120 [153]"lucky guesses.":[153]:[153]
  881. 26130 [153]"(NULL)hat's your part of the teamwork!
  882. 26200 return
  883. 27000 print"[215]ith your help, this program
  884. 27010 [153]"can solve alphametic puzzles,
  885. 27020 print"even though they may be a
  886. 27030 [153]"lot more difficult than the
  887. 27040 print"sample we saw.":print
  888. 27050 print"[212]he program is also fast.":print:print
  889. 27060 print"[217]ou have the first job in the process,
  890. 27070 [153]"entering the puzzle.  (NULL)here are a
  891. 27080 print"few samples on the disk, to get you
  892. 27090 [153]"started.  (NULL)nce the puzzle is entered,
  893. 27100 print"the computer will then scan it,
  894. 27110 [153]"looking for clues or errors.":[153]
  895. 27120 [153]"atnt this stage, you can go ahead and
  896. 27130 print"have the computer solve the problem.
  897. 27140 [153]"(NULL)here may be several possible
  898. 27150 print"solutions, and the program
  899. 27160 [153]"will list them all.":[142]
  900. 28000 [153]:[153]"atns fast as the program is, however,
  901. 28010 print"it takes time to try 3.6 million
  902. 28020 [153]"solutions.  (NULL)he answer is found
  903. 28030 print"much faster with teamwork.
  904. 28040 [153]"right$f you can see any obvious
  905. 28050 print"clues, go ahead and enter them
  906. 28060 [153]"when the program asks.   (NULL)our
  907. 28070 print"brainpower will complement the
  908. 28080 [153]"computer's brute force very nicely.":[153]:[153]
  909. 28090 [153]"(NULL)ometimes a clue will be supplied with
  910. 28100 print"the puzzle, usually because the problem
  911. 28110 [153]"has more than one solution... the clue
  912. 28120 print"serves to limit the puzzle to just one
  913. 28140 [153]"solution.  valnter this type of clue too.":[153]:[142]
  914. 29000 [153]"(NULL)he program has several options:":[153]
  915. 29020 [153]"- right$f you have a printer, the answers
  916. 29030 print"  will be printed automatically as
  917. 29040 [153]"  they are found.  right$f you don't want
  918. 29050 print"  this auto-print feature, you can
  919. 29060 [153]"  cancel it from a menu.":[153]
  920. 29070 [153]"- (NULL)ou can also print any screen when
  921. 29080 print"  the menu offers.":print
  922. 29090 print"- [215]hen not auto-printing, the program
  923. 29100 [153]"  will pause after finding a solution.
  924. 29120 print"  [217]ou can cancel this feature too.":print
  925. 29140 print"- [212]ry holding down the [195][212][210][204] key while
  926. 29150 [153]"  the program is running.  (NULL)his will
  927. 29160 print"  slow the program so you can see the
  928. 29170 [153]"  solution develop.":[142]
  929. 30000 [153]"(NULL)ith most menus, you can press either
  930. 30010 print"a number or function key.  [212]he main
  931. 30020 [153]"menu offers some additional choices...":[153]:[153]
  932. 30040 [153]"right$f your printer doesn't work right,
  933. 30050 print"try changing the secondary address.
  934. 30060 [153]"(NULL)elect 'printer controls', check the
  935. 30070 print"manual for your printer or interface,
  936. 30080 [153]"and enter a new address.":[153]
  937. 30110 [153]"atnlso, because the program deals with
  938. 30120 print"prime numbers and squares, special
  939. 30140 [153]"sections are provided to allow you to
  940. 30150 print"experiment with these numbers.
  941. 30160 [153]:[153]"(NULL)ress (NULL)val(NULL)(NULL)(NULL)(NULL)val anytime to get the menu.
  942. 30200 print:return
  943. 31000 print"[212]here are many other features in
  944. 31010 [153]"the program, which you will find
  945. 31020 print"as you try it out.  [202]ust for fun, you
  946. 31030 [153]"might want to try and solve some of
  947. 31040 print"the puzzles by hand, and compare your
  948. 31050 [153]"time to the computer's.":[153]:[153]:[153]
  949. 31060 [153]"right$f you want to try, the program
  950. 31070 print"will print the puzzle on a blank
  951. 31080 [153]"page, leaving plenty ofcloseroom for you
  952. 31090 print"to work on it.  [201]t will even time you
  953. 31100 [153]"as you solve the puzzle!
  954. 32310 print"[212]here are many puzzles on the [204]oadstar
  955. 32320 [153]"disk.  (NULL)hen you choose '(NULL)olve a puzzle'
  956. 32330 print"you can select one of these to solve,
  957. 32340 [153]"or type in your own.":[142]
  958.