home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 73
/
073.d81
/
alphametix
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
24KB
|
958 lines
10 rem alphametix
20 rem (c)ian adam 1990
40 ifathenrun50
48 gosub9000
50 gosub9100
100 gosub10000
110 gosub12900
120 onregosub20000,200,7000,8000,11000,9500
140 goto100
200 clr:gosub5000
210 ifefthen13000
220 gosub6000
230 ifefthen13000
250 gosub12700:ifre=1then350
260 ifre=2orre=3thengosub6290:goto250
265 ifre=6thenifpeek(828)thengosub16000:goto250
270 ifre=7thenrun50
275 ifre-4thenrun200
295 sys51200:tj=co:sj=10:pokepr+3,lr
300 fori=.to10:u(i)=.:l(i)=.:cl(i)=.:un$(i)="":next
310 aa=.:ef=.:cc=.:nc=.:ma=.:s=.:x$="[150]< [212]he end >
315 [153]"load":[141]14000
320 [129]i[178]1[164]r:d$[178]" "[170]rw$(i):[141]5800:[130]:[141]6020:[137]230
350 [141]6500
360 [139][194](pr[170]1)[178].[167] 700
400 [139][194](2)[167][141]2000
410 [139]ef[167]530
500 [141]2200
510 [139]re[178]7[167]600
520 [139]b[178]20[167][141]15000:[141]2400:[141]14500:[139]re[178]7[167]600
530 [158]51203:[141]6800
540 [137]360
600 [151]pr[170]1,.:m[178]1
610 x$[178]"def <(NULL)utput terminated>
620 print""x$
630 goto820
700 ifsthen800
730 print"[159] [211]orry.. no solution to be found [155]
740 [139][194](829)[167][141]11900
760 [137]840
800 [153]"open no more solutions ... "
810 [139][194](829)[167][151]2,3:[141]7910
820 b[178]s[171]20[172][181]((s[171]1)[173]20)
830 [141]4300
840 [141]12300
850 [139]re[178]1[167][139]s[167][141]4000
860 [139]re[178]3[167]295
870 [139]re[178]4[167]920
880 [139]re[178]5[167][138]200
890 [139]re[178]7[167][138]50
900 [137]840
920 [151]832,[194](832)[176][194](829)
930 [151]829,1[171][194](829)
940 [141]6900:[137]840
1000 cs$(21)[178]"prime":cs$(22)[178]"not prime":cs$(23)[178]"square":cs$(24)[178]"not square
1010 cs$(26)="even":cs$(27)="odd":cs$(28)="1 or 2":cs$(29)="unknown
1020 [153]"load":[141]14000
1030 [153]""
1040 [129]i[178]1[164]r[171]1
1050 [153]i
1060 [130]
1070 [153]:[153]i
1080 [139]nc[179]9[167]1140
1100 [153]"open"[163]99)"valnough!
1110 printtab(59)"[159][208]ress a key.[155]
1120 [146]k,15:[161]a$:[142]
1140 [153]"open"[163]60)"right$f you have a clue
1150 print,,"for one letter,"tab(60)"press that letter.
1160 [153][163]60)"right$f the clue is for":[153],,"a line in the
1170 print,,"puzzle, press the"tab(60)"line #.
1180 [153][163]60)"(NULL)o more clues: asc1list
1190 waitk,15:geta$
1200 a1$=chr$(asc(a$)+32):xx$=" "
1210 ifval(a$)then1530
1220 ifa$="[133]"thenreturn
1240 fori=1tonm
1250 ifun$(i)=a1$then1280
1260 next
1270 printtab(60)"[150][212]hanks a lot![155]":gosub10200
1274 fori=1to1500:next:goto1020
1280 print"[159]",,"[208]ress a number for
1284 [153],,"the letter " a1$ ", or:
1286 print,,xx$
1288 print,,"a if even "
1290 print,,"b if odd "
1295 print,,"c if it could be "
1296 print,," one or two [155]
1298 [153],,xx$:[153],,xx$:[153],,xx$
1300 [146]k,15:[161]b$:[141]10200
1305 tj[178][198](b$)[171]48[170]7[172](b$[177]"9"):[139]tj[179].[176]tj[177]12[167]1270
1310 sj[178]so(i):[139]tj[179]10[167]1410
1320 [139]sj[179]10[167]1390
1330 [145]sj[171]9[137]1340,1350,1360,1480,1370,1480,1380
1340 [145]tj[171]9[137]1270,1510,1720
1350 [145]tj[171]9[137]1510,1270,1700
1360 [145]tj[171]9[137]1720,1700,1270
1370 [145]tj[171]9[137]1510,1480,1700
1380 [145]tj[171]9[137]1480,1480,1700
1390 [153][163]60)a1$" is"sj" ok?":[146]k,15:[161]a$
1395 [139]a$[178]"n"[167]ef[178]6:[142]
1400 [137]1020
1410 [139]sj[178]tj[167]1270
1420 [139]sj[179]10[167]ef[178]6:[142]
1430 [141]1900:[139]a1[178].[167]ef[178]6:[142]
1440 nc[178]nc[170]1:cs$(nc)[178]a1$[170]" must be"[170][196](tj)
1445 u(tj)[178]1:l(i)[178]1:tr(i)[178]tj:so(i)[178]tj
1450 [129]n[178]1[164]nm:[139]i[178]n[167]1470
1460 [139]tj[178]so(n)[167]ef[178]5:[142]
1470 [130]:[137]1020
1480 so(i)[178]tj:nc[178]nc[170]1:cs$(nc)[178]a1$[170]" must be "[170]cs$(tj[170]16)
1490 :
1500 [137] 1020
1510 ef[178]6:[142]
1530 a[178][197](a$):[139]a[179]1[176]a[177]r[167]1270
1532 [153]"open",,xx$
1540 [153],,"on(NULL)ine"a"cmd: "rw$(a)
1542 [153],,xx$:[153],,"(NULL)ell me.. is it: "
1544 [153],,"a even "
1546 [153],,"b odd "
1548 [153],,"c prime "
1550 [153],,"d not prime "
1552 [153],,"e square "
1554 [153],,"f not square "
1556 [153],,"0 none of these "
1560 [153],,xx$:[153],,"(NULL)lease press a key.list
1565 waitk,15:getb$
1570 gosub10200:b=asc(b$)-64:i=co(a,1):ifb<1orb>6then1270
1580 ifb>2then1600
1590 nc=nc+1:cs$(nc)=rw$(a)+" is "+cs$(25+b):tj=9+b
1595 a1$=un$(i):goto1310
1600 b=b-2:cl(a)=b:poke50288+a,b:nc=nc+1:cs$(nc)=rw$(a)+" is "+cs$(b+20)
1610 iflen(rw$(a))<9then1620
1615 cl(a)=.:print"[195]an't be sure":cs$(nc)=cs$(nc)+"..?
1620 [139]b[178]1[167][139][195](rw$(a))[178]1[167]1690
1630 [145]b[137]1640,1020,1670,1020
1640 [145]so(i)[170]1[137]1510,1020,1510,1020,1510,1510,1510,1020,1510,1020
1645 [145]so(i)[171]9[137]1510,1660,1700
1650 [139]so(i)[178]16[167]1510
1660 so(i)[178]14:[137]1020
1670 [145]so(i)[170]1[137]1020,1020,1510,1510,1020,1020,1020,1510,1510,1020
1680 [145]so(i)[171]9[137]1020,1020,1700,1710,1510,1710
1690 [145]so(i)[170]1[137]1510,1020,1020,1020,1510,1020,1510,1020,1510,1510
1695 [145]so(i)[171]9[137]1720,1020,1020,1020
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
1710 so(i)[178]16:[137]1020
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
1900 a1[178].:[145] sj[171]9[137]1910,1910,1920,1940,1950,1960,1970
1910 a1[178]sj[170]tj[170]1[175]1:[142]
1920 [139]tj[179]3[167]a1[178]tj
1930 [142]
1940 a1[178]1:[142]
1950 a1[178][182](3[171][182](tj[171]5))[178]1:[142]
1960 a1[178]tj:[142]
1970 a1[178][182](k2[171][182](tj[171]5))[171]k1:[142]
2000 [129]i[178]1[164]r
2010 n[178]cl(i):[139]n[178].[176]n[177]4[167]2080
2020 a[178].:c[178]10
2030 [129]a1[178][195](rw$(i))[164]1[169][171]1:a[178]c[172]a[170]tr(co(i,a1)):[130]
2040 [139]n[177]2[167]2070
2050 [141]7800:[139]n[170](a1[177].)[178]1[167]2080
2060 ef[178]c:[142]
2070 b[178][181]([186](a)[172]a2):[139] n[178]3[171](a[178]b[172]b) [167] ef[178]c:[142]
2080 [130]
2090 ef[178].:[142]
2200 a[178]36:s[178]s[170]1:a$[178]""
2210 [153]""[163]16)s""
2220 [129]i[178]1[164]nm
2230 [153][163]a)tr(i)
2240 [130]
2250 b[178]s[171]20[172][181]((s[171]1)[173]20)
2260 [129]i[178]1[164]nm:sl(b,i)[178]tr(i):[130]
2270 [129]a1[178]1[164]lr:a$[178][201]([196](tr(co(r,a1))),1)[170]a$:[130]
2280 sl$(b)[178]a$
2300 [139][194](829)[167][141]11900
2330 [139][194](832)[170][194](k)[178].[167][142]
2340 [161]a$:[141]12000
2400 [139]re[178]1[167][142]
2410 [139]re[178]3[167][151]832,1[171][194](832):[137]6900
2420 [139]re[178]5[167][151]832,[194](832)[176][194](829):[151]829,1[171][194](829):[137]6900
2430 [142]
4000 cs$(1)[178]"prime":cs$(2)[178]"odd":cs$(3)[178]"even":cs$(4)[178]"square":cs$(5)[178]"not sqr
4010 m1$="[150][198]1 [205]ore analysis":sj=1
4020 print"[147][150] [208]uzzle [193]nalysis:
4030 [153]" ================list
4040 print" # "rw$(r)tab(14)"factor square
4050 [129]i[178]sj[164]sj[170]19
4060 [153]sj[163]4)ts$(sj);
4070 a[178][197](ts$(sj)):[141]7800
4080 [139]a1[177]2[167]a1[178]1
4090 b[178][181]([186](a)[172]a2)
4100 [153][163]14)cs$(a1[170]1)[163]21)cs$((a[178]b[172]b)[170]5)
4110 [139]sj[177][178]s[167][153]x$;:[142]
4120 sj[178]sj[170]1
4130 [130]
4140 [139]sj[177]59[167][153]x$;:[142]
4150 [139]sj[179][178]s[167][153]"...more";
4200 [141]12310
4210 [139](re[178]1)[172](sj[179][178]s)[167]4020
4220 [142]
4300 [139]s[179]61[167][129]i[178]1[164]b:ts$(i[170]s[171]b)[178]sl$(i):[130]:[142]
4310 x$[178]"end memory":[142]
4500 [160]1:[159]1,8,15
4510 [160]2:[159]2,8,8,"puzzles.tst
4520 input#1,a,b$
4530 ifa>19thenprint:input"[206]eed program disk";a$:close2:close1:run200
4540 get#2,a$:r=asc(a$)
4600 fori=1tor
4610 input#2,rw$(i)
4620 rt(i)=12-len(rw$(i))
4630 next
4640 b$="":nc=.:za=.:zb=.:cs$(1)="":input#2,b$
4650 ifb$>" "thencs$(1)=mid$(b$,3):za=asc(b$):zb=asc(mid$(b$,2)):nc=1
4660 lr=len(rw$(r)):cc=.
4670 get#2,a$:aa=asc(a$+chr$(0))
4700 print"[147]":gosub14000
4705 ifaa=.thenprint"[204]ast puzzle![155]
4710 [153]" asc1 atnccept this
4720 ifaathenprint" [198]3 [206]ext puzzle
4730 [153]" asc5 (NULL)uit
4750 gosub 12900
4760 ifre=3thenifaathenr=aa:goto4600
4770 close2:c