I have to make a hangman game for a school project and one of the requirements is to only accept a letter once during gameplay. I have allowed a user to guess the word by entering letters into a textbox and so I was just wondering if anyone knew how I could validate this?
Share
You could store all the letters that the user has already entered into some data structure like hash table(faster) / array(have to iterate through whole array). Then when the user enters the next letter in the letterbox , just check against the previously entered characters stored to find if it has been entered before or not.