home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 2 #8 / utv2n8s2.d64 / RE (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1988-01-01  |  9.7 KB  |  372 lines

  1. 1 rem **** reducing fractions 1/20/88
  2. 5 clr
  3. 10 poke53280,0:poke53281,0
  4. 15 a1=1
  5. 17 c1$="[164][157]" : c2$=" [157]" : c%=0 : i$="" : no% = 0
  6. 20 dims(9),s$(11),se$(11),nu$(10,3)
  7. 100 gosub4000:printchr$(14)
  8. 105 gosub10000
  9. 110 gosub3700
  10. 120 h=0:v=10:tx$="[196]o you need a lesson? "
  11. 130 gosub3200
  12. 140 lo=0:gosub2100:printa$
  13. 150 ifa$="y"ora$="[217]"thengosub20000:goto 160
  14. 151 if a$="n" or a$="[206]" then 160
  15. 152 goto 120
  16. 160 gosub5000
  17. 165 ru=1
  18. 170 gosub1000
  19. 172 print chr$  (14):gosub 3700:ifop<>3then191
  20. 174 gosub3700
  21. 176 gosub500
  22. 190 gosub 3700
  23. 191 h=0:v=10:tx$="[196]o you want to play again? "
  24. 200 gosub3200
  25. 210 lo=0:gosub2100:printa$
  26. 220 ifa$="y"ora$="[217]"then160
  27. 221 if a$="n" or a$="[206]" then 230
  28. 222 goto 191
  29. 230 clr:poke53269,0:load"menu",8
  30. 240 stop
  31. 300 rem **** rewards ****
  32. 310 rw=int(rnd(1)*6)+1:rw$=rw$(rw)
  33. 320 forl=1to4:v=24:gosub3900:delay=.3:gosub2000
  34. 330 tx$=chr$(co(l))+rw$+chr$(5):gosub3000:gosub3200:delay=.3:gosub2000:next l
  35. 340 return
  36. 500 v=10:h=0:tx$="[217]ou got"+str$(np-mi)+" right out of"+str$(np)+" problems"
  37. 501 print chr$(14)
  38. 510 gosub3200
  39. 540 v=12:tx$="for "+str$(int(((np-mi)/np)*100))+"%."
  40. 545 gosub3200
  41. 550 delay=7:gosub2000
  42. 560 return
  43. 1000 rem *** central routine ***
  44. 1005 hp=0:mi=0
  45. 1007 print"[147]"
  46. 1010 fori=1tonp
  47. 1030 gosub3600
  48. 1040 gosub30000
  49. 1066 v=24:tx$="   <return> to continue, <_> to exit[146]"
  50. 1067 gosub3000:gosub3200
  51. 1068 lo=0:gosub2100
  52. 1069 ifa$="_"then sa=i:i=np
  53. 1070 next i: if sa<>0 then np=sa
  54. 1080 return
  55. 2000 rem *** timer ***
  56. 2010 ti$="000000"
  57. 2015 geta$:ifa$<>""then2030
  58. 2020 ifti/60<delaythen2015
  59. 2030 return
  60. 2100 rem *** get character ***
  61. 2110 geta$:ifa$=""then2110
  62. 2120 a=val(a$):ifa<loora>hithen2110
  63. 2130 return
  64. 2499 rem **** remove leading spaces ****
  65. 2500 l=len(sp$):ifleft$(sp$,1)<>" "thengoto2520
  66. 2510 l=l-1:sp$=right$(sp$,l)
  67. 2520 return
  68. 3000 rem *** center text ***
  69. 3010 ln=len(tx$)
  70. 3020 h=(40-ln)/2
  71. 3030 return
  72. 3100 v=24:tx$="   <[210][197][212][213][210][206]> to continue[146]"
  73. 3110 gosub3000:gosub3200
  74. 3120 lo=0:gosub2100
  75. 3130 ifa$<>chr$(13) then 3100
  76. 3140 return
  77. 3200 rem *** hor/ver tab ***
  78. 3210 vt$="":forq=1tov
  79. 3220 :vt$=vt$+""
  80. 3230 nextq
  81. 3240 print"";vt$;
  82. 3250 printtab(h);tx$;
  83. 3260 return
  84. 3500 rem *** line across screen ***
  85. 3510 print"";
  86. 3520 forq=1to40
  87. 3530 :print"[192]";
  88. 3540 nextq
  89. 3575 print"";
  90. 3580 return
  91. 3600 rem *** print screen header ***
  92. 3610 print"[147]"
  93. 3630 tx$="vision software presents:"
  94. 3640 h=10
  95. 3650 v=1:gosub3200
  96. 3660 tx$=t$
  97. 3665 print"";
  98. 3670 h=10
  99. 3680 v=3:gosub3200
  100. 3685 print"";
  101. 3690 print:gosub3500:return
  102. 3700 rem *** print screen header ***
  103. 3710 print"[147]"
  104. 3740 h=10:tx$="[214][201][211][201][207][206][160][211][207][198][212][215][193][210][197] presents:"
  105. 3750 v=1:gosub3200
  106. 3760 tx$="[210]educing [198]ractions"
  107. 3765 print"";
  108. 3770 h=10
  109. 3780 v=3:gosub3200
  110. 3785 print"";
  111. 3790 print:gosub3500:return
  112. 3900 rem **** blank a line ****
  113. 3910 tx$="                                      ":h=0:gosub3200:return
  114. 4000 rem *** read data ***
  115. 4005 readt$
  116. 4010 fori=1to6
  117. 4020 :readrw$(i)
  118. 4030 nexti
  119. 4040 fori=1to3
  120. 4050 :readop$(i)
  121. 4060 nexti
  122. 4070 for i=1 to 4: read co(i):nexti
  123. 4080 fori=0to9:forl=1to3:readnu$(i,l):nextl:nexti
  124. 4090 forl=1to4:readsh$(l):nextl
  125. 4098 return
  126. 4100 rem *** program data ***
  127. 4110 data"reducing fractions"
  128. 4120 data"great!","fantastic!","super!"
  129. 4130 data"you're really going now!","yes!  yes!  yes!","that's great!"
  130. 4140 data"[211]ee examples done."
  131. 4150 data"[196]o problems with help."
  132. 4160 data"[196]o problems yourself."
  133. 4170 data 30,28,31,158
  134. 4200 data"[213][195][201]","[221] [221]","[202][195][203]"
  135. 4210 data" [174] "," [221] "," [177] "
  136. 4220 data"[213][195][201]","[213][195][203]","[173][195][189]"
  137. 4230 data"[213][195][201]"," [195][179]","[202][195][203]"
  138. 4240 data"[176] [176]","[173][195][179]","  [177]"
  139. 4250 data"[176][195][174]","[173][195][201]","[202][195][203]"
  140. 4260 data"[213][195][201]","[171][195][201]","[202][195][203]"
  141. 4270 data"[176][195][174]","  [221]","  [177]"
  142. 4280 data"[213][195][201]","[171][195][179]","[202][195][203]"
  143. 4290 data"[213][195][201]","[202][195][179]","[202][195][203]"
  144. 4300 data"[193]","[211]","[218]","[216]"
  145. 5000 rem *** setup for math ***
  146. 5001 ifru=1then5030
  147. 5005 tx$="                                    ":v=10:h=0:gosub3200
  148. 5010 ifru=1then5037
  149. 5015 tx$="                                    ":v=10:h=0:gosub3200
  150. 5020 h=0:v=7:tx$="[215]hat's your first name? ":gosub3200
  151. 5022 mx%=20:i$="":gosub60000:nf$=i$:ifnf$=""then5020
  152. 5025 h=0:v=9:tx$="[215]hat's your last name? ":gosub3200:i$="":gosub60000:nl$=i$
  153. 5030 v=12:h=0:tx$="[215]ould you like to:                     ":gosub3200
  154. 5040 h=7:v=14:fori=1to3
  155. 5050 :tx$=str$(i)+". "+op$(i):gosub3200
  156. 5080 v=v+1:nexti
  157. 5090 v=18:h=0:tx$="[217]our choice? (1-3) "
  158. 5100 gosub3200
  159. 5110 lo=1:hi=3:gosub2100:printa$
  160. 5120 op=a:hi=20
  161. 5130 ifop=1thenhi=5
  162. 5150 v=21:h=0:tx$="[200]ow many problems do you want"
  163. 5160 gosub3200
  164. 5170 v=22:tx$="to do? (1 -"+str$(hi)+")   [157][157]"
  165. 5180 gosub3200
  166. 5190 mx%=2:no%=1:i$="":gosub60000:np=val(i$)
  167. 5200 ifnp<loornp>hithen np=0 :goto5170
  168. 5390 return
  169. 10000 rem *** do spritey things ***
  170. 10001 for i=704 to 767
  171. 10002 readx:pokei,x
  172. 10003 next
  173. 10004 poke2040,11
  174. 10005 poke53269,peek(53269)or1
  175. 10006 poke53287,2:poke53277,255:poke53271,255
  176. 10007 poke53248,30:poke53249,58
  177. 10008 return
  178. 10009 data252,252,252,121,249,248,51,243,240
  179. 10010 data7,231,224,15,207,192,7,159,128
  180. 10011 data3,63,0,0,126,0,0,252,0
  181. 10012 data0,120,0,0,48,0,0,0,0
  182. 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,0,0
  183. 20000 rem *** info info info ***
  184. 20001 gosub3700:v=6
  185. 20002 readn
  186. 20003 fori=1ton
  187. 20004 :readtx$
  188. 20005 :iftx$="page"thengosub 3100:gosub 3700:v=6 :goto20009
  189. 20006 :h=2:ifmid$(tx$,10,1)="[163]"thenv=v+1:gosub3200:goto20008
  190. 20007 :v=v+2:gosub3200
  191. 20008 :delay=.5:gosub2000
  192. 20009 nexti:n=0:return
  193. 20011 data35
  194. 20012 data"[211]ee how fractions can be reduced"
  195. 20013 data"to the lowest terms with this"
  196. 20014 data"program."
  197. 20015 data"[212]here are three ways to use the"
  198. 20016 data"program:","    1) [211]ee examples done"
  199. 20017 data"    2) [196]o problems with help"
  200. 20018 data"    3) [196]o problems yourself"
  201. 20019 data"page"
  202. 20020 data"      1) [211]ee examples done"
  203. 20021 data"         [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  204. 20022 data"[201]f you want to see examples done,"
  205. 20023 data"[201] will show you how to do them,"
  206. 20024 data"explaining each step as [201] go."
  207. 20025 data"page"
  208. 20026 data"   2) [196]o problems with help"
  209. 20027 data"      [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  210. 20028 data"[212]o do problems with help, [201] will"
  211. 20029 data"give you a hint for each step,"
  212. 20030 data"and help you if you make mistakes."
  213. 20031 data"page"
  214. 20032 data"     3) [196]o problems yourself"
  215. 20033 data"        [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  216. 20034 data"[212]he third option is to work problems"
  217. 20035 data"on your own. "
  218. 20036 data""
  219. 20037 data"page"
  220. 20038 data"      [206]umber of [208]roblems"
  221. 20039 data"      [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  222. 20040 data"[204]ast, you decide how many problems"
  223. 20041 data"to do.  [201]f you let the computer do"
  224. 20042 data"the work, you may only have 5"
  225. 20043 data"problems; otherwise you may have"
  226. 20044 data"from 1 to 20 problems."
  227. 20045 data"page"
  228. 30000 rem **** op 1 ****
  229. 30010 cc$=chr$(159):cw$=chr$(5)
  230. 30020 forl=1to2:i(l)=int(rnd(1)*9)+1:nextl:i(3)=int(rnd(1)*3)+2
  231. 30030 ifi(2)<=i(1)thengoto30020
  232. 30031 forl=2toi(1):ifint(i(1)/l)<>i(1)/lthen30033
  233. 30032 ifint(i(2)/l)=i(2)/lthen30020
  234. 30033 nextl
  235. 30040 i(4)=i(1)*i(3):i(5)=i(2)*i(3):sh$=sh$(int(rnd(1)*4)+1)
  236. 30050 forl=1to2:cr$(l)=chr$(co(int(rnd(1)*4)+1)):nextl:ifcr$(1)=cr$(2)then30050
  237. 30060 i3$=str$(i(3)):i1$=str$(i(1)):i2$=str$(i(2))
  238. 30061 sp$=i3$:gosub2500:i3$=sp$:sp$=i1$:gosub2500:i1$=sp$
  239. 30062 sp$=i2$:gosub2500:i2$=sp$
  240. 30070 printchr$(142):gosub32000
  241. 30080 onopgoto30100,30500,30800
  242. 30100 vp=9:hp=30:ifi(4)<10thenhp=hp+2
  243. 30110 cl$=cr$(1):pn=i(4):gosub32100
  244. 30120 tx$="[162][162][162][162][162][162][162][162]":v=13:h=30:gosub3200
  245. 30130 vp=15:hp=30:ifi(5)<10thenhp=hp+2
  246. 30140 cl$=cr$(2):pn=i(5):gosub32100
  247. 30180 tx$="divide both by the same number.":v=6:h=1:gosub3200:delay=2:gosub2000
  248. 30190 tx$="they can both be divided by "+i3$+".":v=21:h=1:gosub3200
  249. 30200 delay=2:gosub2000
  250. 30210 h1=5:h2=h1+i(3)-1:hs=1:v1=9:v2=v1+i(1)-1:vs=1
  251. 30220 tx$=cr$(1)+sh$+cw$:gosub32300
  252. 30250 h1=11:h2=11:hs=1:v1=9:v2=v1+i(2)-1:vs=1
  253. 30260 v=9:h=10:forl=1toi(2):tx$=str$(l):gosub3200:v=v+1:nextl
  254. 30280 h1=14:h2=h1+i(3)-1:hs=1:v1=9:v2=v1+i(2)-1:vs=1
  255. 30290 tx$=cr$(2)+sh$+cw$:gosub32300:delay=2:gosub2000
  256. 30310 forv=8to11:tx$="         ":h=29:gosub3200:nextv
  257. 30320 forv=14to18:tx$="         ":h=29:gosub3200:nextv
  258. 30350 vp=9:hp=30:ifi(1)<10thenhp=hp+2
  259. 30360 cl$=cr$(1):pn=i(1):gosub32100
  260. 30370 tx$="[162][162][162][162][162][162][162][162]":v=13:h=30:gosub3200
  261. 30380 vp=15:hp=30:ifi(2)<10thenhp=hp+2
  262. 30390 cl$=cr$(2):pn=i(2):gosub32100
  263. 30400 return
  264. 30500 rem **** op 2 ****
  265. 30510 tx$="reduce the fraction:":v=6:h=1:gosub3200:delay=1:gosub2000
  266. 30520 vp=9:hp=30:ifi(4)<10thenhp=hp+2
  267. 30530 cl$=cr$(1):pn=i(4):gosub32100
  268. 30540 tx$="[162][162][162][162][162][162][162][162]":v=13:h=30:gosub3200
  269. 30550 vp=15:hp=30:ifi(5)<10thenhp=hp+2
  270. 30560 cl$=cr$(2):pn=i(5):gosub32100
  271. 30561 h1=5:h2=h1+i(3)-1:hs=1:v1=9:v2=v1+i(1)-1:vs=1
  272. 30562 tx$=cr$(1)+sh$+cw$:gosub32300
  273. 30563 h1=14:h2=h1+i(3)-1:hs=1:v1=9:v2=v1+i(2)-1:vs=1
  274. 30564 tx$=cr$(2)+sh$+cw$:gosub32300:delay=1:gosub2000
  275. 30570 tx$="divide both by the same number.":v=6:h=1:gosub3200:delay=.5:gosub2000
  276. 30580 tx$="what number can you divide by? ":v=20:h=1:gosub3200
  277. 30585 mx%=20:no%=1:i$="":gosub60000:aa$=i$
  278. 30590 ifaa$=i3$thengosub300:gosub3900:goto30610
  279. 30600 tx$="both numbers can be divided by "+i3$+".":v=20:h=1:gosub3200
  280. 30610 delay=2:gosub2000:v=20:gosub3900
  281. 30620 tx$="the numerator is ? ":v=20:h=1:gosub3200
  282. 30625 mx%=20:no%=1:i$="":gosub60000:aa$=i$
  283. 30630 ifaa$=i1$thengosub300:v=24:gosub3900:goto30650
  284. 30640 v=20:gosub3900:tx$="the numerator is "+i1$+".":v=20:h=1:gosub3200
  285. 30650 forv=8to11:tx$="         ":h=29:gosub3200:nextv
  286. 30670 vp=9:hp=30:ifi(1)<10thenhp=hp+2
  287. 30680 cl$=cw$:pn=i(1):gosub32100
  288. 30700 delay=2:gosub2000:v=20:gosub3900
  289. 30710 tx$="the denominator is ? ":v=20:h=1:gosub3200
  290. 30715 mx%=20:no%=1:i$="":gosub60000:aa$=i$
  291. 30720 ifaa$=i2$thengosub300:v=24:gosub3900:goto30740
  292. 30730 v=20:gosub3900:tx$="the denominator is "+i2$+".":v=20:h=1:gosub3200
  293. 30740 forv=14to18:tx$="         ":h=29:gosub3200:nextv
  294. 30750 vp=15:hp=30:ifi(2)<10thenhp=hp+2
  295. 30760 cl$=cw$:pn=i(2):gosub32100
  296. 30790 return
  297. 30800 rem **** op 3 ****
  298. 30810 tx$="reduce the fraction:":v=6:h=1:gosub3200
  299. 30820 vp=9:hp=30:ifi(4)<10thenhp=hp+2
  300. 30830 cl$=cr$(1):pn=i(4):gosub32100
  301. 30840 tx$="[162][162][162][162][162][162][162][162]":v=13:h=30:gosub3200
  302. 30850 vp=15:hp=30:ifi(5)<10thenhp=hp+2
  303. 30860 cl$=cr$(2):pn=i(5):gosub32100
  304. 30870 tx$="the numerator is ? ":v=20:h=1:gosub3200
  305. 30875 mx%=20:no%=1:i$="":gosub60000:aa$=i$
  306. 30880 tx$="the denominator is ? ":v=22:h=1:gosub3200
  307. 30885 no%=1:i$="":gosub60000:ab$=i$
  308. 30890 ifaa$=i1$andab$=i2$thengosub300:v=24:gosub3900:goto30930
  309. 30900 forv=20to23:gosub3900:nextv
  310. 30910 v=20:gosub3900:mi=mi+1:tx$="let me show you this one.":v=20:h=0:gosub3200
  311. 30920 delay=1:gosub2000:v=20:gosub3900:goto30180
  312. 30930 forv=8to11:tx$="         ":h=29:gosub3200:nextv
  313. 30940 vp=9:hp=30:ifi(1)<10thenhp=hp+2
  314. 30950 cl$=cw$:pn=i(1):gosub32100
  315. 30960 forv=14to18:tx$="         ":h=29:gosub3200:nextv
  316. 30970 vp=15:hp=30:ifi(2)<10thenhp=hp+2
  317. 30980 cl$=cw$:pn=i(2):gosub32100
  318. 31000 return
  319. 32000 rem ***** draw box *****
  320. 32010 tx$=cc$+"[182][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][181]":v=8:h=3:gosub3200
  321. 32020 forl=1to9:tx$="[182]               [181]":v=v+1:gosub3200:nextl
  322. 32030 tx$="[182][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][181]"+cw$:v=v+1:gosub3200:return
  323. 32100 rem **** draw large number ****
  324. 32110 ifpn<=9thengoto32160
  325. 32120 pn$=str$(pn):sp$=pn$:gosub2500:pn$=sp$:pn=val(left$(pn$,1))
  326. 32130 v=vp:h=hp:forl=1to3:tx$=cl$+nu$(pn,l)+cw$:gosub3200:v=v+1:nextl
  327. 32140 h=h+4:v=vp:pn=val(right$(pn$,1)):forl=1to3:tx$=cl$+nu$(pn,l)+cw$
  328. 32150 gosub3200:v=v+1:nextl:return
  329. 32160 v=vp:h=hp:for l=1to3:tx$=cl$+nu$(pn,l)+cw$:gosub3200:v=v+1:nextl
  330. 32200 return
  331. 32300 rem **** print matrix ****
  332. 32310 forh=h1toh2stephs:forv=v1tov2stepvs
  333. 32320 gosub3200:nextv:nexth
  334. 32400 return
  335. 60000 :
  336. 60010 : rem input routine
  337. 60020 :
  338. 60030 l%=len(i$) : c%=0
  339. 60040 print i$; c1$; : poke 198,0
  340. 60050 :
  341. 60060 get g$
  342. 60070 if g$="" then c%=c%+1 : if c%>20 then print c1$; : c%=0 : goto 60060
  343. 60080 if g$="" then if c%>10 then print c2$; : goto 60060
  344. 60090 if g$="" then 60060
  345. 60100 :
  346. 60110 : rem return key
  347. 60120 :
  348. 60125 if g$<>chr$(13) then 60150
  349. 60130 if no%=1 then no%=0
  350. 60140 print " " : return
  351. 60150 :
  352. 60160 : rem del key
  353. 60170 :
  354. 60180 if g$<>chr$(20) then 60230
  355. 60190 if l%=0 then 60060
  356. 60200 print"[157]  [157][157]";c1$;
  357. 60210 l% = l%-1 : i$=left$(i$,l%)
  358. 60220 goto 60060
  359. 60230 :
  360. 60240 : rem add a key
  361. 60250 :
  362. 60260 if l%>=mx% then 60060
  363. 60262 if no%=0 then 60270
  364. 60263 if (g$<"0" or g$>"9") and g$<>"." and g$<>"-" then 60060
  365. 60264 goto 60290
  366. 60270 if (g$<" " or g$>"[218]") then 60060
  367. 60280 if (g$>"_" and g$<"[193]") then 60060
  368. 60290 i$=i$+g$ : l%=l%+1
  369. 60300 print g$; c1$; : c%=0
  370. 60310 goto 60060
  371. 60320 :
  372.