home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 July / 1992-07.d64 / quizwhiz (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  7KB  |  194 lines

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