
-----------------------------------
Toodles
Wed Jun 02, 2010 12:04 pm

Wordle Project In Turing - Difficult task
-----------------------------------
What is it you are trying to achieve?
a turing program that will load a text file. it will have to keep track of how many times a word comes up in the file. 
the more the word comes up in the file the larger that word should appear. 
its called WORDLE


What is the problem you are having?
im too damned stupid to get very far

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




var number : string := "" 
var needed : int
var words : array 1..10 of string % these arrays dont really do anything - but i know i need 1 for a string
var letters: array 1..10 of int % and the ither for integers


open : needed, "test.txt", get

loop 
    exit when eof (needed) 
    get : needed, number 
    put number 
end loop 



Please specify what version of Turing you are using
version 4.0.5

-----------------------------------
Tony
Wed Jun 02, 2010 12:44 pm

Re: Wordle Project In Turing - Difficult task
-----------------------------------

im too damned stupid to get very far

Not true. You express yourself much clearer than some other students around here. Writing code comes easier with practice.

You already have a loop that will read the text file. Awesome!

Now have you have just read the first word from a file, you need to record a +1 somewhere. What kind of a variable can you use for that?

-----------------------------------
Toodles
Mon Jun 07, 2010 11:58 am

Re: Wordle Project In Turing - Difficult task
-----------------------------------
boolean right?

-----------------------------------
Tony
Mon Jun 07, 2010 12:01 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
Well the boolean true/false can be used to mark that you've seen a word at least once; but it seems that we'd want to know how many times a word appears in total -- so something that can hold more information ("word appeared 42 times").

-----------------------------------
Cezna
Tue Jun 08, 2010 5:41 am

RE:Wordle Project In Turing - Difficult task
-----------------------------------
You would also need a way to do this for more than one word, so you will need a variable type that is a combination of two types (sort of... I'm trying not to give it away, Tony)

-----------------------------------
Toodles
Tue Jun 08, 2010 11:59 am

Re: Wordle Project In Turing - Difficult task
-----------------------------------
hmm... i'm not sure i know what that  would be. my class hasnt gone over that.

-----------------------------------
Insectoid
Tue Jun 08, 2010 2:55 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
OR you could just have two arrays, of two different types. Not quite as pretty but it doesn't use anything you haven't learned.

-----------------------------------
Cezna
Tue Jun 08, 2010 5:07 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
You would need an array of integers, and an array of strings.
Every time a certain word comes up that matches a word in the string array, you add one to the corresponding integer array.

-----------------------------------
Toodles
Thu Jun 10, 2010 11:56 am

RE:Wordle Project In Turing - Difficult task
-----------------------------------
hmm allright good stuff :) although what would the code look like with the line that add's one to the corresponding integer array?

-----------------------------------
Cezna
Thu Jun 10, 2010 12:02 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
You're gonna have to figure that one out for yourself.
;)

-----------------------------------
Toodles
Thu Jun 10, 2010 12:10 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
thats what ive been trying, look where it's gotten me :P

-----------------------------------
Toodles
Fri Jun 11, 2010 12:10 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
can i pleeease have the code? i simply just don't know it or how to get it

-----------------------------------
Tony
Fri Jun 11, 2010 1:10 pm

Re: RE:Wordle Project In Turing - Difficult task
-----------------------------------
can i pleeease have the code? i simply just don't know it or how to get it
If you are just given the code, you will continue to not understand it; which will make it really difficult in next assignments/exams/projects which will assume that you did understand it.

So lets try to get it. We've already established that we need some arrays. You've used some in the first piece of code that you've posted -- but lets confirm just how familiar you are with arrays. If you want to read up more on arrays, there are tutorials available through The Turing Walkthrough

In short, an array can be though of as a list of similar elements; each element addressable by an integer index. So you can get to the variable for the 5th word or 42nd word, etc.

-----------------------------------
Toodles
Mon Jun 14, 2010 12:11 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
hmm yeah i was allready looking theough the walkthrough but i still couldnt quite get it. 
though i have a new question
when turing is displaying the text file it
displayes 1 word per line, is there anyway i
can change that so theres a proper sentence structure? (multiple words per line)

-----------------------------------
Tony
Mon Jun 14, 2010 12:20 pm

RE:Wordle Project In Turing - Difficult task
-----------------------------------
[code]
get my_variable:*
[/code]
will fetch everything up to the end of the line, instead of words being delimited by whitespace.
