Computer Science Canada Need help with hangman game |
| Author: | Danyn [ Mon Nov 11, 2013 3:53 pm ] | ||
| Post subject: | Need help with hangman game | ||
What is it you are trying to achieve? I want to add a letter tracker to my program and I want to disable repeated letters from affecting the game. What is the problem you are having? I have no clue how to do so. Describe what you have tried to solve this problem I've tried using variables and put statements but nothing has worked. 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 |
|||
| Author: | Dreadnought [ Mon Nov 11, 2013 9:22 pm ] |
| Post subject: | Re: Need help with hangman game |
Basically, you want an array to keep track of what letters have already been tried. If you don't know what an array is (or want to learn more about Turing) see The Turing Walkthrough. You could also use a string as an array of characters if you are more comfortable with strings than arrays. The general idea is check if array tells you letter has been tried. if yes do something, if not do something else and modify the array to keep track of the current letter. Hope this helps! |
|
| Author: | Raknarg [ Mon Nov 11, 2013 9:24 pm ] |
| Post subject: | RE:Need help with hangman game |
Easiest way, is make a string that starts out empty and when the player guesses a letter, add that to the string. However if that letter is already in the string, tell them they can't use that letter. a string called something like usedLetters and the index function (you can look that up in the documentation) is all you would need for this. |
|