home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
UpTime Volume 2 #8
/
utv2n8s2.d64
/
CH
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-28
|
8KB
|
259 lines
1 if ru<>1 then clr:rem mixed 1/20/88
10 poke53280,0:poke53281,0
15 a1=1
17 c1$="[164][157]" : c2$=" [157]" : c%=0 : i$="" : no% = 0
20 dims(9),s$(11),se$(11),nu$(10,3)
100 gosub 7000:printchr$(14)
105 gosub10000
110 gosub480
250 goto 2000
300 n=n+1:rem if z=5 then n=n+1
310 rw=int(rnd(0)*6)+1:for j=1 to 4:v=19:h=1:gosub 920
320 gosub 990:gosub 610:delay=.05:gosub 940:v=19:gosub 920
330 tx$=chr$(co(j))+rw$(rw)+chr$(5):gosub 990:gosub 610:delay=.2:gosub 940
340 nextj:return
400 rem *** get character ***
410 geta$:ifa$=""then410
411 return
420 gosub 400:a=val(a$):ifa<loora>hithen420
421 return
480 print"[147]"
481 h=10:tx$="[214][201][211][201][207][206][160][211][207][198][212][215][193][210][197] presents:":v=1:gosub 600
482 tx$="[195]onverting [205]ixed [206]umerals"
483 print"";:h=10:v=3:gosub 600
484 print"";:print:gosub 800:return
490 print chr$(142): rem *** print screen header ***
491 print"[147]"
492 tx$="vision software presents:":h=10:v=1:gosub 610:tx$=t$
493 print"";:h=10:v=3:gosub 610
494 print"";:print:gosub 800:return
500 rem **** remove leading spaces ****
510 l=len(sp$):ifleft$(sp$,1)<>" "thengoto530
520 l=l-1:sp$=right$(sp$,l)
530 return
600 rem *** hor/ver tab ***
610 vt$="":forq=1tov
620 :vt$=vt$+"":next q
630 print"";vt$;:printtab(h);tx$;:return
800 print"";:for q=1 to 40
810 :print"[192]";:next q
820 print"";:return
830 printchr$(31);:tx$="[182][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][181]":v=v2:gosub610:tx$="[182] [181]"
840 fori=1to8:v=v2+i:gosub610:nexti:tx$="[182][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][181]":v=v+1
850 gosub610: print"";:print:return
870 tx$="[210][210][210][210][210][210]":gosub 610:return
900 v=24:tx$=" <return> to continue, <_> to exit[146]":gosub 990:gosub 610
901 lo=0:gosub400:if a$="_" then 4000
902 ifa$<>chr$(13) then 900
903 return
910 v=24:tx$=" <[210][197][212][213][210][206]> to continue, <_> to exit[146]":gosub 990:gosub 610
911 lo=0:gosub400:if a$="_" then 4000
912 ifa$<>chr$(13) then 910
913 return
920 h=0:tx$=" ":gosub 610:return
940 ti$="000000"
941 geta$:ifa$<>""then943
942 ifti/60<delaythen941
943 return
990 ln=len(tx$):h=(40-ln)/2:return
1000 denom=int(rnd(0)*8)+2:num=int(rnd(0)*72)+3:if nun<denom then 1000
1010 for j=2 to 9:if num/j<>int(num/j) then 1030
1020 if denom/j=int(denom/j) then 1000
1030 next j:whole=int(num/denom):if whole>9 then 1000
1040 n2=whole*denom:n1=num-n2:n2$=str$(n2)
1050 num$=right$(str$(num),2):denom$=right$(str$(denom),1):
1060 n1$=right$(str$(n1),1):whole$=right$(str$(whole),1)
1070 eq$=whole$+" x "+denom$+" + "+n1$+" = " +num$:return
1100 rem write numbers
1110 for j=1 to 3:v=v1+j:h=h1:tx$=nu$(iq,j):gosub 610:next j :return
2000 if ru=1 then 2035
2010 h=0:v=10:tx$="[196]o you need a lesson? ":gosub 600:lo=0:gosub 400
2020 ifa$="y"ora$="[217]"thenprinta$: gosub20000:goto 2035
2021 if a$="n" or a$="[206]" thenprinta$:goto2030
2022 a$="":goto 2010
2030 tx$=" ":v=10:h=0:gosub600
2035 h=0:v=7:tx$="[215]hat's your first name? ":gosub610
2036 mx%=20:i$="":gosub60000:nf$=i$:if nf$="" then 2035
2040 h=0:v=9:tx$="[215]hat's your last name? ":gosub600
2042 mx%=20:i$="":gosub60000:nl$=i$
2045 v=11:h=0:tx$="[215]ould you like to: ":gosub600
2048 h=7:v=13:fori=1to3:tx$=str$(i)+". "+op$(i):gosub 610:v=v+1:next i
2050 lo=1:hi=3:tx$="[217]our choice: (1-3) ":h=0:v=v+1:gosub 610:gosub 420:printa$
2060 op=a:hi=20:if op=1then hi=5
2065 v=19:h=0:tx$="[200]ow many problems do you want":gosub 610
2070 v=20:tx$="to do? (1 -"+str$(hi)+") [157][157]" :gosub 610
2072 mx%=2:no%=1:i$="":gosub60000:np=val(i$)
2075 ifnp<loornp>hithen np=0 :goto2065
2110 fork=1tonp
2120 gosub 1000:gosub 490:tx$="change this mixed numeral:":v=6:h=2:gosub 610
2125 v2=8:h=0:gosub 830
2128 v1=10:h1=3 :iq=whole:gosub 1110
2130 v1=8:h1=9:iq=n1:gosub 1110:v1=13:h1=9:v=12:h=8:gosub870:iq=denom:gosub1110
2140 on op gosub 2200,2300,2400
2150 gosub 900:nextk:goto 4000
2200 rem op 1
2210 tx$="the denominator stays the same.":v=19:h=1:gosub 610:iq=denom:v=12
2220 h=27:gosub 870:v1=13: h1=29:gosub 1110:delay=3:gosub940:v=19:h=0:gosub920
2225 n3$="numbers":if whole=1 then n3$="number"
2230 tx$="multiply the whole "+n3$+" by "+denom$+".":v=19:h=0:gosub610
2240 tx$=whole$+" x "+denom$:v=21:h=0:gosub610:delay=1
2250 gosub 940:v=19:gosub 920
2260 h=0:gosub610:tx$="now add the numerator: ":h=0:v=19:gosub610
2270 tx$=eq$:h=0:v=21:gosub 610:h1=27:for i=1to2:if num<=9 then h1=29
2280 iq=val(mid$(num$,i,1)):v1=8:gosub 1110:h1=h1+3:nexti:return
2300 rem op 2
2310 tx$="the denominator stays the same.":v=19:h=1:gosub 610:iq=denom:v=12
2320 h=27:gosub 870:v1=13: h1=29:gosub 1110:delay=3:gosub940:v=19:h=0:gosub920
2325 n3$="numbers":if whole=1 then n3$="number"
2330 tx$="multiply the whole "+n3$+" by "+denom$+".":v=19:h=0:gosub610
2340 tx$=whole$+" x "+denom$+" = ? ":v=21:h=0:gosub610
2342 mx%=20:no%=1:i$="":gosub60000:an=val(i$)
2350 if an=n2 thenv=19:h=0:gosub920:gosub 300:v=19:h=0:gosub920:goto2360
2355 v=21:gosub920:tx$=wh$+" x "+de$+" = "+n2$:v=21:gosub610:de=1:gosub940
2360 h=0:gosub610:v=19:gosub920:tx$="now add the numerator: ":h=0:v=19:gosub610
2365 v=21:h=0:gosub920:tx$=whole$+" x "+denom$+" + "+n1$+" ? ":gosub610
2366 mx%=20:no%=1:i$="":gosub60000:n4$=i$
2370 tx$=eq$:h=0:v=21:gosub 610:h1=27:for i=1to2:if num<=9 then h1=29
2380 iq=val(mid$(num$,i,1)):v1=8:gosub 1110:h1=h1+3:nexti
2385 o=val(n4$):ifo=numthenv=19:gosub920:gosub300
2390 return
2400 rem op 3
2410 tx$="the denominator stays the same.":v=19:h=1:gosub 610:iq=denom:v=12
2420 h=27:gosub 870:v1=13: h1=29:gosub 1110:delay=3:gosub940:v=19:h=0:gosub920
2430 tx$="the new numerator is: ? ":v=21:h=0:gosub610
2432 mx%=20:no%=1:i$="":gosub60000:an=val(i$)
2435 g=g+1:if an=num then 2450
2440 rv=1:v=19:gosub 920:tx$="let me show you this one."
2441 v=21:h=0:gosub 610:de=.7:gosub 940:v=19:gosub 920:v=21:gosub 920:gosub2225
2442 rv=0:goto 2495
2450 ifan=numthenv=19:gosub920:gosub300
2460 h1=27:for i=1to2:if num<=9 then h1=29
2470 iq=val(mid$(num$,i,1)):v1=8:gosub 1110:h1=h1+3:nexti
2495 return
4000 print chr$(14):gosub 480:if op<>3 then 4100
4005 v=10:h=0:tx$="[217]ou got"+str$(n)+" right out of"+str$(g)+" problems"
4010 gosub 610:v=12:tx$="for "+str$(int((n/g)*100))+"%."
4020 gosub610:delay=3:gosub 940
4100 h=0:v=15:tx$="[196]o you want to play again? " :gosub 610
4120 lo=0:gosub400 :printa$:if a$="y" or a$="[217]" then clr:ru=1 :goto 1
4130 if a$="n" or a$="[206]" then 4150
4140 goto 4120
4150 clr:poke53269,0:load"menu",8
4200 stop
5390 return
7000 rem *** read data ***
7010 readt$:for i=1 to 6:read rw$(i):next i
7020 fori=1to3:read op$(i):next i:for i=1 to 4:read co(i):next i
7030 fori=0to9:forj=1to3:readnu$(i,j):nextj:nexti
7040 return
8000 rem *** program data ***
8010 data"converting mixed numerals"
8020 data"great!","fantastic!","super!"
8030 data"you're really going now!","yes! yes! yes!","that's great!"
8040 data"[211]ee examples done."
8050 data"[196]o problems with help."
8060 data"[196]o problems yourself."
8070 data 30,28,31,158
8075 data"[213][195][201]"
8076 data"[221] [221]"
8077 data"[202][195][203]"
8080 data" [174] "," [221] "," [177][160]"
8090 data"[213][195][201]","[213][195][203]","[173][195][189]"
8100 data"[213][195][201]"," [195][179]","[202][195][203]"
8110 data"[221] [221]","[173][195][179]"
8115 data" [177]"
8120 data"[176][195][174]","[173][195][201]","[202][195][203]"
8130 data"[213][195][201]","[171][195][201]","[202][195][203]"
8140 data"[176][195][174]"," [221]"
8145 data" [177]"
8150 data"[213][195][201]","[171][195][179]","[202][195][203]"
8160 data"[213][195][201]","[202][195][179]","[202][195][203]"
10000 rem *** do spritey things ***
10001 for i=704 to 767
10002 readx:pokei,x
10003 next
10004 poke2040,11
10005 poke53269,peek(53269)or1
10006 poke53287,2:poke53277,255:poke53271,255
10007 poke53248,30:poke53249,58
10008 return
10009 data252,252,252,121,249,248,51,243,240
10010 data7,231,224,15,207,192,7,159,128
10011 data3,63,0,0,126,0,0,252,0
10012 data0,120,0,0,48,0,0,0,0
10013 data0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,