Given some text on the graphscreen of a TI-84+CSE, how can you simulate individual pixels/points starting from left to right of the text to fall down and hit the bottom of the screen?

Here is the code:

Code:
ClrDraw
~82->Ymin
82->Ymax
~132->Xmin
132->Xmax
Horizontal ~81,Black
Horizontal 82,Black
Vertical ~132,Black
Vertical 131,Black
For(A,1,20
Text(74,58,sub("THANKS FOR WATCHING!",1,A
For(B,1,100:End
End


In other words, how can I get the text to dissolve by breaking apart form left to right? First the T, then the H, and so on.

Thanks in advance. Smile
Here's some pseudocode for you to start thinking about the general concept:


Code:
For(Character,1,19 //or whatever length
For(Row,5,1,-1
    Read_Y = 74 + Row // Write_Y is implicitly Read_Y+1
    While Read_Y < 164
        For(Col,58+8*Character,58+8*Character+6
            If Pxl-Text(Read_Y,Col) and Read_Y < 163
                Pxl-On(Read_Y+1,Col)
            Pxl-Off(Read_Y,Col)
        EndFor
        Read_Y+=1
    EndWhile
EndFor
Other people: Please correct me if I made a glaring mistake.
Alright. I figured this would involve some pxl-Test. I understand what most of the pseudocode means except for the Read_Y and Write_Y.

And is there a missing EndFor? Wink

Here is what I have so far:

Code:
ClrDraw:AxesOff
~82->Ymin:82->Ymax
~132->Xmin:132->Xmax
Horizontal Ymin+1,Black:Horizontal Ymax,Black
Vertical Xmin,Black:Vertical Xmax-1,Black
For(A,1,20
Text(74,58,sub("THANKS FOR WATCHING!",1,A
End

For(F,0,19
For(R,10,1,~1
76+R->A
While A<163
For(C,58+8F,58+8F+6
If pxl-Test(A,C) and A<162
Pxl-On(A+1,C
Pxl-Off(A,C
End
A+1->A
End:End:End


This entire program takes 12.5 minutes to just finish the "THANKS" and 39 minutes to finish the entire string.
Some letters and the spaces being different widths throws the spacing off and skips a few lines.
Would there be a faster way to do this program or should I rethink the animation?
Yes, there was a final EndFor missing indeed; I missed it because I forgot to indent the second-most-outer For( loop. I tested the code you pasted there in SourceCoder 3, and it did indeed run painfully slowly. Even changing the Pxl-On to use A+8 and the second-to-last line to A+8->A didn't really help, so no, I think you're going to either need to use hybrid BASIC to help you here or consider an alternative dissolve method. What about erasing it one line at a time using Line() commands?
Based on your suggestion, I think using Hybrid Basic may be the way to go unless this Line() method is speedier.
For this method, would you still use pxl-Test() to get the endpoints of the lines and just use those same x-coordinates the entire way down?
Electromagnet8 wrote:
Based on your suggestion, I think using Hybrid Basic may be the way to go unless this Line() method is speedier.
For this method, would you still use pxl-Test() to get the endpoints of the lines and just use those same x-coordinates the entire way down?
Oh, I was thinking something even simpler than that: Just draw 10 horizontal white lines, thus erasing the text bottom to top, and forget about having it fall down to the bottom.
That was much more simpler than what I intended. Here's the code for just erasing the text with lines from bottom to top.

Code:
ClrDraw:AxesOff
~82->Ymin
82->Ymax
~132->Xmin
132->Xmax
Horizontal Ymin+1,Black
Horizontal Ymax,Black
Vertical Xmin,Black
Vertical Xmax-1,Black
For(A,1,20
Text(74,58,sub("THANKS FOR WATCHING!",1,A
End

For(R,~5,6
Line(~75,R,72,R,White
End


This seems boring though. Is there a way I could learn some Hybrid Basic to do the previous way but faster?
Yup, that's what I was thinking. Does that look nifty enough, or no? If you want to slow it down, you could add some rand computations in that loop (ie, rand or rand(4) or rand(10)).
I have been working on a small program based on a request from one of my classmates. The code is here: http://pastebin.com/sjmARch9

I am sure that there are some optimizations that can be done with this as I made it in one night. Could anyone offer any suggestions/tips?

I believe that the pointer to the class is wrong.
*bump
I've started a new program to complement my math program but in a totally different format. Instead of using the Menu( command, I decided to try the graphscreen text menus.
I know this could use some serious optimization, though.

Code:
Xmin+|E2DeltaX<Xmax->|N
StoreGDB GDB1
ClrDraw:AxesOff:FnOff
PlotsOff :GridOff
0->FV
Text(0,0,"SCIENCE PROGRAM
"PHYSICAL BIOLOGY  CHEMISTRYPHYSICS  ASTRONOMY                           QUIT     ->Str0
9->B
Goto 98
Lbl XX
ClrHome
RecallGDB GDB1
Output(3+|N,1+|N5,"SCIENCE PROGRAM
Output(4+|N,5+|N5,"V 0.0.1
Output(5+|N,3+|N5,"CREATED BY:
Output(6+|N,2+|N5,"ELECTROMAGNET
Stop
Lbl A
.1->FV
Text(0,0,"PHYSICAL SCIENCE
"OPTION 1 OPTION 2 OPTION 3 OPTION 4 OPTION 5 OPTION 6 OPTION 7 BACK     QUIT     ->Str0
9->B
Goto 98
Lbl B
.2->FV
Text(0,0,"BIOLOGY
"OPTION 1 OPTION 2 OPTION 3 OPTION 4 OPTION 5 OPTION 6 OPTION 7 BACK     QUIT     ->Str0
9->B
Goto 98
Lbl C
.3->FV
Text(0,0,"CHEMISTRY
"OPTION 1 OPTION 2 OPTION 3 OPTION 4 OPTION 5 OPTION 6 OPTION 7 BACK     QUIT     ->Str0
9->B
Goto 98
Lbl D
.4->FV
Text(0,0,"PHYSICS
"OPTION 1 OPTION 2 OPTION 3 OPTION 4 OPTION 5 OPTION 6 OPTION 7 BACK     QUIT     ->Str0
9->B
Goto 98
Lbl E
.5->FV
Text(0,0,"ASTRONOMY
"OPTION 1 OPTION 2 OPTION 3 OPTION 4 OPTION 5 OPTION 6 OPTION 7 BACK     QUIT     ->Str0
9->B
Goto 98

Lbl 98
For(theta,1,B
Text(theta6(|N+1),6(|N+1),sub(Str0,1+(theta-1)length(Str0)/B,length(Str0)/B
End
6(|N+1->X
Repeat max(K={21,105
Text(X,0,"[|>]
Repeat Ans
getKey->K
End
Text(X,0,"     "
X+(6(|N+1))((Ans=34 and X<6B(|N+1))-(Ans=25 and X>6(|N+1->X
End
ClrDraw
X(2-2|N)-FV
If max(Ans=108-{0,.1,.2,.3,.4,.5:Goto XX
If Ans=12:Goto A
If Ans=24:Goto B
If Ans=36:Goto C
If Ans=48:Goto D
If Ans=60:Goto E
If Ans=11.9:Disp Ans
If Ans=23.9:Disp Ans
If Ans=35.9:Disp Ans
If Ans=47.9:Disp Ans
If Ans=59.9:Disp Ans
If Ans=71.9:Disp Ans
If Ans=83.9:Disp Ans

If Ans=11.8:Disp Ans
If Ans=23.8:Disp Ans
If Ans=35.8:Disp Ans
If Ans=47.8:Disp Ans
If Ans=59.8:Disp Ans
If Ans=71.8:Disp Ans
If Ans=83.8:Disp Ans

If Ans=11.7:Disp Ans
If Ans=23.7:Disp Ans
If Ans=35.7:Disp Ans
If Ans=47.7:Disp Ans
If Ans=59.7:Disp Ans
If Ans=71.7:Disp Ans
If Ans=83.7:Disp Ans

If Ans=11.6:Disp Ans
If Ans=23.6:Disp Ans
If Ans=35.6:Disp Ans
If Ans=47.6:Disp Ans
If Ans=59.6:Disp Ans
If Ans=71.6:Disp Ans
If Ans=83.6:Disp Ans

If Ans=11.5:Disp Ans
If Ans=23.5:Disp Ans
If Ans=35.5:Disp Ans
If Ans=47.5:Disp Ans
If Ans=59.5:Disp Ans
If Ans=71.5:Disp Ans
If Ans=83.5:Disp Ans


Thanks in advance for any help!
All of the values you have in the If statements that display Ans should be put in a list, and then do If sum(Ans=L1 or whatever.
Alright, thanks. I'll see if this method is still more practical than just Menu( commands.
merthsoft wrote:
All of the values you have in the If statements that display Ans should be put in a list, and then do If sum(Ans=L1 or whatever.
You beat me to it. Smile That Ans section can be extremely compressed; I think there's a formula that can even make it smaller. Something like:
Code:
If not(fPart(Ans/12)) and Ans<=60:Then
// Gotos?
End
If not(fPart((iPart(Ans)-11)/12)) and max(10fPart(Ans)={5,6,7,8,9
Disp Ans
Thanks! Sorry for the confusion but all of the Disp Ans will actually be Goto commands. I just like to know what the values are when I am testing the program. I am sure that this may change the above code above.
Here is the code so far:

Code:
Xmin+|E2DeltaX<Xmax->|N
StoreGDB GDB1
ClrDraw:AxesOff:FnOff
PlotsOff :GridOff
Lbl AA
0->FV
"SCIENCE PROGRAM,PHYSICAL,BIOLOGY,CHEMISTRY,PHYSICS,ASTRONOMY,QUIT->Str0
Goto 98
Lbl XX
ClrHome
RecallGDB GDB1
Output(3+|N,1+|N5,"SCIENCE PROGRAM
Output(4+|N,6+|N5,"V 0.1
Output(5+|N,3+|N5,"CREATED BY:
Output(6+|N,2+|N5,"ELECTROMAGNET
Stop
Lbl A
.1->FV
"PHYSICAL SCIENCE,OPTION 1,OPTION 2,OPTION 3,OPTION 4,OPTION 5,OPTION 6,OPTION 7,BACK,QUIT->Str0
Goto 98
Lbl B
.2->FV
"BIOLOGY,OPTION 1,OPTION 2,OPTION 3,OPTION 4,OPTION 5,OPTION 6,OPTION 7,BACK,QUIT->Str0
Goto 98
Lbl C
.3->FV
"CHEMISTRY,OPTION 1,OPTION 2,OPTION 3,OPTION 4,OPTION 5,OPTION 6,OPTION 7,BACK,QUIT->Str0
Goto 98
Lbl D
.4->FV
"PHYSICS,OPTION 1,OPTION 2,OPTION 3,OPTION 4,OPTION 5,OPTION 6,OPTION 7,BACK,QUIT->Str0
Goto 98
Lbl E
.5->FV
"ASTRONOMY,OPTION 1,OPTION 2,OPTION 3,OPTION 4,OPTION 5,OPTION 6,OPTION 7,BACK,QUIT->Str0
Goto 98

Lbl 98
DelVar |LQ
inString(Str0,",
Text(0,0,sub(Str0,1,Ans-1
For(O,1,10^(9
inString(Str0,",",Ans
If Ans:Then
Ans+1->|LQ(O
Else
2+length(Str0->|LQ(O
10^(9->O
End
End
dim(|LQ)-1->Q
For(theta,1,Ans
Text(theta6(|N+1),6(|N+1),sub(Str0,|LQ(theta),|LQ(theta+1)-1-|LQ(theta
End
6(|N+1->X
Repeat max(K={21,105
Text(X,0,"[|>]
Repeat Ans
getKey->K
End
Text(X,0,"     "
X+(6(|N+1))((Ans=34 and X<6Q(|N+1))-(Ans=25 and X>6(|N+1->X
End
ClrDraw
X(2-|N)/12->X
X-FV
If max(Ans=Q-{0,.1,.2,.3,.4,.5:Goto XX
If max(Ans=Q-1-{.1,.2,.3,.4,.5:Goto AA
If Ans=1:Goto A
If Ans=2:Goto B
If Ans=3:Goto C
If Ans=4:Goto D
If Ans=5:Goto E
If Ans=.9:Disp Ans
If Ans=1.9:Disp Ans
If Ans=2.9:Disp Ans
If Ans=3.9:Disp Ans
If Ans=4.9:Disp Ans
If Ans=5.9:Disp Ans
If Ans=6.9:Disp Ans

If Ans=.8:Disp Ans
If Ans=1.8:Disp Ans
If Ans=2.8:Disp Ans
If Ans=3.8:Disp Ans
If Ans=4.8:Disp Ans
If Ans=5.8:Disp Ans
If Ans=6.8:Disp Ans

If Ans=.7:Disp Ans
If Ans=1.7:Disp Ans
If Ans=2.7:Disp Ans
If Ans=3.7:Disp Ans
If Ans=4.7:Disp Ans
If Ans=5.7:Disp Ans
If Ans=6.7:Disp Ans

If Ans=.6:Disp Ans
If Ans=1.6:Disp Ans
If Ans=2.6:Disp Ans
If Ans=3.6:Disp Ans
If Ans=4.6:Disp Ans
If Ans=5.6:Disp Ans
If Ans=6.6:Disp Ans

If Ans=.5:Disp Ans
If Ans=1.5:Disp Ans
If Ans=2.5:Disp Ans
If Ans=3.5:Disp Ans
If Ans=4.5:Disp Ans
If Ans=5.5:Disp Ans
If Ans=6.5:Disp Ans
Here is the code so far. I am starting to think that I should use the default menu command unless I can improve on the structure of this program. Are there any suggestions?


Code:
Xmin+|E2DeltaX<Xmax->|N
StoreGDB GDB1
ClrDraw:AxesOff:FnOff
PlotsOff :GridOff
Lbl 00
0->FV
"SCIENCE PROGRAM,1-PHYSICAL,2-BIOLOGY,3-CHEMISTRY,4-PHYSICS,5-ASTRONOMY,6-QUIT
Goto theta1
Lbl XX
ClrHome
RecallGDB GDB1
|N
Output(3+Ans,1+Ans5,"SCIENCE PROGRAM
Output(4+Ans,3+Ans5,"a\lpha v.1.2
Output(5+Ans,3+Ans5,"CREATED BY:
Output(6+Ans,2+Ans5,"ELECTROMAGNET
Stop
Lbl 01
.1->FV
"PHYSICAL SCIENCE,1-SCIENTIFIC METHOD,2-EARTH,3-WEATHER,4-ENERGY,5-FORCES,6-MOTION,7-BACK,8-QUIT
Goto theta1

Lbl 11
.11->FV
"SCIENTIFIC METHOD,1-NOTES,2-EXPERIMENT,3-BACK,4-QUIT
Goto theta1
Lbl 1A:"TBD":Goto theta2
Lbl 1B:"TBD":Goto theta2
Lbl 12
.12->FV
"EARTH,1-MODEL,2-CONDUCT/CONVECTION,3-QUAKES/VOLCANOES,4-FAULTS/FOLDS,5-CONTINENTAL DRIFT,6-BACK,7-QUIT
Goto theta1
Lbl 1C:"TBD":Goto theta2
Lbl 1D:"TBD":Goto theta2
Lbl 1E:"TBD":Goto theta2
Lbl 1F:"TBD":Goto theta2
Lbl 1G:"TBD":Goto theta2
Lbl 13
.13->FV
"WEATHER,1-ATMOSPHERE,2-HEATING,3-HUMIDITY,4-CLOUDS,5-PRECIPITATION,6-HIGH/LOW PRESSURE,7-AIR MASSSES/FRONTS,8-BACK,9-QUIT
Goto theta1
Lbl 1H:"TBD":Goto theta2
Lbl 1I:"TBD":Goto theta2
Lbl 1J:"TBD":Goto theta2
Lbl 1K:"TBD":Goto theta2
Lbl 1L:"TBD":Goto theta2
Lbl 1M:"TBD":Goto theta2
Lbl 1N:"TBD":Goto theta2
Lbl 14
.14->FV
"ENERGY,1-TYPES,2-LAW,3-TRANSFORMATIONS,4-GRAVITY (GPE),5-KINETIC,6-ELECTROMAGNETIC,7-BACK,8-QUIT
Goto theta1
Lbl 1O:"TBD":Goto theta2
Lbl 1P:"TBD":Goto theta2
Lbl 1Q:"TBD":Goto theta2
Lbl 1R
Lbl 1S
Lbl 1T:"TBD":Goto theta2
Lbl 15
.15->FV
"FORCES,1-NEWTON,2-WORK/FORCE,3-POWER/EFFICIENCY,4-SIMPLE MACHINES,5-BACK,6-QUIT
Goto theta1
Lbl 1U:"TBD":Goto theta2
Lbl 1V
Lbl 1W
Lbl 1X:"TBD":Goto theta2
Lbl 16
.16->FV
"MOTION,1-NOTES,2-D=RT,3-BACK,4-QUIT
Goto theta1
Lbl 1Y:"TBD":Goto theta2
Lbl 1Z

Lbl 02
.2->FV
"BIOLOGY,1-LIFE CHARACTERISTICS,2- ERAS/TIME PERIODS,3-CELL THEORY,4-GENE THEORY,5-EVOLUTION,6-HOMEOSTASIS,7-THERMODYNAMICS,8-BACK,9-QUIT
Goto theta1

Lbl 21
.21->FV
"LIFE CHARACTERISTICS,BACK,QUIT
Goto theta1
Lbl 22
.22->FV
"ERAS/TIME PERIODS,BACK,QUIT
Goto theta1
Lbl 23
.23->FV
"CELL THEORY,BACK,QUIT
Goto theta1
Lbl 24
.24->FV
"GENE THEORY,BACK,QUIT
Goto theta1
Lbl 25
.25->FV
"EVOLUTION,BACK,QUIT
Goto theta1
Lbl 26
.26->FV
"HOMEOSTASIS,BACK,QUIT
Goto theta1
Lbl 27
.27->FV
"THERMODYNAMICS,BACK,QUIT
Goto theta1

Lbl 03
.3->FV
"CHEMISTRY,1-MATTER,2-ATOMIC,3-STOICHIOMETRY,4-ACID/BASE & pH,5-,6-,7-,8-BACK,9-QUIT
Goto theta1

Lbl 31
.31->FV
"MATTER,1-NOTES,2-STATES,3-SUBSTANCES/MIXTURES,4-BACK,5-QUIT
Goto theta1
Lbl 3A
Lbl 3B
Lbl 3C
Lbl 32
.32->FV
"ATOMIC,1-STRUCTURE,2-IONS/ISOTOPES,3-PERIODIC TABLE,4-BONDING,5-CHEMICAL FORMULAS,6-SOLVE WEIGHT,7-BACK,8-QUIT
Goto theta1
Lbl 3D
Lbl 3E
Lbl 3F
Lbl 3G
Lbl 3H
Lbl 3I
Lbl 33
.33->FV
"STOICHIOMETRY,1-,2-,3-,4-,5-,6-,7-,8-BACK,9-QUIT
Goto theta1
Lbl 3J
Lbl 3K
Lbl 3L
Lbl 3M
Lbl 3N
Lbl 3O
Lbl 3P
Lbl 34
.34->FV
"ACIDS/BASES & pH,1-,2-,3-,4-,5-,6-,7-,8-BACK,9-QUIT
Goto theta1
Lbl 35
.35->FV
"TBD35,BACK,QUIT
Goto theta1
Lbl 36
.36->FV
"TBD36,BACK,QUIT
Goto theta1
Lbl 37
.37->FV
"TBD37,BACK,QUIT
Goto theta1
Lbl 04
.4->FV
"PHYSICS,1-,2-,3-,4-,5-,6-,7-,8-BACK,9-QUIT
Goto theta1

Lbl 41
.41->FV
"TBD41,BACK,QUIT
Goto theta1
Lbl 42
.42->FV
"TBD42,BACK,QUIT
Goto theta1
Lbl 43
.43->FV
"TBD43,BACK,QUIT
Goto theta1
Lbl 44
.44->FV
"TBD44,BACK,QUIT
Goto theta1
Lbl 45
.45->FV
"TBD45,BACK,QUIT
Goto theta1
Lbl 46
.46->FV
"TBD46,BACK,QUIT
Goto theta1
Lbl 47
.47->FV
"TBD47,BACK,QUIT
Goto theta1

Lbl 05
.5->FV
"ASTRONOMY,1-THE CELESTIAL SPHERE,2-COORDINATE SYSTEM,3-UNITS,4-PRECESSION,5-PARALLAX,6-PROPER MOTION,7-,8-BACK,9-QUIT
Goto theta1

Lbl 51
.51->FV
"THE CELESTIAL SPHERE,BACK,QUIT
Goto theta1
Lbl 52
.52->FV
"COORDINATE SYSTEM,BACK,QUIT
Goto theta1
Lbl 53
.53->FV
"UNITS,BACK,QUIT
Goto theta1
Lbl 54
.54->FV
"PRECESSION,BACK,QUIT
Goto theta1
Lbl 55
.55->FV
"PARALLAX,BACK,QUIT
Goto theta1
Lbl 56
.56->FV
"PROPER MOTION,BACK,QUIT
Goto theta1
Lbl 57
.57->FV
"TBD57,BACK,QUIT
Goto theta1

Lbl theta2
Ans->Str1
ClrDraw
DispGraph
DelVar RDelVar CFor(I,1,length(Str1
If C<(91+165|N) and "^^o"!=sub(Str1,I,1
Then
If " "!=sub(Str1,I,1
Text(R,C,sub(Str1,I,1
C+6+3|N->C
If I<length(Str1)-1:Ans-2(" "!=sub(Str1,I,1->C
Else
DelVar C
R+6+6|N->R
End
C+4(C>(89+165|N->C
I-(C>(89+165|N->I
End
Pause
Goto 00

Lbl theta1
Ans->Str0
DelVar |LQClrDraw
inString(Str0,",
Text(0,0,sub(Str0,1,Ans-1
For(O,1,|E9
inString(Str0,",",Ans
If Ans:Then
Ans+1->|LQ(O
Else
2+length(Str0->|LQ(O
|E9->O
End
End
dim(|LQ)-1->Q
For(theta,1,Ans
Text(theta6(|N+1),4(|N+1),sub(Str0,|LQ(theta),|LQ(theta+1)-1-|LQ(theta
End
6|N+6->X
DelVar |LQ{92,93,94,82,83,84,72,73,74->|LQ
Repeat max(K=|LQ) or max(K={21,26,105
Text(X,0,"[|>]
Repeat Ans
getKey->K
End
Text(X,0,"   "
X+(6|N+6)((Ans=34 and X<6Q(|N+1))-(Ans=25 and X>6|N+6->X
max(seq(X(K=|LQ(X)),X,1,dim(|LQ
If Q>=Ans and max(K=|LQ
Ans6(|N+1)->X
End
If X(2-|N)/12=Q:Goto XX
X(2-|N)/12+FV
If max(Ans=Q-1+{.1,.2,.3,.4,.5:Goto 00

If Ans=1:Goto 01                           //physical
If max(Ans=Q-1+{.11,.12,.13,.14,.15,.16:Goto 01
If Ans=1.10:Goto 11                              //scientific method
If Ans=1.11:Goto 1A                                 //notes
If Ans=2.11:Goto 1B                                 //experiment
If Ans=2.10:Goto 12                              //earth
If Ans=1.12:Goto 1C                                 //model
If Ans=2.12:Goto 1D                                 //conduct/convection
If Ans=3.12:Goto 1E                                 //quakes/volcanoes
If Ans=4.12:Goto 1F                                 //faults/folds
If Ans=5.12:Goto 1G                                 //continental drift
If Ans=3.10:Goto 13                              //weather
If Ans=1.13:Goto 1H                                 //atmosphere
If Ans=2.13:Goto 1I                                 //heating
If Ans=3.13:Goto 1J                                 //humidity
If Ans=4.13:Goto 1K                                 //clouds
If Ans=5.13:Goto 1L                                 //precipitation
If Ans=6.13:Goto 1M                                 //high/low pressure
If Ans=7.13:Goto 1N                                 //air masses/fronts
If Ans=4.10:Goto 14                              //energy
If Ans=1.14:Goto 1O                                 //types
If Ans=2.14:Goto 1P                                 //law
If Ans=3.14:Goto 1Q                                 //transformations
If Ans=4.14:Goto 1R                                 //gravity (gpe)
If Ans=5.14:Goto 1S                                 //kinetic
If Ans=6.14:Goto 1T                                 //electromagnetic
If Ans=5.10:Goto 15                              //forces
If Ans=1.15:Goto 1U                                 //newton
If Ans=2.15:Goto 1V                                 //work/force
If Ans=3.15:Goto 1W                                 //power/efficiency
If Ans=4.15:Goto 1X                                 //simple machines
If Ans=6.10:Goto 16                              //motion
If Ans=1.16:Goto 1Y                                 //notes
If Ans=1.84:Goto 1Z                                 //d=rt

If Ans=2:Goto 02                           //biology
If max(Ans=Q-1+{.21,.22,.23,.24,.25,.26,.27:Goto 02
If Ans=1.20:Goto 21                              //life characteristics
If Ans=2.20:Goto 22                              //eras/time periods
If Ans=3.20:Goto 23                              //cell theory
If Ans=4.20:Goto 24                              //gene theory
If Ans=5.20:Goto 25                              //evolution
If Ans=6.20:Goto 26                              //homeostasis
If Ans=7.20:Goto 27                              //thermodynamics

If Ans=3:Goto 03                           //chemistry
If max(Ans=Q-1+{.31,.32,.33,.34,.35,.36,.37:Goto 03
If Ans=1.30:Goto 31                              //matter
If Ans=1.31:Goto 3A                                    //notes
If Ans=2.31:Goto 3B                                    //states
If Ans=3.31:Goto 3C                                    //substances/mixtures
If Ans=2.30:Goto 32                              //atomic
If Ans=1.32:Goto 3D                                    //structure
If Ans=2.32:Goto 3E                                    //ions/isotopes
If Ans=3.32:Goto 3F                                    //periodic table
If Ans=4.32:Goto 3G                                    //bonding
If Ans=5.32:Goto 3H                                    //chemical formulas
If Ans=6.32:Goto 3I                                    //solve weight
If Ans=3.30:Goto 33                              //stoichiometry
If Ans=1.33:Goto 3J                                    //
If Ans=2.33:Goto 3K                                    //
If Ans=3.33:Goto 3L                                    //
If Ans=4.33:Goto 3M                                    //
If Ans=5.33:Goto 3N                                    //
If Ans=6.33:Goto 3O                                    //
If Ans=7.33:Goto 3P                                    //
If Ans=3.40:Goto 34                              //acid/base & pH
If Ans=3.50:Goto 35                              //
If Ans=3.60:Goto 36                              //
If Ans=3.70:Goto 37                              //

If Ans=4:Goto 04                           //physics
If max(Ans=Q-1-{.41,.42,.43,.44,.45,.46,.47:Goto 04
If Ans=1.40:Goto 41                              //
If Ans=2.40:Goto 42                              //
If Ans=3.40:Goto 43                              //
If Ans=4.40:Goto 44                              //
If Ans=5.40:Goto 45                              //
If Ans=6.40:Goto 46                              //
If Ans=7.40:Goto 47                              //

If Ans=5:Goto 05                           //astronomy
If max(Ans=Q-1-{.51,.52,.53,.54,.55,.56,.57:Goto 05
If Ans=1.50:Goto 51                              //the celestial sphere
If Ans=2.50:Goto 52                              //coordinate system
If Ans=3.50:Goto 53                              //units
If Ans=4.50:Goto 54                              //precession
If Ans=5.50:Goto 55                              //parallax
If Ans=6.50:Goto 56                              //proper motion
If Ans=7.50:Goto 57                              //

Goto XX
*bump

Given a predetermined equation, is there a way to solve for any one variable when the known values are in a list?

Example:
Equation: Potential Energy=(mass)(gravity)(height)
List: {150,0,9.8,40} This means that potential energy is 150, mass is unknown, gravity is 9.8, and height is 40.

I plan for this to work with any equation. This includes using almost or all of the operators.

I saw this code in the Code Fragments and Routines that solves the Pythagorean Theorem.

Code:
C²-B²-A²
√(Ans-2Ansnot(C
Your best bet is the solve() command, which will indeed work if you have your known variables in a list and a single unknown that is a real (letter) variable. You cannot have the unknown variable be a list element, unfortunately, so it's nontrivial to make a program that can solve a multi-variable equation where any single one of the variables is unknown.
Alright. I think I'll make the program jump to code that will be tailored to that equation. Here is what I have as of now:

Edit: I changed the code. I got equations to work in it. It can only support multiplication on either side of the equal sign (e.g. Q=MGH, D=RT, F=MA, etc.) The basic equation with an equal sign is stored into Str9. I have tested this on both TI-84+SE and CSE.


Code:
Xmin+|E2DeltaX<Xmax->|N
"Q=MGH->Str9
"P.E.(JOULES),MASS(KG),GRAVITY(M/S/S),HEIGHT(M)
Lbl theta5
Ans->Str0
ClrDraw
Text(0,0,"SELECT KNOWN USING 2ND
Text(6|N+6,0,"PRESS ENTER WHEN DONE
{1->|LQ
inString(Str0,",
Repeat not(Ans
Ans+1->|LQ(1+dim(|LQ
inString(Str0,",",Ans+1
End
2+length(Str0->|LQ(1+dim(|LQ
dim(|LQ)-1->Q
For(theta,1,Ans
Text(theta6(|N+1)+6|N+6,4(|N+1),"_ ",sub(Str0,|LQ(theta),|LQ(theta+1)-1-|LQ(theta
End
12(|N+1->X
0->dim(|LF
{0->|LF
0->K
Repeat dim(|LF)>1 and max(K={24,45,105
Text(X,0,"[|>]
Repeat Ans:getKey->K:End
Text(X,0,"   "
X+(6|N+6)((Ans=34 and X<6(Q+1)(|N+1))-(Ans=25 and X>12(|N+1->X
If K=21:Then
X(2-|N)/12-1->Y
If not(sum(|LF=Y:Then
Y->|LF(1+dim(|LF
Text(X,4(|N+1),"xmark
Else
0->|LF(max(seq(X(Y=|LF(X)),X,1,dim(|LF
Text(X,4(|N+1),"_
End
End
End
SortD(|LF
dim(|LF)-sum(not(|LF->dim(|LF
SortA(|LF
ClrList |LS
Q->dim(|LS
For(theta,1,dim(|LF
Input sub(Str0,|LQ(|LF(theta)),|LQ(|LF(theta)+1)-1-|LQ(|LF(theta)))+":",X
X->|LS(|LF(theta
End
max(seq(X(0=|LS(X)),X,1,dim(|LS

inString(Str9,"=->E
seq(|LS(A),A,Ans,dim(|LS->|LR
E-1->dim(|LS
If not(prod(|LR:Then
SortD(|LR
dim(|LR)-sum(not(|LR->dim(|LR
If not(dim(|LR:{1->|LR
prod(|LS)/prod(|LR
Else
SortD(|LS
dim(|LS)-sum(not(|LS->dim(|LS
If not(dim(|LS:{1->|LS
prod(|LR)/prod(|LS
End
Text((3+Q)(6|N+6),0,"ANSWER IS ",Ans
Pause


Are there any suggestions/optimizations for the code? Also, I am avoiding DelVar in this program. Thanks in advance for any help!
*bump

I'm running into a problem that I can't seem to tackle.

With this program, a quick letter wrap that is compatible on both monochrome and color calculators, I have an issue where the starting value (C) is advanced by one if the previous line was just filled. In other words, one character is skipped when wrapping.

Code:
Xmin+|E2DeltaX<Xmax->|N
"AAAAAAAAAAAA^^oBBBBBBBBBBB^^o1234567890123456789012345678901234567890^^oABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ^^oabcdefghijklmnopqrstuvwxyz^^oHELLO, WORLD!!^^o
Ans->Str1
ClrDraw
1->C
For(A,0,54(|N+1),6(|N+1            //loop until the graphscreen is filled
inString(Str1,"^^o",C            //detect the next new line character
If Ans-C>=24+6|N               //fill a line if the characters exceed the graphscreen
23+6|N+C
Text(A,0,sub(Str1,C,Ans-C         //display string
If Ans=length(Str1:54(|N+1->A      //exit loop if the string is finished
Ans+1->C
End


Can anyone please help me fix this? Thanks!
*bump

After putting this off for a while, I have code that fixed my problem.

Code:
Xmin+|E2DeltaX<Xmax->|N
"AAAAAAAAAAAA^^oBBBBBBBBBBB^^o1234567890123456789012345678901234567890^^oABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ^^oabcdefghijklmnopqrstuvwxyz^^oHELLO, WORLD!!^^o
Ans->Str1
ClrDraw
1->X:0->A
While X<length(Str1) and A<=54(|N+1
inString(Str1,"^^o",X
min({23+7|N,Ans-X->C
Text(A,0,sub(Str1,X,Ans
If Ans!=23+7|N:X+1->X
X+C->X:A+6(|N+1->A
End
  
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 2
» 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