home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1985 Summer / rerun-1985-summer-side-b.d64 / spelling (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  14KB  |  301 lines

  1. 100 i=1:s1=peek(53280):s2=peek(53281):poke53280,0:poke53281,0
  2. 105 forj=ito50:bl$=bl$+" ":next
  3. 110 print"[147]        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  4. 120 print"        [221]  spelling challenge  [221]"
  5. 130 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  6. 140 print:print"               created by"
  7. 150 print"           michael  broussard"
  8. 155 print"   please wait while the program reads"
  9. 157 printtab(10)"its vocabulary words"
  10. 160 mw=750:ml=20:dimw$(mw):n=.:nl=i:diml(ml):l(i)=i
  11. 170 readn$:ifn$="end"then200
  12. 175 ifn$="*"thenifnl<ml-ithennl=nl+i:l(nl)=n+i:goto170
  13. 180 n=n+i:ifn>mwthenprint"too many words--can't save more than"mw:n=n-i:goto200
  14. 190 w$(n)=n$:goto170
  15. 200 ifl(nl)>nthennl=nl-i
  16. 205 l(nl+1)=n+i:goto1000
  17. 397 rem return index of p1$ in pa$ as pr, starting as ps. if pe is true, only
  18. 398 rem match at end, if pn is true, don't match at end.  if pb is true, don't
  19. 399 rem match at beginning
  20. 400 pr=.:p1=len(p1$):p2=len(pa$):pi=ps:ifpe=.then415
  21. 405 ifp1<p2thenp1=p2-p1+i:ifmid$(pa$,p1)=p1$thenpr=p1:goto445
  22. 410 return
  23. 415 ifpi>p2-p1+ithenreturn
  24. 420 ifmid$(pa$,pi,p1)<>p1$thenpi=pi+i:goto415
  25. 425 ifpnthenifpi+p1-i=p2thenreturn
  26. 430 ifpbthenifpi=ithenpi=pi+i:goto415
  27. 435 pr=pi
  28. 440 remstarting at pr,replace p1$ with p2$ in pa$, creating pb$
  29. 445 ifpfthenreturn
  30. 450 pb$=left$(pa$,pr-i)+p2$+mid$(pa$,pr+len(p1$))
  31. 455 nt=nt+i:return
  32. 500 nt=.:p1$="^":ps=i:pe=.:pn=.:pf=i:gosub400
  33. 505 ifpr=.then515
  34. 510 pb$=mid$(pa$,pr+i,len(pa$)-pr):pa$=left$(pa$,pr-i):nt=i:return
  35. 515 pf=.:pb=.:ps=i:pn=.:pe=.:rem match anywhere
  36. 520 p1$="nn":p2$="n":gosub400:ifntthenreturn
  37. 525 p1$="mm":p2$="m":gosub400:ifntthenreturn
  38. 530 p1$="zz":p2$="z":gosub400:ifntthenreturn
  39. 535 pb=i:pn=.:pe=i:rem match at end not at beginning
  40. 537 p1$="le":p2$="el":gosub400:ifntthenreturn
  41. 540 p1$="or":p2$="er":gosub400:ifntthenreturn
  42. 542 p1$="ence":p2$="ance":gosub400:ifntthenreturn
  43. 543 p1$="ance":p2$="ence":gosub400:ifntthenreturn
  44. 545 p1$="ar":p2$="er":gosub400:ifntthenreturn
  45. 550 p1$="ary":p2$="ery":gosub400:ifntthenreturn
  46. 555 p1$="ent":p2$="ant":gosub400:ifntthenreturn
  47. 560 p1$="ant":p2$="ent":gosub400:ifntthenreturn
  48. 565 p1$="able":p2$="ible":gosub400:ifntthenreturn
  49. 570 p1$="ible":p2$="able":gosub400:ifntthenreturn
  50. 575 p1$="ious":p2$="uous":gosub400:ifntthenreturn
  51. 577 p1$="uous":p2$="ous":gosub400:ifntthenreturn
  52. 580 pn=.:pe=.:pb=i:rem don't match at beginning
  53. 585 p1$="ei":p2$="ie":gosub400:ifntthenreturn
  54. 590 p1$="sc":p2$="c":gosub400:ifntthenreturn
  55. 595 p1$="z":p2$="zz":gosub400:ifntthenreturn
  56. 600 pe=.:pn=i:pb=.:rem don't match at end
  57. 605 p1$="ss":p2$="s":gosub400:ifntthenreturn
  58. 610 p1$="ie":p2$="ei":gosub400:ifntthenreturn
  59. 615 p1$="ly":p2$="li":gosub400:ifntthenreturn
  60. 620 pe=. : pn=. : rem match anywhere
  61. 625 p1$="mo":p2$="ma":gosub400:ifntthenreturn
  62. 630 p1$="ll":p2$="l":gosub400:ifntthenreturn
  63. 635 p1$="bb":p2$="b":gosub400:ifntthenreturn
  64. 640 p1$="cc":p2$="c":gosub400:ifntthenreturn
  65. 645 p1$="tt":p2$="t":gosub400:ifntthenreturn
  66. 650 p1$="ff":p2$="f":gosub400:ifntthenreturn
  67. 655 p1$="rr":p2$="r":gosub400:ifntthenreturn
  68. 660 p1$="pp":p2$="p":gosub400:ifntthenreturn
  69. 665 p1$="yl":p2$="il":gosub400:ifntthenreturn
  70. 670 p1$="cq":p2$="q":gosub400:ifntthenreturn
  71. 675 p1$="uous":p2$="ous":gosub400:ifntthenreturn
  72. 680 p1$="ys":p2$="is":gosub400:ifntthenreturn
  73. 685 ifnt=.thenpb$=pa$
  74. 690 return
  75. 899 rem return a word in pa$ at random
  76. 900 ifhi<lothenlo=l(l1):hi=l(l2+i)-i
  77. 905 pi=lo+int((hi-lo+i)*rnd(.)):pa$=w$(pi):w$(pi)=w$(hi):w$(hi)=pa$
  78. 910 hi=hi-i:return
  79. 1000 print"[147]":input"how many players (1-10)";np:ifnp>.andnp<11then1020
  80. 1010 gosub1850:goto1000
  81. 1020 print:print:print"there are"n"spelling words,":print"divided into";
  82. 1025 ifnl=ithenprint" 1 level":goto1040
  83. 1030 printnl"levels"
  84. 1040 print:l1=.:l2=.:ifnl=ithenl1=i:l2=i:goto1080
  85. 1045 print"which level would you like the"
  86. 1050 t$=mid$(str$(nl),2):print"easiest words to come from (1-"t$")";:input l1
  87. 1055 ifl1<1orl1>nlthenprint"[145][145]":goto1050
  88. 1060 ifl1=nlthenl2=nl:goto1080
  89. 1065 print:print"which level would you like the"
  90. 1070 print"hardest words to come from ("mid$(str$(l1),2)"-"t$")";: input l2
  91. 1075 ifl2<l1orl2>nlthenprint"[145][145]":goto1050
  92. 1080 lo=i:hi=.
  93. 1090 print:print"how many words for this game";:inputnw
  94. 1100 ifnw<1thenprint"[145][145][145]":goto1090
  95. 1125 ifnp>ithen1500
  96. 1130 ct=.
  97. 1140 ff=.:print"[147]":gosub2000:gosub5000
  98. 1150 ifffthensc=sc+i
  99. 1160 ct=ct+i:gosub2000:gosub6000
  100. 1167 if ct<nw then 1140
  101. 1170 goto3000
  102. 1500 p=.
  103. 1510 p=p+i:ifp>npthenp=i
  104. 1520 print"[147]":printtab(6)"player"p"   score:"ss(p);"out of"nw
  105. 1540 ff=.:gosub5000
  106. 1546 gosub6000:ifffthenss(p)=ss(p)+i
  107. 1550 ifss(p)>=nwthen1600
  108. 1560 ifffthen1520
  109. 1570 goto1510
  110. 1600 print"[147]"spc(12)"player"p"wins!":forj=ito4:gosub1800:next:goto4000
  111. 1800 forp1=ito2:poke54296,15:poke54277,0:poke54278,247:poke54276,33
  112. 1805 poke54273,34:poke54272,0:forp2=ito150:next:poke54276,32
  113. 1810 forp2=ito50:nextp2:nextp1:return
  114. 1850 poke54296,15:poke54277,45:poke54278,165:poke54276,33
  115. 1855 poke54273,8:poke54272,5:forp2=ito250:next:poke54276,16:return
  116. 2000 print""tab(9)"score:";sc"[157] out of"ct;:ifct=.thenx=.:goto2010
  117. 2005 x=int(sc/(ct)*100+.5)
  118. 2010 print"[157][160] ("mid$(str$(x),2)"%)[146]":return
  119. 3000 print"[147]":gosub2000:print:print:print
  120. 3010 onint(x/20)+igoto3030,3040,3050,3060,3070,3080
  121. 3030 gosub1850:print"maybe you ought to buy a dictionary!":goto4000
  122. 3040 print"who cares about spelling anyway?":goto4000
  123. 3050 print"not bad, keep practicing.":goto4000
  124. 3060 print"great!  you are on your way to being a  good speller!":goto4000
  125. 3070 gosub1800:print"excellent!  you are a super speller!":goto4000
  126. 3080 forx=ito3:gosub1800:nextx:print"fantastic!  you got them all!":goto4000
  127. 4000 forj=ito4000:next:poke53280,s1:poke53281,s2:end
  128. 5000 ff=.:xf=0:gosub900:ifmid$(pa$,1,1)="<"thenxf=1:pa$=mid$(pa$,2)
  129. 5005 gosub500:ifxfthent$=pa$:pa$=pb$:pb$=t$
  130. 5010 ifrnd(.)<.25thenpb$=pa$:goto5020
  131. 5020 print""tab(15)"test word"
  132. 5030 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]":w=8+int((22-len(pb$))/2)
  133. 5040 printmid$(bl$,i,w);pb$
  134. 5050 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  135. 5060 print""tab(7)"guess the correct spelling:"
  136. 5070 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  137. 5080 printmid$(bl$,i,w);pb$
  138. 5090 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  139. 5100 print"[145][145]"tab(10):inputx$:jj=i
  140. 5130 print:ifx$=pa$thenprint""tab(16)"correct":gosub1800:ff=i:goto5150
  141. 5140 print""tab(5)"sorry, the correct spelling is:":gosub1850
  142. 5150 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  143. 5160 printmid$(bl$,i,w);pa$
  144. 5170 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]":return
  145. 6000 for xx=1 to 1500:next:print""
  146. 6010 forix=ito21:print"";:next:print"    *** press any key to continue ***"
  147. 6020 t$="":gett$:ift$=""then6020
  148. 6030 return
  149. 34000 i=1:kk=.:print"[147]   vocabulary check":print:print"output to printer (p)"
  150. 34010 t$="":print"       or screen  (s)  p[157][157][157]";:inputt$
  151. 34015 ift$<>"p"andt$<>"s"then34000
  152. 34020 f=3:ift$="p"thenf=4
  153. 34030 mw=1000:dimw$(mw):n=.
  154. 34040 readn$:ifn$="end"then35000
  155. 34050 ifn$="*"then34040
  156. 34060 n=n+1:w$(n)=n$:goto34040
  157. 34999 end
  158. 35000 open4,f:print#4,"correct word        incorrect word"
  159. 35005 print#4,"------- ----        --------- ----"
  160. 35010 forj=1ton:pa$=w$(j):xf=0:ifmid$(pa$,1,1)="<"thenxf=1:pa$=mid$(pa$,2)
  161. 35020 gosub500:ifxfthent$=pa$:pa$=pb$:pb$=t$
  162. 35030 print#4,pa$;mid$("                   ",1,20-len(pa$));pb$;
  163. 35040 t$="[160][160][160]":ifpa$=pb$thent$="***"
  164. 35050 print#4,"  "t$:kk=kk+1:ifkk<23orf=4then35090
  165. 35060 print"pausing--hit any key to continue":t$="":kk=.
  166. 35070 gett$:ift$=""then35070
  167. 350