This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 27 Aug 2003 06:01:04 pm    Post subject:

In the past I have made various formula banks for my friends at school. It shows you the formula, asks you for important variables, plugs them into the formula and computes them. The main problem with this is that whenever the teacher would switch topics and give us new formulas, I would have to go into the program and add another label for another formula, which was bad, but the only way I know.

Before I made a simple program that asked the user for a formula that was stored into a string and then the user could run that formula and plug in variables. The problem with this is that it could only use 4 variables and it used A B C D every time.

Is there a way to add a formula to a string, say the quadratic formula (-b +or- sqrt[b^2 - 4ac]\2a) and then later compute that formula with the same variables? I dont think it is possible to store program commands in a string and execute them from a basic prog but what about ASM. And besides storing all of the formulas in a string, what else could I do to prevent having all of those labels?

IN OTHER WORDS

IS THERE A WAY FOR AN ASM PROGRAM TO EXECUTE A STRING WITH BASIC COMMANDS IN IT AS A PROGRAM?


Last edited by Guest on 27 Aug 2003 06:13:36 pm; edited 1 time in total
Back to top
62 52 53 53
Formerly known as 62 52 53 53


Active Member


Joined: 30 May 2003
Posts: 607

Posted: 28 Aug 2003 08:28:34 am    Post subject:

haha! another good project! sounds like I could program that with some nifty routines like the ones I'm using for my magic game. Pure Basic, Hehe! Basically, (no pun intended) you need a bunch of routines, one for each different calculation. It's hard to explain. I'll work on a simple version of this before continuing on Magic, because if I can get people to understand this, (much easier in simple formulas. I'll only make one. What should it be? Tell me now what example you want.) then they'll be able to program thier own, and maby somebody will even understand the concept of my magic game, and want to help program it. My magic game will be string drivven, and will write all of it's own strings.

