home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 14
/
014.d81
/
textrapolation-3
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
1KB
|
29 lines
10 rem textrapolation 123 -- scan back for best match length <= 3
100 a$=" ": rem 15 blanks
120 a$=a$+a$: a$=a$+a$: a$=a$+a$: a$=a$+a$: rem a$ = 240 blanks
130 poke53281,1:poke53280,7
132 print"[147][144]begin typing...":print"beware--this is one is slow...":wait198,1
190 print"[147][144]":poke53281,1:poke53280,7: nl=0
200 :
210 get x$: if x$="" then 210: rem wait for user to type a letter
211 ifx$="_"then63000
212 l=l+1:ifl>38thenprint:print:print: l=0:nl=nl+1:ifnl=7then190
220 print "[144]"chr$(8);x$;: rem backspace-then print chosen letter
300 n=n+1: if p$=x$ then r=r+1: rem convert character, add one
400 a$=right$(a$,239)+x$: p=240: rem record latest choice, initialize p
500 m=0:fori=239to3step-1:ifmid$(a$,i,1)=mid$(a$,240,1)thenp=i+1:m=1:f=i:i=3
520 next i:ifm=0goto 900: rem stop trying if no match found
540 m=0:fori=f-1to2step-1:ifmid$(a$,i,2)=mid$(a$,239,2)thenp=i+2:m=1:f=i:i=2
560 next i:ifm=0goto 900: rem stop trying if no match found
580 fori=f-1to1step-1:ifmid$(a$,i,3)=mid$(a$,238,3)thenp=i+3:i=1
600 next i
900 p$=mid$(a$,p,1) : rem make prediction
902 ifp$=""then200
903 cl=peek(214):cc=peek(211):print"[144]score:";r
904 poke783,0:poke781,cl:poke782,cc: sys65520
905 print "[157]"p$"[145]";: rem show prediction on screen
910 goto200
63000 rem reconnect to boot program
63002 print"[147]load"chr$(34)"text boot" chr$(34)",8":print"run"
63004 poke631,13:poke632,13:poke198,2: end