home *** CD-ROM | disk | FTP | other *** search
- 1 rem *** the most and the least ***
- 2 rem an educational game: put lists in the right order
- 3 rem this program looks for disk files that begin with "q "
- 4 rem these are created with the quiz files included, or make your own using
- 5 rem the format in the 'quiz maker' program
- 9 rem go set up video memory and the character set
- 10 gosub 1000
- 11 rem go display title screen and get directory
- 12 poke 808,234:gosub 900:poke 808,234
- 45 xp=cp+na:goto 140
- 49 rem ** joystick and keyboard read
- 50 get a$
- 51 a=255-peek(56320):b=a and16:a=a and3
- 52 return
- 59 rem ** animate 'next' string
- 60 nn=nn-1:if nn<1 then nn=nz
- 61 a=asc(mid$(ni$,nn,1)):b=10+val(mid$(nl$,nn,1))
- 62 print fc$(q,0)vv$(2+na)tab(1)mid$(nx$,a,b)
- 63 return
- 69 rem ** blank a line
- 70 print vv$(v)"[146] ";:return
- 100 gosub 60:gosub 50:if a$=" "or b>1 then 200
- 105 if a$="[135]" or a=1 then 120
- 110 if a$="[136]" or a=2 then 130
- 115 goto 100
- 119 rem * upmove
- 120 if cp=(22-na) then cp=len(qr$(q)):goto 140
- 121 if cp=1 then cp=22-na:goto 140
- 122 cp=cp-1:goto 140
- 129 rem * downmove
- 130 if cp=(22-na) then cp=1:goto 140
- 131 if cp=len(qr$(q))then cp=22-na:goto 140
- 132 cp=cp+1:goto 140
- 139 rem * print cursor at new position
- 140 print vv$(2+xp)"[146] "vv$(2+cp+na)fc$(q,3)cu$;:xp=cp+na:goto 100
- 198 rem *** choice handling
- 199 rem * choice to quit?
- 200 v=2+na:gosub70:if cp=22-na then 300
- 201 rem * was it the right answer?
- 202 a=asc(mid$(qr$(q),cp,1)):if a=na then 230
- 209 rem ** wrong answer handling
- 210 tp=tp-1:rem score down
- 211 rem * find correct answer
- 212 for i=1 to len(qr$(q)):a=asc(mid$(qr$(q),i,1))
- 213 if a=na then cp=i
- 214 next:print vv$(2+xp)"[146] "vv$(2+cp+na)fc$(q,1)cu$;:xp=cp+na
- 215 rem * display error message
- 216 print vv$(2+na)tab(1)fc$(q,1)"[160][211][207][160][211][207][210][210][217][174][174][174]";:for i=0 to 999:next:goto 250
- 229 rem ** right answer handling
- 230 tp=tp+(qt(q)-na):rem score up
- 231 rem * display congratulations
- 232 print vv$(2+na)tab(1)fc$(q,1)"[160][210][201][199][200][212][160][207][206][161][161][161]";:for i=0 to 999:next:goto 250
- 248 rem ** shrink list and test for end
- 249 rem * move correct answer from available list to final list
- 250 print vv$(2+cp+na)"[146] ";:na=na+1:v=2+na:gosub 70
- 251 x=len(qr$(q)):if x<2 or na>qt(q)then qr$(q)="":gosub 960:goto 280
- 252 if cp=1 then qr$(q)=right$(qr$(q),x-1):goto 255
- 253 if cp=x then qr$(q)=left$(qr$(q),x-1):goto 255
- 254 qr$(q)=left$(qr$(q),cp-1)+right$(qr$(q),x-cp):goto 255
- 255 gosub 960:cp=1:goto 140
- 279 rem ** last question was answered
- 280 print vv$(24)fc$(q,3)cu$fc$(q,1)"[160][199][207][160][207][206][191][160]";
- 281 poke 198,0
- 282 gosub 50:if b=0 and a$="" then 282
- 283 rem * last quiz finished, show choices
- 284 x=len(rr$):if x<1 then 300
- 285 rem * go select next quiz
- 286 gosub 950:xp=cp+na:goto 140
- 299 rem *** quit handling
- 300 for v=3 to 24:gosub 70:next:poke 198,0
- 301 rem * display options
- 302 print vv$(3)fc$(q,2)" leave the game entirely";
- 303 print vv$(4)" display directory of quiz files";
- 304 print vv$(5)" repeat this group of lists";
- 305 rem * are there any quizzes left?
- 306 if len(rr$)<1 then 330
- 307 print vv$(6)" resume this quiz where we left it";
- 308 print vv$(7)fc$(q,1)"[160][160][160][215][200][193][212][160][215][201][204][204][160][215][197][160][196][207][160][206][207][215][191][160][160][160][160][160][160][160][160][160][160][160][160][160][160][160][160]";
- 309 rem ** player input loop (mid-game)
- 310 w=6:xw=6:print vv$(w)fc$(q,3)cu$;
- 311 rem * get player input
- 312 gosub 50:if a$=" " or b>0 then 340
- 313 if a$="[135]" or a=1 then w=w-1:gosub 320:goto 312
- 314 if a$="[136]" or a=2 then w=w+1:gosub 320:goto 312
- 315 goto 312
- 319 rem * move cursor (mid-game)
- 320 if w>6 then w=3
- 321 if w<3 then w=6
- 322 print vv$(xw)"[146] "vv$(w)cu$;:xw=w:return
- 324 rem * move cursor (end-game)
- 325 if w>5 then w=3
- 326 if w<3 then w=5
- 327 print vv$(xw)"[146] "vv$(w)cu$;:xw=w:return
- 329 rem ** player input loop (end-game)
- 330 w=5:xw=5:print vv$(w)fc$(q,3)cu$;
- 331 rem * get player input
- 332 gosub 50:if a$=" " or b>0 then 340
- 333 if a$="[135]" or a=1 then w=w-1:gosub 325:goto 332
- 334 if a$="[136]" or a=2 then w=w+1:gosub 325:goto 332
- 335 goto 332
- 339 rem ** option handling
- 340 on w-2 goto 1080,350,360,370:goto 300
- 349 rem ** resume game from the start
- 350 poke 53281,6:print "[154][147]":poke 53282,2:poke 53283,1:poke 53284,7:run
- 359 rem ** start this quiz group over
- 360 gosub 944:xp=cp+na:goto 140
- 369 rem ** resume quiz where we left it
- 370 for v=3 to 8:gosub 70:next
- 371 gosub 960:cp=1:goto 140
- 898 rem *** game opening
- 899 rem display titles
- 900 print"[147][144][160][160][160][160][160][160][160][160][212][200][197][160][205][207][211][212][160][193][206][196][160][212][200][197][160][204][197][193][211][212][160][160][160][160][160][160][160][160][160]"
- 901 poke 53281,6:poke 53280,6:print"[160][160][160][196][201][210][197][195][212][207][210][217][160][207][198][160][209][213][201][218][160][198][201][204][197][211][173][173][160][160][160][160][160][160][160][160][160][160][160]"
- 902 gosub 1040
- 903 if x=0 then print "insert disk with 'q ' files and start again":goto 1080
- 904 for i=0 to x-1:print vv$(i+2)" "right$(ff$(i),len(ff$(i))-2)"[146]":next
- 905 print " quit":print "[160][160][160][202][207][217][211][212][201][195][203][160][207][210][160][198][181][173][198][183][160][212][207][160][205][207][214][197][160][193][210][210][207][215][174][160][160][160][160]"
- 906 print "[160][160][160][194][213][212][212][207][206][160][207][210][160][211][208][193][195][197][194][193][210][160][212][207][160][205][193][203][197][160][195][200][207][201][195][197][174][160][160]"
- 909 rem * get choice of quiz file
- 910 cp=2:xp=cp:cu$="[223][146]":print vv$(cp)cu$;
- 911 gosub 50:if a$="" and a=0 and b=0 then 911
- 912 xp=cp:if a$=" " or b>0 then 920
- 913 if a$="[135]" or a=1 then cp=cp-1:if cp<2 then cp=2+x
- 914 if a$="[136]" or a=2 then cp=cp+1:if cp>(2+x) then cp=2
- 915 print vv$(xp)" "vv$(cp)cu$;:goto 911
- 920 if cp=(x+2) then 1080
- 921 ff$=ff$(cp-2)
- 922 print vv$(24)"now loading "ff$"[146]";
- 929 rem ** load chosen file
- 930 open 15,8,15,"i":close 15:open 2,8,2,"0:"+ff$+",s,r"
- 931 rem * how many quizzes in file? (no more than 8)
- 932 input#2,nq:if nq>8 then nq=8
- 933 rem * dimension arrays
- 934 dim qe$(8,21),qf$(8,21),qr$(8),qt(8),fc$(8,3),bc(8,3),tl$(8),fl$(8),eh$(1,8)
- 935 rem * loop through the quizzes
- 936 for i=1 to nq:input#2,qt(i):a=fre(9)
- 937 rem * get colors
- 938 for j=0 to 3:input#2,bc(i,j):next:for j=0 to 3:input#2,fc$(i,j):next
- 939 rem * get quiz title, format, heads
- 940 input#2,tl$(i):input#2,fl$(i):input#2,eh$(0,i):input#2,eh$(1,i)
- 941 rem * loop through the entries
- 942 for j=1 to qt(i):input#2,qe$(i,j):input#2,qf$(i,j):next:next:close 2
- 943 rem * initialize random strings
- 944 for i=1 to nq:sr$=left$(ss$,qt(i)):a=rnd(0):gosub 1070:qr$(i)=zz$:next
- 945 rem * go set up random string to control quiz order
- 946 sr$=left$(ss$,nq):a=rnd(0):gosub 1070:rr$=zz$
- 947 rem * go set up 'next' line
- 948 gosub 1060
- 949 rem ** initialize next quiz
- 950 q=asc(left$(rr$,1)):a=len(rr$):if a<2 then rr$="":goto 953
- 951 rr$=right$(rr$,a-1)
- 952 rem * clear screen, print heading
- 953 for i=0 to 3:poke 53281+i,bc(q,i):next:poke 53280,bc(q,0):print "[147]";
- 954 print vv$(0)fc$(q,3)tl$(q);:print vv$(1)fc$(q,0)fl$(q);
- 955 print vv$(2)fc$(q,1)eh$(0,q)eh$(1,q);
- 956 rem * initial values for quiz
- 957 na=1
- 959 rem ** refresh screen
- 960 cp=1:if na=1 then 964
- 961 rem * print answers already given
- 962 for i=1 to na-1:print vv$(2+i)fc$(q,2)" "qe$(q,i)fc$(q,3)qf$(q,i);:next
- 963 rem * print random-order list of remaining answers
- 964 if len(qr$(q))<1 then 968
- 965 for i=1 to len(qr$(q))
- 966 print vv$(na+2+i)fc$(q,0)tab(1)qe$(q,asc(mid$(qr$(q),i,1)))
- 967 next
- 968 print vv$(24)fc$(q,1)" [160][209][213][201][212][160]"tab(18)fc$(q,2)" score "tp*10"[146]";
- 969 if(peek(52)-peek(50))>12 then return
- 970 print vv$(24)fc$(q,2)" pause for garbage collection..........";
- 971 a=fre(9):return
- 996 return
- 998 rem ** video set up
- 999 rem * lower top of memory; set video control values
- 1000 poke 55,255:poke 56,138:vm=35840:cm=40960:sm=140
- 1001 rem * set video block
- 1002 poke 56578,peek(56578)or3:poke 56576,(peek(56576)and 252)+1
- 1003 rem * set screen and character memory locations
- 1004 poke 53272,56:poke 648,sm:print "[147]loading character set........_[223][146]_[223]"
- 1005 rem * switch to extended background color mode
- 1006 poke 53265,peek(53265)or 64:poke 53282,8:poke 53283,7:poke 53284,1
- 1009 rem * copy character shapes into ram
- 1010 poke 56333,127:poke 1,peek(1) and 251
- 1011 for i=0 to 511:poke cm+i,peek(53248+i):next
- 1012 poke 1,peek(1)or 4:poke 56333,131
- 1013 rem * put in custom characters (comma, altered period, altered left arrow)
- 1014 for i=cm+30*8 to cm+30*8+15:read a:poke i,a:next
- 1015 data 0,0,0,0,0,96,96,192
- 1016 data 192,100,50,31,31,50,100,192
- 1017 for i=cm+46*8 to cm+46*8+7:read a:poke i,a:next
- 1018 data 0,0,0,0,0,96,96,0
- 1019 rem ** set up vertical movement strings
- 1020 dim vv$(24)
- 1021 vv$(0)="":for i=1 to 24:vv$(i)=vv$(i-1)+"":next
- 1022 rem * initialize order string
- 1023 ss$="":for i=1 to 21:ss$=ss$+chr$(i):next
- 1030 return
- 1038 rem *** directory search ***
- 1039 rem * open directory file
- 1040 open 15,8,15:print#15,"i":open2,8,2,"$"
- 1041 rem * skip past header block
- 1042 for i=0 to 253:get#2,a$:next
- 1043 rem ** loop to read a block
- 1044 rem * set up variables
- 1045 x=0:f=0:dim ff$(27),bb$(7)
- 1046 rem * read 8-file block
- 1047 for i=0 to 7:bb$(i)="":get#2,a$,a$,a$:for j=3 to 18:get#2,a$
- 1048 if len(a$)>0 thenif asc(a$)<96 then bb$(i)=bb$(i)+a$
- 1049 next
- 1050 for j=0 to 10:get#2,a$:next:if i<7 then get#2,a$,a$
- 1051 if(len(bb$(i))>0)and(left$(bb$(i),2)="q ")then ff$(x)=bb$(i):x=x+1
- 1052 next:f=f+1:if (x<20)and(f<2)andlen(bb$(7))>0 then 1047
- 1055 close 2:close 15:return
- 1059 rem ** initialize 'next' string
- 1060 tp=0:nx$="next[223]_[223][146]_[206][197][216][212]_[223][146]_[223]next[223][146]_[223]_[206][197][216][212][146]_[223]_[223][146]next[223]_[223][146]_[206][197][216]"
- 1061 nn=1:ni$="":nz=len(nx$)-14:a=fre(9):for i=1 to nz
- 1062 a$=mid$(nx$,i,1):if a$<>"" and a$<>"[146]" then ni$=ni$+chr$(i)
- 1063 next:a=fre(9)
- 1064 nl$="45556665567777666667666555666655":nz=len(nl$):return
- 1069 rem ** subroutine to set up random-rder strings
- 1070 zz$=""
- 1071 a=len(sr$):b=1+int(rnd(9)*a):if b<1 or b>a then 1071
- 1072 zz$=zz$+mid$(sr$,b,1):if len(sr$)=1 then return
- 1073 if b=1 then sr$=right$(sr$,a-1):goto 1071
- 1074 if b=a then sr$=left$(sr$,a-1):goto 1071
- 1075 sr$=left$(sr$,b-1)+right$(sr$,a-b):goto 1071
- 1079 rem *** quit, restoring screen memory to normal
- 1080 poke 53281,6:poke 53280,14:print"[154]":poke 55,255:poke 56,159:poke 808,237
- 1085 poke 648,4:poke 56576,peek(56576)or 3:poke 53272,20:print "[147]":end
- 2000 open 2,8,2,ff$:get#2,nq:print nq:close2:return
-