
-----------------------------------
Loomis
Thu Jan 07, 2010 7:24 pm

Simple Graphics showing different colour Alphabet
-----------------------------------
What is it you are trying to achieve?

I'm trying to write a program that displays the letter of the alphabet in different colours on one line. Each letter should appear slowly one at a time but should disappear when the next letter appears. The coding for this program should be as short as 12 or less lines.

What is the problem you are having?

I absolutely CANNOT make this program. I have no idea where to start!

Describe what you have tried to solve this problem

I've tried what basic knowledge I know of turing and tried to code the program using loops but I just don't know how. Especially since they're letters not numbers. 

Please specify what version of Turing you are using

Turing Version 4.1.1

-----------------------------------
registration
Thu Jan 07, 2010 9:52 pm

Re: Simple Graphics showing different colour Alphabet
-----------------------------------
What is it you are trying to achieve?

I'm trying to write a program that displays the letter of the alphabet in different colours on one line. Each letter should appear slowly one at a time but should disappear when the next letter appears. The coding for this program should be as short as 12 or less lines.

What is the problem you are having?

I absolutely CANNOT make this program. I have no idea where to start!

Describe what you have tried to solve this problem

I've tried what basic knowledge I know of turing and tried to code the program using loops but I just don't know how. Especially since they're letters not numbers. 

Please specify what version of Turing you are using

Turing Version 4.1.1

I'll just give you hints so you can figure it out yourself :)
Use a variable called string with all the letters from a to z.
Then you can use for loops, and you can refer to a single letter in the string with "put variable (i)". Then you can use cls and draw the next letter, etc. (if you have to make it change colours, you have to use Draw.Text instead and the for loop will also be used for the :colour part.
E.g., Draw.Text (variableWithTheLetters (i), x, y, font, i)
delay (something, recommend using time.elapsed instead)
cls

That's probably one of the simplest (and not the most efficient) way to do it.

-----------------------------------
DemonWasp
Thu Jan 07, 2010 10:10 pm

RE:Simple Graphics showing different colour Alphabet
-----------------------------------
Look at the chr keyword. Note how it converts from the ASCII integer value of a single character (such as letter, digit, punctuation, etc) into that actual character? Now go look at for cough). At each step, you need to output the character representation (chr!). You need to stay on the same line, so you should add .. to the end of the put line you use to output the character (this prevents it from moving to the next line).

Once you get that working, you can worry about colour. Setting the text colour is easy - just use colour (I think, my Turing is rusty; it may be called something else).

Edit: To get that "slowly, one at a time" effect, you should use delay(some-number-in-milliseconds) at each step of the loop described above.

-----------------------------------
registration
Thu Jan 07, 2010 10:21 pm

Re: RE:Simple Graphics showing different colour Alphabet
-----------------------------------
Look at the chr keyword. Note how it converts from the ASCII integer value of a single character (such as letter, digit, punctuation, etc) into that actual character? Now go look at for cough). At each step, you need to output the character representation (chr!). You need to stay on the same line, so you should add .. to the end of the put line you use to output the character (this prevents it from moving to the next line).

Once you get that working, you can worry about colour. Setting the text colour is easy - just use colour (I think, my Turing is rusty; it may be called something else).

Edit: To get that "slowly, one at a time" effect, you should use delay(some-number-in-milliseconds) at each step of the loop described above.
That way is a bit overdoing it for 24 lines of code. You have to convert it to character from ASCII, then convert after you output the character every single time; also I think he's combining this with some graphics which means colour (green or w/e) won't work with View.Set ("graphics"). If you want to do it his way however (more efficient and higher level programming I think o.O) look up __.Ord on turing doc files (forgot, was it int.ord or str.ord or something like that).

-----------------------------------
DemonWasp
Thu Jan 07, 2010 10:40 pm

RE:Simple Graphics showing different colour Alphabet
-----------------------------------
It's 5 lines of code. I don't know what you're going on about.

-----------------------------------
andrew.
Thu Jan 07, 2010 11:36 pm

RE:Simple Graphics showing different colour Alphabet
-----------------------------------
I got 6 lines with random colours, clearing the screen, and using the ASCII chars in a for loop. I guess 5 lines if you don't count the end for.

And for the OP, that should be a big hint when combined with the other posts in this topic.
