
-----------------------------------
vindicta
Thu Dec 13, 2007 4:40 pm

Help with loading words from notepad please!
-----------------------------------
For class i had to find words that when added up = 95 if a=1, b=2,c=3 ect. I made a program that can total up the word that you type in which was helpful but still too slow. Is there a way that i can put a bunch of words in notepad and my program will check each word individually to see if they total up to something. Please help if you know anything.

Spencer

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 4:53 pm

RE:Help with loading words from notepad please!
-----------------------------------
if you want ALL the possibile letters formed by the sum, the only way is to do it with brute froce, but there are endless possibilities, since a=1 and total is 95, and (95 as = total of 95) 
there must be some restriction to this

-----------------------------------
Tony
Thu Dec 13, 2007 4:55 pm

RE:Help with loading words from notepad please!
-----------------------------------
easy, once you're familiar with loops and reading from a file. There are tutorials for both in the tutorials section.

-----------------------------------
vindicta
Thu Dec 13, 2007 4:56 pm

Re: Help with loading words from notepad please!
-----------------------------------
What I mean is this: say I pasted a basic text file in notepad, such as the reply i'm posting now, can i make a program that will check the first word and see its value, then the next and checks all of them until its done and then tells me which words had 95

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 5:00 pm

RE:Help with loading words from notepad please!
-----------------------------------
OH ok sorry my bad :(
consider this, since there are 26 alphabets in english (i could be wrong) a-z and z is 26, and you are looking for the sum of 95
so we use 95 divided by 26, and you get 3.something, which means the word's minimum length must be 4, so then you check for all the words that are length of 4 or more ;) this should speed up a little

-----------------------------------
Tony
Thu Dec 13, 2007 5:00 pm

RE:Help with loading words from notepad please!
-----------------------------------
yes.

Though an important distinction is that you don't just paste the words into an application -- you save that as a text file, and then have your program read from the text file.

-----------------------------------
vindicta
Thu Dec 13, 2007 5:05 pm

RE:Help with loading words from notepad please!
-----------------------------------
HeavenAgian, I dont think you understand the question:p. There is no limit to the length of the word, you just total up individual words for example, Halloween is 95 because h=8 and a=1 and l=12 ect so when you total 8+1+12+12 and all the others you get 95.

And yes Tony, thats what i meant. It's just that im not familiar with loading data from text file. I am reading up now.

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 5:10 pm

RE:Help with loading words from notepad please!
-----------------------------------
well, you do want to speed up the process of getting the word which add up to 95
and words such as "I am The One" they cant possibily make up the sum of 95, because the max you can have is "zzz" which is 26x3, so you can skip any words that have the length of less than 3
that was what i meant :roll: although i could be wrong, again :cry:

-----------------------------------
vindicta
Thu Dec 13, 2007 5:12 pm

RE:Help with loading words from notepad please!
-----------------------------------
ok, yes. you're right there. I thought you meant that the words had to be less than 3 characters. But so far i've just been trying words that look like they might have 95 rather than trying everything.

-----------------------------------
vindicta
Thu Dec 13, 2007 5:22 pm

Re: Help with loading words from notepad please!
-----------------------------------
Ok, I've been reading the tutorial about loading data but i still have no clue how to check each individual word.

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 5:25 pm

RE:Help with loading words from notepad please!
-----------------------------------
i never done reading files in turing, but im assuming you read line by line
each time you read, (a string is returned) so, you will get a string of the current line
and you can go from there with a loop or a "split" method

-----------------------------------
Tony
Thu Dec 13, 2007 5:26 pm

RE:Help with loading words from notepad please!
-----------------------------------
well how are you checking each individual word now? There shouldn't be much of a difference.

-----------------------------------
vindicta
Thu Dec 13, 2007 5:26 pm

RE:Help with loading words from notepad please!
-----------------------------------
That's the thing, I have no idea:p

-----------------------------------
Tony
Thu Dec 13, 2007 5:28 pm

Re: Help with loading words from notepad please!
-----------------------------------
what?
I made a program that can total up the word that you type in
you've made a program and don't know how it works? :?

-----------------------------------
vindicta
Thu Dec 13, 2007 5:29 pm

RE:Help with loading words from notepad please!
-----------------------------------
oh, yeah. I made a program that only checks a word you type in. I want to make one that self checks each word in a group of text.

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 5:29 pm

RE:Help with loading words from notepad please!
-----------------------------------
you do know that a string is only an array of characters
so you use a for loop from the start of the array (aka the line) and check each char, and split the the lines from the white space (spacebar) and result with all the words that are left.... and use another loop.... and check and and and... ta da

-----------------------------------
Tony
Thu Dec 13, 2007 5:36 pm

Re: Help with loading words from notepad please!
-----------------------------------
well all you need to do is figure out how to get a single word out of a group.

You've
been reading the tutorial about loading data

The rest is the same.

-----------------------------------
vindicta
Thu Dec 13, 2007 5:38 pm

RE:Help with loading words from notepad please!
-----------------------------------
Any examples using code..I almost have it but a push in the right direction might help.

-----------------------------------
Nick
Thu Dec 13, 2007 5:42 pm

RE:Help with loading words from notepad please!
-----------------------------------
well knowing that var bar:string:="Test"
put bar(3)will output 's' since strings are an array of chars

also knowing that we can nest a loop in another loop we canloop
    loop
        counter+=1
        get input(counter)
        wordAtHand+=input(counter)
        exit when blank space
    end loop
    counter:=0
    exit when eof
end loop

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 5:45 pm

RE:Help with loading words from notepad please!
-----------------------------------
well, check if you are using the following command....
for loop? ord? length? if? i dont know whats more... probably ord and length will be the most handy one :roll:

-----------------------------------
syntax_error
Thu Dec 13, 2007 6:01 pm

Re: Help with loading words from notepad please!
-----------------------------------

well knowing that
Code:
var bar:string:="test"
put bar(3)
will output 's' since strings are an array of chars 

umm i may be wrong here but doesnt the index start at 0 so 
[code=turing]
var bar:string:="test"
put bar(3)
[/code]
should output 't'?
no?

-----------------------------------
Nick
Thu Dec 13, 2007 6:03 pm

Re: Help with loading words from notepad please!
-----------------------------------

well knowing that
Code:
var bar:string:="test"
put bar(3)
will output 's' since strings are an array of chars 

umm i may be wrong here but doesnt the index start at 0 so 


normally yes but turing isn't a normal language ;)

-----------------------------------
vindicta
Thu Dec 13, 2007 6:18 pm

RE:Help with loading words from notepad please!
-----------------------------------
ugh, even with all you're help i'm getting nowhere. So far all my program does is total up all the letters in the line. Do you know how i can tell it to check the 2nd,3rd,4th line ect?

-----------------------------------
HeavenAgain
Thu Dec 13, 2007 6:20 pm

RE:Help with loading words from notepad please!
-----------------------------------
read the line again, it will return you the 2nd line and so on for 3rd and 4th

-----------------------------------
vindicta
Thu Dec 13, 2007 6:24 pm

RE:Help with loading words from notepad please!
-----------------------------------
here's my next problem, when i put spaces between the words it does the first set of characters then when it reaches the spacebar, it starts over agian. How can i make it continue?

-----------------------------------
Nick
Thu Dec 13, 2007 6:29 pm

RE:Help with loading words from notepad please!
-----------------------------------
if you're using my code then just move the counter := 0 to outside the second loop

-----------------------------------
vindicta
Thu Dec 13, 2007 6:32 pm

RE:Help with loading words from notepad please!
-----------------------------------
WOO! I got it, thanks everyone.
