Well, this would be my first attempt at a full graphical GUI frontend for all my math apps. Takes forever, seeing as the on-calc editor on the CSE is slower then molasses running uphill in the winter. Its absurd.

So development takes a while. Of course, if anyone wants to help me polish this out, make it faster, look better, add things to it, whatever it may be, by all means, let me know! Very Happy


Code:

:DCS
"30B03000B03B030033B33BB33B33B3303B303B30303B030330303030303B030330303BB33B0303030000000000000000819CB4B5040EEDDC819C0B4140000000819C0555550EEDDC819C00414B000000819C0405B4BEEDDC819CB000000B0000819CCCCCCCCCCCCC819999999999999981111111111111118888888888888888"
StoreGDB GDB0
0->K
0->Xmin
264->Xmax
~164->Ymin
0->Ymax
AxesOff
Normal
Degree
Real
Full
[AUTO]

Lbl 1
ClrDraw
TextColor(Black
Text(0,3,"Math Master"
Text(0,210,"v2.0 CSE"
Horizontal ~14,Blue
Horizontal 0,Blue
Horizontal ~163,Blue
Vertical 0,Blue
Vertical 263,Blue
TextColor(Green

":1:   Real numbers:2:   Graphing functions:3:   Monomials:4:   Binomials:5:   Trinomials:6:   Polynomials:7:   Factoring:8:   Word problems:[CLEAR]: Quit:"->Str0
{1,19,43,58,73,89,106,121,140,154}->L1
For(theta,1,dim(L1)-1,1)
Text((12theta)+3,3,sub(Str0,L1(theta)+1,L1(theta+1)-(L1(theta)+1))
End

Lbl 2
While K=0
getKey->K
End

If K=73
Goto AA

If K=93
Goto AB

If K=94
Goto AC

If K=45
Goto thetatheta

0->K
Goto 2

Lbl thetatheta
ClrDraw
ClrHome
RecallGDB GDB0
Return


Lbl AA
0->K

Lbl A1
ClrHome
Menu("Word problems","Airplane",A2,"Coins",A3,"Percentages",A4,"Return",A5

Lbl A2
ClrHome
Input "Distance: ",A
Input "Headwind time: ",B
Input "Tailwind time: ",C
(((fPart(B)*100)/60)/100)+iPart(B)->B
(((fPart(C)*100)/60)/100)+iPart(C)->C
(A(B-C))/(2BC)->D
(A/B)+D->E
ClrHome
Disp "Wind speed:",D
Disp "Plane speed:",E
Pause
Goto A5

Lbl A3
ClrHome
Input "Coin 1 value: ",A
Input "Coin 2 value: ",B
Input "Total coins: ",F
Input "Total dollars: ",E
(E-(B*F))/(A-B)->C
ClrHome
Disp "Coin 1 count:",C
Disp "Total coin 1 value:",A*C
Disp "Coin 2 count:",F-C
Disp "Total coin 2 value:",B*(F-C)
Pause
Goto A5

Lbl A4
ClrHome
Input "Percent 1: ",A
Input "Percent 2: ",B
Input "Target percent:",C
Input "Total count: ",D
((A-C)*D)/(A-B)->X
ClrHome
Disp "Percent 1 count:",D-X
Disp "Percent 2 count:",X
Disp "Total count:",D
Pause
Goto A5

Lbl A5
DelVar A
DelVar B
DelVar C
DelVar D
DelVar E
DelVar F
DelVar X
Goto 1

Lbl A6
ClrHome
Return

Pause
Goto 1

Lbl AB
0->K
ClrDraw
Text(1,1,"Subroutine 2"
Pause
Goto 1
I know that you are not advised to use labels because they make the program run very slowly, but it seems difficult to get around sometimes. If you are not finished with it yet, you should add all of your labels so you won't get an error if you press the wrong number.
This isn't very big, but:

Code:

While K=0
getKey->K
End

//can be

Repeat Ans
getKey
End
Ans->K

If you're only going to be using the getKey value once without interrupting the Ans value, you don't have to do Ans->K. But, you will probably want to if you're going to use it more than once.

Not storing getKey to a variable, and just storing it afterwards increases the loop by a bit, which should help out the speed. However, you'll still need some more things to be improved to speed your program up.
BlackOnyx wrote:
Well, this would be my first attempt at a full graphical GUI frontend for all my math apps. Takes forever, seeing as the on-calc editor on the CSE is slower then molasses running uphill in the winter. Its absurd.

So development takes a while. Of course, if anyone wants to help me polish this out, make it faster, look better, add things to it, whatever it may be, by all means, let me know! Very Happy


Code:

:DCS
"30B03000B03B030033B33BB33B33B3303B303B30303B030330303030303B030330303BB33B0303030000000000000000819CB4B5040EEDDC819C0B4140000000819C0555550EEDDC819C00414B000000819C0405B4BEEDDC819CB000000B0000819CCCCCCCCCCCCC819999999999999981111111111111118888888888888888"
StoreGDB GDB0
0->K
0->Xmin
264->Xmax
~164->Ymin
0->Ymax
AxesOff
Normal
Degree
Real
Full
[AUTO]

Lbl 1
ClrDraw
TextColor(Black
Text(0,3,"Math Master"
Text(0,210,"v2.0 CSE"
Horizontal ~14,Blue
Horizontal 0,Blue
Horizontal ~163,Blue
Vertical 0,Blue
Vertical 263,Blue
TextColor(Green

":1:   Real numbers:2:   Graphing functions:3:   Monomials:4:   Binomials:5:   Trinomials:6:   Polynomials:7:   Factoring:8:   Word problems:[CLEAR]: Quit:"->Str0
{1,19,43,58,73,89,106,121,140,154}->L1
For(theta,1,dim(L1)-1,1)
Text((12theta)+3,3,sub(Str0,L1(theta)+1,L1(theta+1)-(L1(theta)+1))
End

Lbl 2
While K=0
getKey->K
End

If K=73
Goto AA

If K=93
Goto AB

If K=94
Goto AC

If K=45
Goto thetatheta

0->K
Goto 2

Lbl thetatheta
ClrDraw
ClrHome
RecallGDB GDB0
Return


Lbl AA
0->K

Lbl A1
ClrHome
Menu("Word problems","Airplane",A2,"Coins",A3,"Percentages",A4,"Return",A5

Lbl A2
ClrHome
Input "Distance: ",A
Input "Headwind time: ",B
Input "Tailwind time: ",C
(((fPart(B)*100)/60)/100)+iPart(B)->B
(((fPart(C)*100)/60)/100)+iPart(C)->C
(A(B-C))/(2BC)->D
(A/B)+D->E
ClrHome
Disp "Wind speed:",D
Disp "Plane speed:",E
Pause
Goto A5

Lbl A3
ClrHome
Input "Coin 1 value: ",A
Input "Coin 2 value: ",B
Input "Total coins: ",F
Input "Total dollars: ",E
(E-(B*F))/(A-B)->C
ClrHome
Disp "Coin 1 count:",C
Disp "Total coin 1 value:",A*C
Disp "Coin 2 count:",F-C
Disp "Total coin 2 value:",B*(F-C)
Pause
Goto A5

Lbl A4
ClrHome
Input "Percent 1: ",A
Input "Percent 2: ",B
Input "Target percent:",C
Input "Total count: ",D
((A-C)*D)/(A-B)->X
ClrHome
Disp "Percent 1 count:",D-X
Disp "Percent 2 count:",X
Disp "Total count:",D
Pause
Goto A5

Lbl A5
DelVar A
DelVar B
DelVar C
DelVar D
DelVar E
DelVar F
DelVar X
Goto 1

Lbl A6
ClrHome
Return

Pause
Goto 1

Lbl AB
0->K
ClrDraw
Text(1,1,"Subroutine 2"
Pause
Goto 1

A few things, it doesnt really matter, but its just habits that I think it's nice to get used to, you can use the DelVar token instead of 0->K, and towards the end, I saw you used it, but the cool thing about the DelVar token is that you don't need to put a new line in between each, it looks kind of ugly when you don't but it saves a byte every time Wink aslo, you don't need to put the closing thingys at the end of a Text statement Razz (E-(B*F))/(A-B)->C As for this, you never need to put the closing parenthesis right before the ->, and you don't need to put the * sign Just some slight changes that save a byte or two and make the program like 1 nanosecond faster lol Oh and if you put an If, you need to put an End, this is because basically it keeps that stuff buffered in there until you tell it that the statement is over, which will over time, make your program slower and slower

Code:
:DCS
"30B03000B03B030033B33BB33B33B3303B303B30303B030330303030303B030330303BB33B0303030000000000000000819CB4B5040EEDDC819C0B4140000000819C0555550EEDDC819C00414B000000819C0405B4BEEDDC819CB000000B0000819CCCCCCCCCCCCC819999999999999981111111111111118888888888888888"
StoreGDB GDB0
DelVar KDelVar YmaxDelVar Xmin
264->Xmax
~164->Ymin
AxesOff
Normal
Degree
Real
Full
[AUTO]
Lbl 1
ClrDraw
TextColor(Black
Text(0,3,"Math Master
Text(0,210,"v2.0 CSE
Horizontal ~14,Blue
Horizontal 0,Blue
Horizontal ~163,Blue
Vertical 0,Blue
Vertical 263,Blue
TextColor(Green
":1:   Real numbers:2:   Graphing functions:3:   Monomials:4:   Binomials:5:   Trinomials:6:   Polynomials:7:   Factoring:8:   Word problems:[CLEAR]: Quit:"->Str0
{1,19,43,58,73,89,106,121,140,154->L1
For(theta,1,dim(L1)-1,1
Text((12theta)+3,3,sub(Str0,L1(theta)+1,L1(theta+1)-(L1(theta)+1))
End
Lbl 2
While K=0
getKey->K
End
If K=73
Goto AA
End
If K=93
Goto AB
End
If K=94
Goto AC
End
If K=45
Goto thetatheta
End
DelVar K
Goto 2
Lbl thetatheta
ClrDraw
ClrHome
RecallGDB GDB0
Return
Lbl AA
DelVar K
Lbl A1
ClrHome
Menu("Word problems","Airplane",A2,"Coins",A3,"Percentages",A4,"Return",A5
Lbl A2
ClrHome
Input "Distance: ",A
Input "Headwind time: ",B
Input "Tailwind time: ",C
100fPart(B)/6000+iPart(B->B
100fPart(C)/6000+iPart(C->C
(A(B-C))/(2BC->D
A/B+D->E
ClrHome
Disp "Wind speed:",D
Disp "Plane speed:",E
Pause
Goto A5
Lbl A3
ClrHome
Input "Coin 1 value: ",A
Input "Coin 2 value: ",B
Input "Total coins: ",F
Input "Total dollars: ",E
(E-(BF))/(A-B->C
ClrHome
Disp "Coin 1 count:",C
Disp "Total coin 1 value:",AC
Disp "Coin 2 count:",F-C
Disp "Total coin 2 value:",B(F-C
Pause
Goto A5
Lbl A4
ClrHome
Input "Percent 1: ",A
Input "Percent 2: ",B
Input "Target percent:",C
Input "Total count: ",D
(D(A-C))/(A-B->X
ClrHome
Disp "Percent 1 count:",D-X
Disp "Percent 2 count:",X
Disp "Total count:",D
Pause
Lbl A5
DelVar ADelVar BDelVar CDelVar DDelVar EDelVar FDelVar X
Goto 1
Lbl A6
ClrHome
Return
Pause
Goto 1
Lbl AB
DelVar K
ClrDraw
Text(1,1,"Subroutine 2
Pause
Goto 1

Here, I've applied these slight modifications
While K=0 is not equivalent to While K; the former says "While K is false", but the latter says "While K is true", so it'll keep looping if the user presses a button and continue when all buttons are released. An accurate translation would be While not(K. Still, all of those have q chance of being skipped over because if the way While works, so you'd be best off using a Repeat loop like Michael did, which also saves a byte.

And please go read up on how If statements work, because that made absolutely no sense.
readroof2 wrote:
I know that you are not advised to use labels because they make the program run very slowly, but it seems difficult to get around sometimes. If you are not finished with it yet, you should add all of your labels so you won't get an error if you press the wrong number.
Please stop necro-bumping old topics. If you see that a topic is more than a few months old, please only post in it if the original author bumps it for some reason, or the original poster has asked a question that is specifically relevant to one of your current projects.
M. I. Wright wrote:
While K=0 is not equivalent to While K; the former says "While K is false", but the latter says "While K is true", so it'll keep looping if the user presses a button and continue when all buttons are released. An accurate translation would be While not(K. Still, all of those have q chance of being skipped over because if the way While works, so you'd be best off using a Repeat loop like Michael did, which also saves a byte.

And please go read up on how If statements work, because that made absolutely no sense.

Haven't tested the While K thing, I'll change it, as for the If statement, Wether it makes sense or not, idc xD As long as what I said was good advice, it doesnt matter Wink
It... wasn't good advice, though.

In any case, I doubt BlackOnyx is still working on this, so I'll refrain from bumping the topic more.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement