Posted: Tue Jan 08, 2013 6:42 pm Post subject: Turing- help making a simple hangman game
What is it you are trying to achieve?
Create a hangman game
What is the problem you are having?
don't know how to check each letter of every word.
I used a randint ( if ranNum = 1 then w1 = "Cake") for example.
Describe what you have tried to solve this problem
How do i check for every letter of the word?
Do i need a variable called alphabet which equals ABCDEFGHIJKLMNOPQRSTUVWXYZ? and another
variable which checks that? I'm really confused ;S
I really need help pleasee and thank you so much ;
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using
4.1.1
Sponsor Sponsor
Insectoid
Posted: Tue Jan 08, 2013 6:51 pm Post subject: RE:Turing- help making a simple hangman game
To get the individual letters of a string, you treat it sort of like an array.
code:
string foo = "Hello World"
put foo(3)
This will output 'l', the 3rd letter in the string.
When the user guesses a letter, use a loop to see if that letter equals any letter in the string.