Otherwise the function produces good guess you have

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: You have already tried that letter.” • • previous-guesses is updated with the value of attempt now appearing at the beginning of the string guesses-left is reduced by 1 “Invalid guess.” If guesses-left is now 0 then the function produces “No more guesses. Game over.” otherwise the function produces “Letter is not in the puzzle.” A string that is a single upper case • letter that has not been previously guessed, and is in the puzzle. • previous-guesses is updated with the value of attempt now appearing at the beginning of the string current-guess is updated where the dashes that match the locations of attempt in correctanswer have been replaced by the value of attempt A string that is more than a single current-guess is updated with the character. In this case, we assume value of attempt that this is a guess of the entire puzzle. The guess is correct. A string that is more than a single guesses-left is reduced by 1 character and the guess is incorrect. If attempt was th...
View Full Document

Ask a homework question - tutors are online