home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1994 June / 1994-06b.d64 / wordmaster64 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  88 lines

  1. 10 rem copyright 1994 - compute publications intl ltd - all rights reserved
  2. 20 rem word master by d. g. klich
  3. 30 poke53281,1:poke53280,0:open15,8,15:dimc$(500):print"[147]"spc(14)"[154]word master"
  4. 40 a$="[129]a tool for the":b$="crossword addict":printspc(21-len(a$)/2)a$:printspc(20-len(b$)/2)b$
  5. 50 print"         choose a function:"
  6. 60 print"    [159]1[146] = search for a word"
  7. 70 print"    [159]2[146] = add new words to database"
  8. 80 print"    [159]3[146] = delete a database word"
  9. 90 print"    [159]4[146] = display a word file"
  10. 100 getn$:ifn$=""then100
  11. 110 n=val(n$):onngoto140,320,800,720
  12. 120 goto100
  13. 130 rem *****word search routine*****
  14. 140 print"[147]enter the word to be searched"
  15. 150 print"example: --l-o  (hello)"
  16. 160 print"from 3 to 15 characters"
  17. 170 print"enter 'zzz' when ready to quit"
  18. 180 inputw$:ifw$="zzz"thenclose1:goto50
  19. 190 iflen(w$)<3then180
  20. 200 iflen(w$)>15then180
  21. 210 l=len(w$):open1,8,2,"0:words"+str$(l)+",s,r":input#1,x$
  22. 220 fori=1tol
  23. 230 ifmid$(w$,i,1)="-"then270
  24. 240 ifmid$(w$,i,1)=mid$(x$,i,1)thens=1:goto270
  25. 250 s=0:input#1,x$:ifx$="zzz"then300
  26. 260 goto220
  27. 270 next
  28. 280 ifs=1thenprintx$,
  29. 290 goto250
  30. 300 close1:print:print"end of word search":goto170
  31. 310 rem *****add words routine*****
  32. 320 m=0:n=0:o$=""
  33. 330 print"[147]enter the list of words to be added to"
  34. 340 print"         the databases."
  35. 350 print"from 3 to 15 characters"
  36. 360 print"enter 'zzz' at end of list":c=1
  37. 370 inputx$:ifx$="zzz"then420
  38. 380 iflen(x$)<3then370
  39. 390 iflen(x$)>15then370
  40. 400 ifright$(x$,1)<"a"then370
  41. 410 c$(c)=str$(len(x$))+x$:c=c+1:ifc<>500then370
  42. 420 l=c-1:ifl=1then470
  43. 430 ifl=0then50
  44. 440 forp=1tol-1:s$="zzz":s=0
  45. 450 fori=ptol:ifc$(i)<s$thens$=c$(i):s=i
  46. 460 nexti:h$=c$(p):c$(p)=s$:c$(s)=h$:nextp
  47. 470 forc=1tol
  48. 480 ifc$(c)=c$(c-1)then610
  49. 490 fori=1to5:ifmid$(c$(c),i,1)<"a"thennexti
  50. 500 n$=left$(c$(c),i-1):w$=mid$(c$(c),i)
  51. 510 ifn$=o$then540
  52. 520 ifo$<>""thengosub680
  53. 530 open1,8,2,"0:words"+n$+",s,r":open2,8,3,"0:work,s,w":input#1,x$:o$=n$
  54. 540 ifw$<x$thenprint#2,w$:m=m+1:goto610
  55. 550 ifw$=x$then590
  56. 560 print#2,x$
  57. 570 input#1,x$:ifx$<>"zzz"then540
  58. 580 forq=1toval(n$)-3:x$=x$+"z":nextq:goto540
  59. 590 print#2,w$
  60. 600 input#1,x$:ifx$="zzz"thenforq=1toval(n$)-3:x$=x$+"z":nextq
  61. 610 gosub680
  62. 620 print"      words entered  ";l
  63. 630 print"      words accepted ";m
  64. 640 print"      duplicates     ";l-m
  65. 650 print"      files passed   ";n
  66. 660 print"updating of files completed":goto50
  67. 670 rem*****finish input copy and close*****
  68. 680 ifleft$(x$,3)="zzz"then700
  69. 690 print#2,x$:input#1,x$:ifx$<>"zzz"then690
  70. 700 print#2,"zzz":close1:close2:print#15,"s0:words"+o$:print#15,"r0:words"+o$+"=work":n=n+1:return
  71. 710 rem *****dump a word file*****
  72. 720 input"[147]       enter length of words";x:w=0
  73. 730 ifx<3then50
  74. 740 ifx>15then50
  75. 750 close1:open1,8,2,"0:words"+str$(x)+",s,r":y=x+1
  76. 760 input#1,z$:printz$;"[160]";:y=y+x+1:ify>40thenprint:y=x+1
  77. 770 ifz$="zzz"thenclose1:print:print"number of words  ";w:goto50
  78. 780 w=w+1:goto760
  79. 790 rem *****delete a word*****
  80. 800 h=0:print"[147]enter the word to be deleted":inputw$:ifw$="zzz"then50
  81. 810 l=len(w$):open1,8,2,"0:words"+str$(l)+",s,r":open2,8,3,"0:work,s,w"
  82. 820 input#1,x$:ifx$="zzz"then870
  83. 830 ifw$>x$thenprint#2,x$:goto820
  84. 840 ifw$=x$thenh=1:goto820
  85. 850 ifh<>1thenprint"the word ";w$;"[146] was not found":close1:close2:print#15,"s0:work":goto50
  86. 860 print"";w$;"[146] has been deleted":w$="":forq=1tol:w$=w$+"z":next:goto830
  87. 870 print#2,"zzz":close1:close2:print#15,"s0:words"+str$(l):print#15,"r0:words"+str$(l)+"=work":goto50
  88.