After guessing the letter s the puzzle would be s s

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: number of letters of each word in the phrase. If a player guesses a letter that occurs in the phrase, the dashes are replaced by the correct letter in every position where that letter appears in the phrase. If a player makes a guess that does not occur in the puzzle then nothing is changed. However, the player has a limited number of incorrect guesses. The game ends when either the player exceeds the number of allowed incorrect guesses, or guesses the whole phrase correctly, or correctly guesses all of the letters in the phrase. For example, if the secret phrase is “CS IS GREAT”, the original puzzle would be “-- -- -----”. After guessing the letter “S”, the puzzle would be “-S –S -----”. For both questions, you will be mutating the following four state variables • correct-answer – a string with at least two characters, that represents the correct “secret” phrase • current-guess – a string that contains dashe...
View Full Document

This document was uploaded on 01/19/2014.

Ask a homework question - tutors are online