# Maths 2.0
# Copyright 1998,Trevor Livett
# All rights reserved
# E-mail: http://www.TJLivett@aol.com

op "ds","  L  O  A  D  I  N  G ",2020,60
op "ds","P l e a s e   W a i t",1037,85

new
1 hold=1:sl=0:sk=0:L=0:f=0
2 op "ds","By T J Livett  v2.0",9077,01
3 op "ds","M E N T A L   M A T H S",2015,30
4 op "it", "
5 op "ds"," 10=Easy  11=Med  12=Hard",9020,60
6  op "it", "Or Input Level 1-9"
7 if L>1 then op "it", "Press OK for next level"
8 if sl<10 then sl=0
9 if hold=1 then input " Please Input Your Choice",sl

10 if sl=12 then sk=30 : op "ds","  HARD ",1099,60
12 if sl=11  then sk=15 : op "ds","  M E D  ",1062,60
14 if sl=10 then sk=1 : op "ds","E A S Y ",1023,60
15 if sl<10 then sk=15 : op "ds","  M E D  ",1060,60

20 a=rnd(5)+sk
21 b=rnd(10)+sk
22 c=rnd(20)+sk
23 d=rnd(30)+sk
24 e=rnd(50)+sk


27 if sl=1 then L=1
28 if sl=2 then L=11
29 if sl=3 then L=21
30 if sl=4 then L=31
31 if sl=5 then L=41
32 if sl=6 then L=51
33 if sl=7 then L=61
34 if sl=8 then L=71
35 if sl=9 then L=81

45 if L>99 then goto 224
46 if L>89 then goto 200
47 if L>79 then goto 194
48 if L>69 then goto 168
49 if L>59 then goto 156
50 if L>49 then goto 144
51 if L>39 then goto 132
52 if L>29 then goto 118
53 if L>19 then goto 104
54 if L>9 then goto 90

57 op "it", " First Level"
58 ?  e,"+ ",d, "= ",: x=e+d: input r
59 if r=x then goto 87
60 p=61:goto 250
61 ?  e,"+ ",d, "= ",x
63 if f>2 then goto 65
64 goto 20
65 o=fn(42)
66 grline 15,25,125,60,4
67 op "ds"," S O R R Y  ",2045,30
68 op "ds"," You Have Used",2030,45
69 op "ds"," Your Three Life's Up",2019,60
70 op "ds","Exec      ",1030,95
72 op "ds","Done ",1030,110
74 op "ds","To Continue          ",9065,95
76 op "ds","To Quit     ",9065,110
78 hold=0

80 T=fn 34
82 L=fn 34 : if (T=L) then goto 82

85 o=fn(42)
86 run
87 L=L+1:  ?  "            Well  Done", 
88 ?  L,"Right":hold=0: goto 2
90 if L=10 then  ?  "          First Level Completed "

92 op "it", "Second Level"
94 x=c+e
96 ?c,"+","?","=",x,:x=c+e:input r
98 if r=e then goto 87
100 p=102:goto 250
102 ?  c,"+ ",e,"= ",x:goto 63
104 if  L=20 then  ?  "         Second Level Complete"

106 op "it", "Third Level"
108 x=e-d
110 ?e,"-","?","=",x,:input r
112 if r=d then goto 87
114 p=116:goto 250
116 ?  e,"- ",d,"= ",x:goto 63
118 if  L=30 then  ?  "          Third Level Complete"

120 op "it", "Forth Level"
122 ?  c,"+ ",d, "- ",b,"= ",: x=c+d-b : input r
124 if r=x then goto 87
126 p=128:goto 250
128 ?  c,"+ ",d, "- ",b,"= ",x: goto 63
132 if  L=40 then  ?  "          Forth Level Complete"

134 op "it", "Fifth Level"
136 ?  e,"- ",c, "+ ",d,"= ",: x=e-c+d : input r
138 if r=x then goto 87
140 p=142:goto 250
142 ?  e,"- ",c, "+ ",d,"= ",x: goto 63
144 if  L=50 then  ?  "           Fifth Level Complete"

146 op "it", "Sixth Level"
148 ?  a,"X ",b, "+ ",c,"-",d,"= ",: x=a*b+c-d: input r
150 if r=x then goto 87
152 p=154:goto 250
154 ?  a,"X ",b, "+ ",c,"-",d,"= ",x: goto 63
156 if  L=60 then  ?  "         Sixth Level Complete"

158 op "it", "Seventh Level"
160 ?  b,"X ",c, "- ",e,"+",d,"= ",: x=b*c-e+d: input r
162 if r=x then goto 87
164 p=166:goto 250
166 ?  b,"X ",c, "- ",e,"+",d,"= ",x: goto 63
168 if  L=70 then  ?  "        Seventh  Level Complete"

170 op "ds","Eighth Level    ",1089,0
172 u=0
174 t=int(e/a)
176 s=e/a
178 h=t+.5
180 if s>h then u=1
182 ?  e,"/ ",a,"=",:x=t+u
184 input r
186 if r=x then goto 87
188 p=190:goto 250
190 ?  e,"/ ",a,"=",x: goto 63
194 if L=80 then  ?"        You Are A Maths Genius"

200 o=fn(42)
201 op "ds"," M E M O R Y  M A T H S ",2010,40

203 z$="+"
204 y$="-"
205 op "ds", str$(c),30,90
206 op "ds", (z$),50,90
208 op "ds", str$(e),70,90
209 op "ds", (y$),90,90
210 op "ds", str$(b),110,90

212 x=c+e-b
214 for n=1 to 10500:next n
215 op "it", "Ninth Level"
216  input r
218 if r=c+e-b then goto 87
220 p=222:goto 250
222 ?  c,"+ ",e,"-",b,"= ",x:goto 63
224 if  L=100 then  ?  "Congratulations Maths  Expert"
226 o=fn(42)
227 grline 15,25,125,60,4
228 op "ds"," You Win",2050,50
229 goto 70
250 op "it", "Sorry It Was":f=f+1
260 goto p
run
 
