home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 71
/
071.d81
/
bytes
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
2KB
|
85 lines
8 poke53281,0:poke53280,2
10 printchr$(142)"[147] the mighty loadstar permutizer"
12 printtab(12)"[154](e[154])co algorithm
14 [153][163]12)"(jcont)ohannsen algorithm
16 printtab(12)"(b[154])ack to loadstar"
18 getz$:ifz$<>"e"andz$<>"j"andz$<>"b"then18
20 ifz$="b"then310
22 print" while the list is scrolling:"
24 print" shift[154] - pause cmdr[154] - end"
28 printtab(11)"[145][145][159]your word: [157][157][157][157]";:l9%=6:gosub50000:a$=q9$
30 l=len(a$):ifl<3thenprint"[145][145]":goto28
32 print"[155]":ti$="000000"
34 ifz$="j"then500
37 :
38 :rem *** eco algorithm ***
39 :
40 fori=1tol:b$(i)=mid$(a$,i,1):next
50 t=0:fori1=1tol:e(1)=i1
60 fori2=1tol:e(2)=i2
70 ifi1=i2then260
80 ifl=3then180
90 fori3=1tol:e(3)=i3
100 forj=1to2:ife(3)=e(j)thenj=2:next:goto250
110 next:ifl=4then180
120 fori4=1tol:e(4)=i4
130 forj=1to3:ife(4)=e(j)thenj=3:next:goto240
140 next:ifl=5then180
150 fori5=1tol:e(5)=i5
160 forj=1to4:ife(5)=e(j)thenj=4:next:goto230
170 next
180 f=0:g=0:form=1tol-1:f=f+e(m):next
190 fork=1tol:g=g+k:next:rem could be g=(l*(l/2)+l/2)
200 e(l)=g-f
210 t=t+1:printt,;:fork=1tol:printb$(e(k));:next:print
220 ifpeek(653)=1then220
225 ifpeek(653)=2thenclr:goto10
230 ifl>5thennexti5
240 ifl>4thennexti4
250 ifl>3thennexti3
260 nexti2
270 nexti1
277 :
278 :rem *** prompt for more ***
279 :
280 printtab(15)"[154]time: [158]"mid$(ti$,4,1)":"right$(ti$,2)
285 printtab(14)"[154]again? (y[154]/n[154])"
290 geta$:ifa$<>"y"anda$<>"n"then290
300 ifa$="n"then10
305 goto22
307 :
308 :rem *** back to loadstar ***
309 :
310 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
320 ifer<>63then end
330 print"[147][144]load"chr$(34)"hello connect"chr$(34)",8"
340 print"run"
350 poke631,13:poke632,13:poke198,2:end
500 b$=mid$(a$,1,1):c$=mid$(a$,2,1):d$=mid$(a$,3,1)
505 e$=mid$(a$,4,1):f$=mid$(a$,5,1):g$=mid$(a$,6,1)
507 t=0
510 onlen(a$)gosub570,560,550,540,530,520:goto280
520 fori=1to6:gosub530:h$=g$:g$=f$:f$=e$:e$=d$:d$=c$:c$=b$:b$=h$:next:return
530 forj=1to5:gosub540:h$=f$:f$=e$:e$=d$:d$=c$:c$=b$:b$=h$:next:return
540 fork=1to4:gosub550:h$=e$:e$=d$:d$=c$:c$=b$:b$=h$:next:return
550 forl=1to3:gosub560:h$=d$:d$=c$:c$=b$:b$=h$:next:return
560 t=t+1:printt,b$c$d$e$f$g$:t=t+1:printt,c$b$d$e$f$g$:goto580
570 t=t+1:printt,b$c$d$e$f$g$
580 ifpeek(653)=1then580
590 ifpeek(653)=2thenclr:goto10
595 return
10000 open15,8,15,"i0":print#15,"s0:bytes":close15:save"bytes",8:end
49997 :
49998 :rem *** input routine ***
49999 :
50000 q9$="":u9=53280:poke198,0
50010 geta$
50020 poke646,rnd(1)*15+1:print"[164][157]";
50025 ifa$=""then50010
50030 ifa$=chr$(13)thenprint" ":return
50040 if(a$=chr$(20)andlen(q9$))thenq9$=left$(q9$,len(q9$)-1):goto50080
50050 iflen(q9$)>=l9%thent9%=peek(u9):pokeu9,1:pokeu9,t9%:goto50010
50060 ifa$<" "or(a$>chr$(127)anda$<chr$(160))ora$=chr$(34)then50010
50070 q9$=q9$+a$
50080 print""a$;:goto50010