home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 14 / 014.d81 / textrapolation-3 (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  1KB  |  29 lines

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