home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1985 Summer
/
rerun-1985-summer-side-b.d64
/
spelling
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
14KB
|
301 lines
100 i=1:s1=peek(53280):s2=peek(53281):poke53280,0:poke53281,0
105 forj=ito50:bl$=bl$+" ":next
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]"
120 print" [221] spelling challenge [221]"
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]"
140 print:print" created by"
150 print" michael broussard"
155 print" please wait while the program reads"
157 printtab(10)"its vocabulary words"
160 mw=750:ml=20:dimw$(mw):n=.:nl=i:diml(ml):l(i)=i
170 readn$:ifn$="end"then200
175 ifn$="*"thenifnl<ml-ithennl=nl+i:l(nl)=n+i:goto170
180 n=n+i:ifn>mwthenprint"too many words--can't save more than"mw:n=n-i:goto200
190 w$(n)=n$:goto170
200 ifl(nl)>nthennl=nl-i
205 l(nl+1)=n+i:goto1000
397 rem return index of p1$ in pa$ as pr, starting as ps. if pe is true, only
398 rem match at end, if pn is true, don't match at end. if pb is true, don't
399 rem match at beginning
400 pr=.:p1=len(p1$):p2=len(pa$):pi=ps:ifpe=.then415
405 ifp1<p2thenp1=p2-p1+i:ifmid$(pa$,p1)=p1$thenpr=p1:goto445
410 return
415 ifpi>p2-p1+ithenreturn
420 ifmid$(pa$,pi,p1)<>p1$thenpi=pi+i:goto415
425 ifpnthenifpi+p1-i=p2thenreturn
430 ifpbthenifpi=ithenpi=pi+i:goto415
435 pr=pi
440 remstarting at pr,replace p1$ with p2$ in pa$, creating pb$
445 ifpfthenreturn
450 pb$=left$(pa$,pr-i)+p2$+mid$(pa$,pr+len(p1$))
455 nt=nt+i:return
500 nt=.:p1$="^":ps=i:pe=.:pn=.:pf=i:gosub400
505 ifpr=.then515
510 pb$=mid$(pa$,pr+i,len(pa$)-pr):pa$=left$(pa$,pr-i):nt=i:return
515 pf=.:pb=.:ps=i:pn=.:pe=.:rem match anywhere
520 p1$="nn":p2$="n":gosub400:ifntthenreturn
525 p1$="mm":p2$="m":gosub400:ifntthenreturn
530 p1$="zz":p2$="z":gosub400:ifntthenreturn
535 pb=i:pn=.:pe=i:rem match at end not at beginning
537 p1$="le":p2$="el":gosub400:ifntthenreturn
540 p1$="or":p2$="er":gosub400:ifntthenreturn
542 p1$="ence":p2$="ance":gosub400:ifntthenreturn
543 p1$="ance":p2$="ence":gosub400:ifntthenreturn
545 p1$="ar":p2$="er":gosub400:ifntthenreturn
550 p1$="ary":p2$="ery":gosub400:ifntthenreturn
555 p1$="ent":p2$="ant":gosub400:ifntthenreturn
560 p1$="ant":p2$="ent":gosub400:ifntthenreturn
565 p1$="able":p2$="ible":gosub400:ifntthenreturn
570 p1$="ible":p2$="able":gosub400:ifntthenreturn
575 p1$="ious":p2$="uous":gosub400:ifntthenreturn
577 p1$="uous":p2$="ous":gosub400:ifntthenreturn
580 pn=.:pe=.:pb=i:rem don't match at beginning
585 p1$="ei":p2$="ie":gosub400:ifntthenreturn
590 p1$="sc":p2$="c":gosub400:ifntthenreturn
595 p1$="z":p2$="zz":gosub400:ifntthenreturn
600 pe=.:pn=i:pb=.:rem don't match at end
605 p1$="ss":p2$="s":gosub400:ifntthenreturn
610 p1$="ie":p2$="ei":gosub400:ifntthenreturn
615 p1$="ly":p2$="li":gosub400:ifntthenreturn
620 pe=. : pn=. : rem match anywhere
625 p1$="mo":p2$="ma":gosub400:ifntthenreturn
630 p1$="ll":p2$="l":gosub400:ifntthenreturn
635 p1$="bb":p2$="b":gosub400:ifntthenreturn
640 p1$="cc":p2$="c":gosub400:ifntthenreturn
645 p1$="tt":p2$="t":gosub400:ifntthenreturn
650 p1$="ff":p2$="f":gosub400:ifntthenreturn
655 p1$="rr":p2$="r":gosub400:ifntthenreturn
660 p1$="pp":p2$="p":gosub400:ifntthenreturn
665 p1$="yl":p2$="il":gosub400:ifntthenreturn
670 p1$="cq":p2$="q":gosub400:ifntthenreturn
675 p1$="uous":p2$="ous":gosub400:ifntthenreturn
680 p1$="ys":p2$="is":gosub400:ifntthenreturn
685 ifnt=.thenpb$=pa$
690 return
899 rem return a word in pa$ at random
900 ifhi<lothenlo=l(l1):hi=l(l2+i)-i
905 pi=lo+int((hi-lo+i)*rnd(.)):pa$=w$(pi):w$(pi)=w$(hi):w$(hi)=pa$
910 hi=hi-i:return
1000 print"[147]":input"how many players (1-10)";np:ifnp>.andnp<11then1020
1010 gosub1850:goto1000
1020 print:print:print"there are"n"spelling words,":print"divided into";
1025 ifnl=ithenprint" 1 level":goto1040
1030 printnl"levels"
1040 print:l1=.:l2=.:ifnl=ithenl1=i:l2=i:goto1080
1045 print"which level would you like the"
1050 t$=mid$(str$(nl),2):print"easiest words to come from (1-"t$")";:input l1
1055 ifl1<1orl1>nlthenprint"[145][145]":goto1050
1060 ifl1=nlthenl2=nl:goto1080
1065 print:print"which level would you like the"
1070 print"hardest words to come from ("mid$(str$(l1),2)"-"t$")";: input l2
1075 ifl2<l1orl2>nlthenprint"[145][145]":goto1050
1080 lo=i:hi=.
1090 print:print"how many words for this game";:inputnw
1100 ifnw<1thenprint"[145][145][145]":goto1090
1125 ifnp>ithen1500
1130 ct=.
1140 ff=.:print"[147]":gosub2000:gosub5000
1150 ifffthensc=sc+i
1160 ct=ct+i:gosub2000:gosub6000
1167 if ct<nw then 1140
1170 goto3000
1500 p=.
1510 p=p+i:ifp>npthenp=i
1520 print"[147]":printtab(6)"player"p" score:"ss(p);"out of"nw
1540 ff=.:gosub5000
1546 gosub6000:ifffthenss(p)=ss(p)+i
1550 ifss(p)>=nwthen1600
1560 ifffthen1520
1570 goto1510
1600 print"[147]"spc(12)"player"p"wins!":forj=ito4:gosub1800:next:goto4000
1800 forp1=ito2:poke54296,15:poke54277,0:poke54278,247:poke54276,33
1805 poke54273,34:poke54272,0:forp2=ito150:next:poke54276,32
1810 forp2=ito50:nextp2:nextp1:return
1850 poke54296,15:poke54277,45:poke54278,165:poke54276,33
1855 poke54273,8:poke54272,5:forp2=ito250:next:poke54276,16:return
2000 print""tab(9)"score:";sc"[157] out of"ct;:ifct=.thenx=.:goto2010
2005 x=int(sc/(ct)*100+.5)
2010 print"[157][160] ("mid$(str$(x),2)"%)[146]":return
3000 print"[147]":gosub2000:print:print:print
3010 onint(x/20)+igoto3030,3040,3050,3060,3070,3080
3030 gosub1850:print"maybe you ought to buy a dictionary!":goto4000
3040 print"who cares about spelling anyway?":goto4000
3050 print"not bad, keep practicing.":goto4000
3060 print"great! you are on your way to being a good speller!":goto4000
3070 gosub1800:print"excellent! you are a super speller!":goto4000
3080 forx=ito3:gosub1800:nextx:print"fantastic! you got them all!":goto4000
4000 forj=ito4000:next:poke53280,s1:poke53281,s2:end
5000 ff=.:xf=0:gosub900:ifmid$(pa$,1,1)="<"thenxf=1:pa$=mid$(pa$,2)
5005 gosub500:ifxfthent$=pa$:pa$=pb$:pb$=t$
5010 ifrnd(.)<.25thenpb$=pa$:goto5020
5020 print""tab(15)"test word"
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)
5040 printmid$(bl$,i,w);pb$
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]"
5060 print""tab(7)"guess the correct spelling:"
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]"
5080 printmid$(bl$,i,w);pb$
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]"
5100 print"[145][145]"tab(10):inputx$:jj=i
5130 print:ifx$=pa$thenprint""tab(16)"correct":gosub1800:ff=i:goto5150
5140 print""tab(5)"sorry, the correct spelling is:":gosub1850
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]"
5160 printmid$(bl$,i,w);pa$
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
6000 for xx=1 to 1500:next:print""
6010 forix=ito21:print"";:next:print" *** press any key to continue ***"
6020 t$="":gett$:ift$=""then6020
6030 return
34000 i=1:kk=.:print"[147] vocabulary check":print:print"output to printer (p)"
34010 t$="":print" or screen (s) p[157][157][157]";:inputt$
34015 ift$<>"p"andt$<>"s"then34000
34020 f=3:ift$="p"thenf=4
34030 mw=1000:dimw$(mw):n=.
34040 readn$:ifn$="end"then35000
34050 ifn$="*"then34040
34060 n=n+1:w$(n)=n$:goto34040
34999 end
35000 open4,f:print#4,"correct word incorrect word"
35005 print#4,"------- ---- --------- ----"
35010 forj=1ton:pa$=w$(j):xf=0:ifmid$(pa$,1,1)="<"thenxf=1:pa$=mid$(pa$,2)
35020 gosub500:ifxfthent$=pa$:pa$=pb$:pb$=t$
35030 print#4,pa$;mid$(" ",1,20-len(pa$));pb$;
35040 t$="[160][160][160]":ifpa$=pb$thent$="***"
35050 print#4," "t$:kk=kk+1:ifkk<23orf=4then35090
35060 print"pausing--hit any key to continue":t$="":kk=.
35070 gett$:ift$=""then35070
350