edit: um, well, actually I was using lists, but close enough. Though if I store the list in the string, that might work, or I could use sub(. Or I could store the string in a list or whatever...


Last edited by Guest on 28 Aug 2003 08:53:50 am; edited 1 time in total
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 28 Aug 2003 01:28:56 pm    Post subject:

Couldn't you just input the string formula, such as "-b + sqrt[b^2 - 4ac]\2a"->Str1 and "-b - sqrt[b^2 - 4ac]\2a"->Str2 and then input the four variables, and then just use expr(Str1 and expr(Str2?

Or am I missing something? Neutral Expr( will just execute the string as an equation.

Spyderbyte
Back to top
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 28 Aug 2003 02:49:30 pm    Post subject:

Well, that would be a simple way of doing it, but I would like basically a program in a string, like with basic commands.
Back to top
Toksyuryel
Crimson Dragon Software


Elite


Joined: 14 Jun 2003
Posts: 880

Posted: 28 Aug 2003 03:24:26 pm    Post subject:

I tried that once. It's imposible in basic. I wanted to make a system for user friendly installation of winTI prgms, but it didn't work Sad Sad Sad Sad Sad Sad Sad Sad Sad
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 29 Aug 2003 05:17:25 pm    Post subject:

Jeffrey wrote:
IS THERE A WAY FOR AN ASM PROGRAM TO EXECUTE A STRING WITH BASIC COMMANDS IN IT AS A PROGRAM?

yes... you could make an asm prgm to store Str1 to a basic prog, then just use the parser to run it, then just delete the prog u made (the name would be normally unusable chars so as not to conflict Smile)
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 30 Aug 2003 02:54:02 am    Post subject:

Quote:
IS THERE A WAY FOR AN ASM PROGRAM TO EXECUTE A STRING WITH BASIC COMMANDS IN IT AS A PROGRAM?


Yes

The only difference between a program and a string is one byte in the symbol table.

So, you could easily write a an asm routine to run basic prog from a string. Then, the basic program could write basic code to the basic string.

Still, I do not know your purpose.
Back to top
62 52 53 53
Formerly known as 62 52 53 53


Active Member


Joined: 30 May 2003
Posts: 607

Posted: 30 Aug 2003 03:30:59 pm    Post subject:

fine. I'll work on coding a "A+2B-5C/2"

Just because you try to work it as a full equation doesen't mean I will.
{A,B,C}-> LVars
LVars(3)*5->LVars(4)
Lvars(4)/2->LVars(5)
Lvars(2)*2->LVars(6)
LVars(1)+LVars(5)->LVars(7)
LVars(7)+LVars(6)->LVars(8)

A bit of a bloated process, but it allows re-use of the original vars. And I know I can tell it which instruction, and which vars/constants to start with, and which element to store it to. I've done enough work with my MTG code to do this. All these contemporary ways of doing things. "well we have to do it all at once, and the list has to be in the order of the equation and..." WRONG. I thought that too, which is why I hadn't worked on MTG for TI83+. Which I admit might be a bit slow, but I could omit things to let people do the work and just have a virtual deck/play field.
Math is a box. However hard you look in math, you will just not accomplish this feat, just as you will not find a cookie jar in a box of books. However, you could leave the box, stand on it and reach the cookie jar on top of the refrigerator. Use the box, but not just to look through.
Math says that if something has four of something and that if you remove those four it will have nothing. 4-4=0. However, logic says that if a paper has four corners and you cut those corners off using straight lines, the paper will have eight. The logic requires math to figure out. However, math will always tell you that 4-4=0, even when it equals 8.

Edit, that is the math it would do, and the order in which it would do it. It is not the actuall program.


Last edited by Guest on 30 Aug 2003 03:32:35 pm; edited 1 time in total
Back to top
62 52 53 53
Formerly known as 62 52 53 53


Active Member


Joined: 30 May 2003
Posts: 607

Posted: 31 Aug 2003 08:28:36 pm    Post subject:

Ha! accomplished a four function formula! I told you I could!

to install the list, store:
{2,5,1,5,2,5,3,3,0,3,5,0,3,4,3,0,0,2,3,3,0,2,3,0,2,1,1,2,0,0,1,2,1,3,0,0,3,6,3,0
}
to List CDS

Then copy the following to graphlink, save, and transmit it to your calc.
Quote:
áCDSüáCMD
Lbl 00
If áCMD(áCMD(1))=1:Goto 1
If áCMD(áCMD(1))=2:Goto 2
If áCMD(áCMD(1))=3:Goto 3
If áCMD(áCMD(1))=4:Goto 4
If áCMD(áCMD(1))=5:Goto 5
If áCMD(áCMD(1))=6:Goto 6
If áCMD(áCMD(1))=0:Goto 02
Lbl 6
Pause áDAT(áCMD(áCMD(1)+1))
áCMD(1)+2üáCMD(1)
Goto 01
Lbl 5
Input sub("ABCDEFGH",áCMD(áCMD(1)+1),1),â
âüáDAT(áCMD(áCMD(1)+1))
0üâ
áCMD(1)+2üáCMD(1)
Goto 01
Lbl 1
If áCMD(áCMD(1)+1)ø0:áDAT(áCMD(áCMD(1)+1))üáCMD(áCMD(1)+3)
If áCMD(áCMD(1)+2)ø0:áDAT(áCMD(áCMD(1)+2))üáCMD(áCMD(1)+4)
áCMD(áCMD(1)+3)+áCMD(áCMD(1)+4)üáDAT(áCMD(áCMD(1)+5))
áCMD(1)+6üáCMD(1)
Goto 01
Lbl 2
If áCMD(áCMD(1)+1)ø0:áDAT(áCMD(áCMD(1)+1))üáCMD(áCMD(1)+3)
If áCMD(áCMD(1)+2)ø0:áDAT(áCMD(áCMD(1)+2))üáCMD(áCMD(1)+4)
áCMD(áCMD(1)+3)-áCMD(áCMD(1)+4)üáDAT(áCMD(áCMD(1)+5))
áCMD(1)+6üáCMD(1)
Goto 01
Lbl 3
If áCMD(áCMD(1)+1)ø0:áDAT(áCMD(áCMD(1)+1))üáCMD(áCMD(1)+3)
If áCMD(áCMD(1)+2)ø0:áDAT(áCMD(áCMD(1)+2))üáCMD(áCMD(1)+4)
áCMD(áCMD(1)+3)*áCMD(áCMD(1)+4)üáDAT(áCMD(áCMD(1)+5))
áCMD(1)+6üáCMD(1)
Goto 01
Lbl 4
If áCMD(áCMD(1)+1)ø0:áDAT(áCMD(áCMD(1)+1))üáCMD(áCMD(1)+3)
If áCMD(áCMD(1)+2)ø0:áDAT(áCMD(áCMD(1)+2))üáCMD(áCMD(1)+4)
áCMD(áCMD(1)+3)/áCMD(áCMD(1)+4)üáDAT(áCMD(áCMD(1)+5))
áCMD(1)+6üáCMD(1)
Goto 01
Lbl 01
Pause áDAT
If áCMD(1)ø0:Goto 00
Lbl 02


The list tells the prog what to do. The formula currently stored in the list is A+3B-5C/2. I'll work out displaying the formula and putting multiple formulas in a single list later. Or you can, I hope. Run, examine, I sure hope you are capable enough to modify it if you stare at it long enough.
Back to top
Toksyuryel
Crimson Dragon Software


Elite


Joined: 14 Jun 2003
Posts: 880

Posted: 31 Aug 2003 09:46:38 pm    Post subject:

You got some weird chars in there... what do they represent? (these: üáâø)
Back to top
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 31 Aug 2003 10:42:35 pm    Post subject:

UMMM. hold it. lol.

Good idea, by the way, but it seems a little complicated. I was thinking of making my own parser to parse a specially formatted string. For example, the string "5ABCDE" could easily be converted into the formula A*B*C*D*E. The prgram parses the simple string, recognizes the 5 as the number of variables, then, using a loop executes the formula.

Doesnt make sense? Probably doesnt yet. But this project is still into the future, not right now at least. There are several problems that arise, like what if a formula has redundant variables. Well the parser couldcompare the variables in the string to those already found.

But maybe in the future ill post whatever I found. Not right now though, Im working on learning ASM.
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 01 Sep 2003 02:49:58 am    Post subject:

Sub(, and expr( are the two commands you will be most interested in.

expr( evaluates a string, where sub takes a substring.

Sub(str1,2,3

Take 3 characters starting from character2

length determins the length.

e.g
length(str1

So, "ABC"->str1

lenght(str1 returns 3

You can do crap like this if you think

Sub(Str1,2,Length(Str1)-1)->Str1 Delete the first character from the string

similarly,

Sub(Str1,1,Length(Str1)-1)->Str1 Delete the last character from the string

Then there is inString which finds a character.

e.g.

inString("ABCB","B") returns 2 becasue B is at 2

But, you can start after B

e.g.
inSting("ABCB","B",3) returns 4 becase it started looking after the first B

If inSting returns 0, no match was found.

e.g.

"Bob,Fred,Al,Justin"->Str1
Input Str2

if inString(Str1,Str2)
Then
disp "Congratulations asshole
Else
disp "EAT SHIT AND DIE
End
Back to top
62 52 53 53
Formerly known as 62 52 53 53


Active Member


Joined: 30 May 2003
Posts: 607

Posted: 01 Sep 2003 09:18:10 am    Post subject:

Course it's complicated. I didn't take the time to optimize it. For example, functions 1-4 could have a single set of those two lines of code to load the variable value. There's other stuff too. And it's hard to program things for it, but it sure can be easier than programming a new version as far as distribution goes. You just give the person the string and the values to add at the end of the list. And I'll work on making a prog to make programming in it easier. It'll let you choose a function, then values/vars, and then go on to the next. Expect the full and optimized version by the end of next sunday.(ET) This strategy will also become a part of a CABAMAP-typr program in basic if Michael Vincent doesen't finish that project soon enough.

Last edited by Guest on 01 Sep 2003 09:18:37 am; edited 1 time in total
Back to top
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 01 Sep 2003 10:45:12 am    Post subject:

Yeah, my first general idea likef rom two weeks ago was to use the subs and instrings to make another string that instead of the variables, would have list numbers to execute.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 01 Sep 2003 02:01:58 pm    Post subject:

Laughing Jbirk, i love the sample prog... Laughing

do u think it would be possible for us to personally enable the filter for just us? cause i dont mind the words, i would just rather not have to see them if possible...
Back to top
Toksyuryel
Crimson Dragon Software


Elite


Joined: 14 Jun 2003
Posts: 880

Posted: 02 Sep 2003 05:20:35 pm    Post subject:

62 52 53 53 wrote:
And I'll work on making a prog to make programming in it easier.

By any chance could I get a copy of that for use in WindowsTI? I need a system for user friendly program installation, and so far I've come up blank. HELP MEEEEEEEEEEEEEEEEEEEEEEEE!!!!!!
Back to top
62 52 53 53
Formerly known as 62 52 53 53


Active Member


Joined: 30 May 2003
Posts: 607

Posted: 04 Sep 2003 08:01:37 pm    Post subject:

um, if you want to make it run them through ASM utils, then I'm sure any one of our Ideas would work, and you're welcom to use my thing, although it'll be easier to use strings for names. I suggest a combination of lists and strings. And any concept I make is free to use, but I ask that if you ever copy my code you put my name in credits somewhere. Even if the program doesen't display it. Having my name just sitting arround in the program for programmers to find is fine with me. With certain programs I will also request to know of your modifications. Not that it matters now, but I'll at least let you know of my policy before I actually do something so that you need it. It can't hurt to know now, can it?
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 05 Sep 2003 12:07:21 am    Post subject:

Adm.Wiggin wrote:
Laughing Jbirk, i love the sample prog... Laughing

do u think it would be possible for us to personally enable the filter for just us?  cause i dont mind the words, i would just rather not have to see them if possible...

I have no idea what you are talking discusing; please be succint.
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement