Please somebody show me how to do this!
Programming help!
I used to do a little bit of programming on my ti 83 calculator at school but that was ten years ago and I'm now pretty rusty..
I was wondering if you could please please please please please please please please please please please please please please help me out with some code.
I need a program where I input a bunch of letters (I was thinking into a string, but you may have a better idea)
Like..
ClrHome
Input "Letters:",Str1
Now say imputed is... fbhiexhkkchdzsxvhfxzxbvfdvbhdxvlepitpndm
I would like to find out whether the following words can be made using the letters imputed in string1...
Dog
Cat
Bollder
Mouse
Figure
Test
Etc etc..
So I need to know what code on my ti 83 calculator you type yo find out what words 'can be made' & which words can't be made I don't want listed..
So in my example..
Dog - should NOT come up because there's no 'o' or 'g' imputed.
Cat - Shouldn't either due to there being no 'a' imputed.
Skipping ahead to the word 'test', I would like that word to be displayed when I hit enter as well as all other words I've pre programmed in on the program as all the letters are there. (I would like the program to recognise the 't' twice even though it's been imputed once).
Can you please help me with the appropriate code? Thank you do much for your help & time.
You should check out
inString(, which is basically what you want. Loop for each character in the matching word, and check if it's in the string. Hope this helps.
Adsamillion wrote:
Please somebody show me how to do this!
Programming help!
I used to do a little bit of programming on my ti 83 calculator at school but that was ten years ago and I'm now pretty rusty..
I was wondering if you could please please please please please please please please please please please please please please help me out with some code.
I need a program where I input a bunch of letters (I was thinking into a string, but you may have a better idea)
Like..
ClrHome
Input "Letters:",Str1
Now say imputed is... fbhiexhkkchdzsxvhfxzxbvfdvbhdxvlepitpndm
I would like to find out whether the following words can be made using the letters imputed in string1...
Dog
Cat
Bollder
Mouse
Figure
Test
Etc etc..
So I need to know what code on my ti 83 calculator you type yo find out what words 'can be made' & which words can't be made I don't want listed..
So in my example..
Dog - should NOT come up because there's no 'o' or 'g' imputed.
Cat - Shouldn't either due to there being no 'a' imputed.
Skipping ahead to the word 'test', I would like that word to be displayed when I hit enter as well as all other words I've pre programmed in on the program as all the letters are there. (I would like the program to recognise the 't' twice even though it's been imputed once).
Can you please help me with the appropriate code? Thank you do much for your help & time.
Code:
0→dim(L1
For(X,1,length(Str2
inString(Str1,sub(Str2,X,1→L1(X
End
If min(L1:Then
//Your code goes here
End
Where Str2 is 'cat' and Str1 is the letter pattern
Woooooaahhh!
Thanks for the replies.. I'll look into instring(
I know the answer is right there in front of me but I'm too out if touch. I want to list about 100 words for the string to check for.. I don't mind typing out all 100 words, but can someone simplify it for me?
In the second comment you say string2=cat.. But I want more like 100 words. I only have 10 strings? Still possible?
If someone can write the script entirely from start to finish and just show me where to type the 100 words, I'll pay you $20AUD, that's how bad I want to get this right! So for the first reply with the quickest easiest way to type the code from start to end, just saying "enter your words you want to search for here" then $20AUD is yours. Remember I haven't written script for like 10 - 15 years so go easy on me!
Thanks guys
To who ever gets back to me first, just pm me how you want the $20. (hope that's allowed)
You can store all the words into one string, although you still need a string delimiter. Like this:
Code: " "
For(A,1,1000
Input "Next word:",Str1
Ans+Str1+"]"
End
Ans->Str2
Then, to check each word, you need something like this:
Code: 0->I
Repeat not(I
I->J
inString(Str2,"]",I+1->I
If I
sub(Str2,J+1,I-J-1->Str3
<find the characters of Str3>
End
End
PT_ wrote:
You can store all the words into one string, although you still need a string delimiter. Like this:
Code: " "
For(A,1,1000
Input "Next word:",Str1
Ans+Str1+"]"
End
Ans->Str2
Then, to check each word, you need something like this:
Code: 0->I
Repeat not(I
I->J
inString(Str2,"]",I+1->I
If I
sub(Str2,J+1,I-J-1->Str3
<find the characters of Str3>
End
End
I'll seriously send you $20 if you just type it all out how I need to type it out, just tell me where I list my 100 words!
PT_ wrote:
I think he wanted closer to 100 words, not 1000 lol
And Adsamillion, we don't really do payments around here. After all, this is only TI-Basic, and we help people out free of charge.
Also, what PT_ wrote are 2 different programs. The first one you can run and you just need to input all 100 of your words, and that will create the words string for you.
That's not how a forum works. We are willing to answer questions and whatever, but paying for that is absolutely unnecessary. Also, with the code I gave you, you should be able to do it yourself. Just mess around with it, and if it doesn't work, try to figure out why it doesn't work. If you're really stuck, feel free to ask questions.
Just to double check, I want a program which has 100 words saved always..
Then I input up to 20 letters when I run the program and it spits out a list of matches to which words can be made up from those inputed letters (allowing letters to be used more than once.)
So does program 1 look like this...?
" "
For(A, 1 , 100
Input "cat, dog, bird, rat, rabbit", Str1
Ans+Str1+ " ]"
Ans - > Str2
Your first program should look like this. You can just enter it directly into the TI-Basic editor.
Once you've created the new program, be sure to enter a name for the program first. Then enter this:
Code: " "
For(A,1,100
Input "Next word:",Str1
Ans+Str1+"]"
End
Ans→Str2
After entering that, run the program by pressing [prgm] and selecting the name of the program. Then press enter twice to start it. After that, enter your first word. Press enter. Enter your second word. Press enter. Repeat until the program stops. Then your list of words will automatically be put into Str2.
And then the second program should be able to find what words from Str2 can be created.
Input is used for the user to give input. The program PT gave you would prompt the user to store values into a string. So, either use the code like PT gave:
PT_ wrote:
" "
For(A,1,1000
Input "Next word:",Str1
Ans+Str1+"]"
End
Ans->Str2
or store it into the string like this:
" word1]word2]word3]word4]->string1
The line of code above could be run from within a program or just on the home screen. But the point is that Input doesn't store things into a string, it asks the user to type something which can then be stored into a string.
What you are doing is creating a divisor between each word in the string. Then, inString( searches for each word divisor and outputs the position in the string of the divisor. That is where the word starts. The other divisor is where the word ends. So, you can create a substring based off of where inString( tells you the seperators are.
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
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