I'm still working on that ps2 hangman game. I have it almost finished, but for some reason it keeps changing the letter entered as a guess into the first letter of the word, and entering it in the appropriate spot in the word. Can anyone tell me why this is? i used the print statements in the while loop to figure out where the problem was, but ii don't know why it would be changing it, and depending on the reason, i may or may not know how to fix it. http://dpaste.com/789829/
your print statements show that the error occurs between print statement 3letterGuessed and 4letterGuessed. at line 97 you use letterGuessed as the variable in the for statement at that point, the variable gets assigned as a letter of realWord. you need to use a different variable. here is something that might be useful for you - http://dpaste.com/789853/
Yes, exactly as @bwCA said, you need to use a new variable at line 97 instead of using letterGuessed again. Another note, look closely at line 107: It's resetting the dash to a letter repeatedly in the position of the first occurrence of that letter. You might consider using "index" instead of "guessCoords" when rebuilding the string dashedWord.
Join our real-time social learning platform and learn together with your friends!