home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1992 July
/
1992-07.d64
/
quizwhiz
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
194 lines
0 rem copyright 1992 compute publications intl ltd - all rights reserved
1 dimd$(200):dime$(200):dimf$(400):printchr$(8):printchr$(14)
5 print"[147] [158][209]uiz [215]iz 64 ":print" [205]enu:"
10 print" [158][208]ress (1) to make new entries.":poke53281,2:poke53280,6
15 ife$(4)<>""thenprint" [158]press (2) to save entries."
20 print" [158][208]ress (3) to load entries.":ife$(1)=""then30
25 print" [158][208]ress (4) to continue[146] making entries."
30 ife$(1)<>""thenprint" [158]press (5) for correction mode."
35 print" [158][208]ress (6) to scratch files."
40 print" [159][208]ress f1 to return to menu."
45 print" [194]y [210]izwaan [203]han"
46 print"":fori=1to19:print"[166][166]";:next
50 print" [146]";
55 geta$:ifa$="5"thenife$(1)<>""thenj=1:goto715
60 ifa$="1"then940
62 ifa$="d"then980
65 ifa$="2"ande$(3)<>""then360
70 ifa$="3"then435
72 ifa$="l"then1000
75 ifa$="4"thenze$="1":goto175
80 ifa$="6"then915
85 ifpeek(56321)=223ande$(4)<>""thenm=1:w=1:q=0:goto520
90 goto55
95 print"[146][147] [156][196]efine subject"
100 print" 1)[205]ath"
105 print" 2)[197]conomics"
110 print" 3)[211]cience"
115 print" 4)[200]istory"
120 print" 5)[199]eography"
125 print" 6)[197]nglish"
127 print" ^)[207]ther "
130 geta$:ifa$="1"thenn$="[205]ath":goto175
135 ifa$="2"thenn$="[197]conomics":goto175
140 ifa$="3"thenn$="[211]cience":goto175
145 ifa$="4"thenn$="[200]istory":goto175
150 ifa$="5"thenn$="[199]eography":goto175
155 ifa$="6"thenn$="[197]nglish":goto175
160 ifa$=chr$(133)thendb$="":goto5
165 ifa$="^"theninput"[211]ubject";n$:goto175
170 goto130
175 print"[147] ":ifdb$="1"thendb$="":goto5
180 ifze$="1"thenx=x+1:ze$=""
185 print" [209]uestion number"x"[158][211]ubject:"n$""
190 print" [197]nter question (@ to quit)" :poke53280,2
191 ifdb$="1"thenprint"[158]"da$"":print"";
195 inputd$(x):ifd$(x)="@"anddb$="1"then190
245 ifd$(x)="@"andx<>1thenx=x-1:ze$="1":goto5
246 ifd$(x)="@"andx=1then5
247 ifdb$="1"andd$(x)<>""thend$(x)=left$(d$(x),80):goto845
250 ifd$(x)<>""thend$(x)=left$(d$(x),80):goto275
255 print"[147] ":goto185
275 print:print" [197]nter answer"
276 ifdb$="1"thenprint"[158]"ea$"":print"";
280 inpute$(x):ife$(x)="@"anddb$="1"then275
285 ifdb$="1"ande$(x)<>""thene$(x)=left$(e$(x),80):goto845
290 ife$(x)="@"then5
335 ife$(x)<>""thene$(x)=left$(e$(x),80):x=x+1:goto175
340 goto275
360 nam$="":print"[147] [212]ype in file name to save":inputnam$:ifnam$=""then5
390 k$="":open7,8,0,nam$:input#7,k$:ifk$=""thenclose7:goto405
395 close7:print" [211]cratching old file.":ft$="s0:":ft$=ft$+nam$
400 open15,8,15,ft$:close15
405 open7,8,1,nam$:print"[147] saving : "nam$"":print#7,n$:print#7,x
410 forj=1tox:print#7,d$(j):nextj:ze$="1"
415 forj=1tox:print#7,e$(j):nextj:close7:m=1:fx=0:q=0
430 print"[147] *** [196]ata has been saved ***"
431 fori=1to2000:nexti:goto520
435 print"[147] [204]oad erases any work in memory. [193]re you sure (y/n)"
440 geta$:ifa$="n"then5
445 ifa$="y"then1000
450 goto440
520 zx=x:print"[147] [211]core="q"[146] [209]uestion number="w"[146]"
525 print"[212]otal number of questions="x"":poke53280,6:poke53281,6
530 print"[158] ";
535 print"[145] [211]ubject : "n$""
540 print"[209]uestion:"d$(m)"[146]";f$
545 y=int(4*rnd(1))+1
550 t=int((x+1-1)*rnd(1))+1:u=int((x+1-1)*rnd(1))+1:v=int((x+1-1)*rnd(1))+1
555 ife$(m)=e$(t)ore$(m)=e$(u)ore$(u)=e$(t)then550
556 ife$(v)=e$(m)ore$(v)=e$(t)ore$(v)=e$(u)then550
560 ify=1then575
562 ify=3then570
565 ify=2then580
567 print"a [155]"e$(t)"":print"b [155]"e$(u)"":print"c [155]"e$(v)""
568 print"d [155]"e$(m)"":l$="d":goto585
570 print"a [155]"e$(t)""
571 print"b [155]"e$(u)""
572 print"c [155]"e$(m)"":l$="c":print"d [155]"e$(v)"":goto585
575 print"a [155]"e$(m)""
576 print"b [155]"e$(t)""
577 print"c [155]"e$(u)"":l$="a":print"d [155]"e$(v)"":goto585
580 print"a [155]"e$(u)""
581 print"b [155]"e$(m)""
582 print"c [155]"e$(t)"":l$="b":print"d [155]"e$(v)"":goto585
585 geta$:ifa$=""then585
590 ifa$=chr$(133)thenfx=0:q=0:goto5
595 ifa$<>"a"anda$<>"b"anda$<>"c"anda$<>"d"then585
600 ifa$=l$thenq=q+1:print" correct!!";:forj=1to500:nextj:goto610
605 goto655
610 m=m+1:ifw=zxthenad=fx-1:fx=0:goto880
615 w=w+1:goto520
620 print"[147][146] [217]ou scored"q"[146]out of"x"[146] questions":poke53281,3
625 ifx/2<=qthenprint" [217]ou passed!":goto632
630 print" [211]hame on you, you failed!!!"
632 print" [208]ress 'f1' to exit."
635 print"[208]ress [195]ommodore key to do the test again":goto640
640 geta$:ifa$=chr$(133)then5
645 ifpeek(56321)=223thenm=1:w=1:q=0:goto520
650 goto640
655 print"[201]ncorrect![146] the answer is":f$(fx)=d$(m):fx=fx+1:f$(fx)=e$(m):fx=fx+1
660 ify=1thenprint"a [146]"e$(m)"";f$:goto675
665 ify=2thenprint"b [146]"e$(m)"";f$:goto675
670 print"c [146]"e$(m)"";f$:goto675
675 forj=1to2:poke54276,0:poke54277,0:poke54272,0:poke54296,15
680 poke54277,129:poke54276,23
685 poke54273,137:poke54272,43:nextj:fori=1to1500:nexti:goto610
690 poke1024,82:poke1025,65:poke1026,75:poke1027,72:poke1028,65:poke1029,78
691 goto585
715 print"[158][147] [195]orrection [205]ode ";
720 print" [212]otal questions entered="x"":poke53281,6:poke53280,2
725 print" [159][209]uestion no."j"subject:"n$""
730 print"[158][209]uestion:[155]"d$(j)"":print
735 print"[158][193]nswer:[155]"e$(j)""
740 print" [158][208]ress'<>'to flip through entries."
741 print" [208]ress'[210]eturn'for correction."
743 print" [208]ress'[210]'to rename subject."
745 geta$:ifa$=chr$(13)thenvb=x:x=j:db$="1":goto788
750 ifa$="."then782
755 ifa$=chr$(133)thendb$="":goto775
760 ifa$="r"thena$="":db$="1":goto95
765 ifa$=","then785
770 goto745
775 ifvb>0thenx=vb:goto5
780 goto5
782 ifj=xthenj=1:goto715
783 j=j+1:goto715
785 ifj=1thenj=x:goto715
786 j=j-1:goto715
788 print" [153][208]lease select -- "
790 print" (1) [193]lter question."
795 print" (2) [193]lter answer. "
800 print" (3) [193]lter both. "
805 print" (4) [196]elete both. ":da$=d$(x):ea$=e$(x)
815 geta$:ifa$="1"thens=1:print"[147]":goto190
820 ifa$="2"thens=2:print"[147]":goto275
825 ifa$="3"thens=3:print"[147]":goto190
830 ifa$="4"thenmk=vb-j:db$="":goto860
836 ifa$=chr$(133)thendb$="":x=vb:goto5
840 goto815
845 ifs=1ors=2thenx=vb:db$="":goto5
850 ifs=3thens=s+1:goto275
855 x=vb:db$="":goto5
860 ifj=1ande$(j+1)=""thenrun
865 ife$(j+1)=""thend$(j)="":e$(j)="":vb=vb-1:x=vb:goto5
870 print" [196]eleting....":fori=1tomk:ad$=d$(j+1):av$=e$(j+1)
875 d$(j)=ad$:e$(j)=av$:j=j+1:nexti:vb=vb-1:x=vb:e$(j)="":d$(j)="":goto5
880 iff$(fx)=""then620
885 print"[147][146] [144][212]he ones you got wrong are-":poke53281,1
890 print" [209]uestion - "f$(fx)"";f$:f$(fx)="":fx=fx+1
895 print" [193]nswer - "f$(fx)"";f$:f$(fx)="":print" [159][208]ress [210]eturn"
900 geta$:ifa$<>chr$(13)then900
905 ifad=fxthenfx=0:goto620
910 fx=fx+1:goto880
915 print"[147] [206]ame of file to scratch":inputfr$:iffr$=""then5
920 print" [201]nsert disk containing file and press [210]eturn"
925 geta$:ifa$<>chr$(13)then925
930 ft$="s0:":ft$=ft$+fr$:open15,8,15,ft$:close15
935 print" [198]ile has been scratched":fori=1to3000:nexti:goto5
940 print"[147] [205]aking new entries will erase any old[146] entries in memory"
945 print" [193]re you sure (y/n)"
950 geta$:ifa$="n"then5
955 ifa$="y"then965
960 goto950
965 clr:dimd$(500):dime$(500):x=1:goto95
970 print" [198]ile not found":open15,8,15,"uj":fori=1to2000:nexti:close15:run
980 i=1:print"[147]":open2,8,0,"$":get#2,a$:get#2,a$
982 ifi=22theni=1:goto992
985 get#2,l$:get#2,l$:ifst=64thenclose2:goto992
986 get#2,lb$:get#2,hb$:ln=asc(lb$+chr$(0))+256*asc(hb$+chr$(0))
987 print ln;
988 get#2,a$:ifa$=""theni=i+1:p