|
|
@ -46,14 +46,17 @@ void playHangman(char *wordToGuess) { |
|
|
|
mistakes++; |
|
|
|
} |
|
|
|
|
|
|
|
// Check if the player guessed all the letters |
|
|
|
// Win: Check if the player guessed all the letters |
|
|
|
if (strcmp(currentGuess,wordToGuess) == 0){ |
|
|
|
currentState(currentGuess, mistakes); |
|
|
|
printf("Bravo! You guessed the word: %s \n", wordToGuess); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Lose: Print the answer + game over |
|
|
|
if (mistakes == MAX_MISTAKES){ |
|
|
|
currentState(currentGuess, mistakes); |
|
|
|
printf("Oops! You have no more guesses :( \n The answer was: %s \n", wordToGuess); |
|
|
|
} |
|
|
|
} |
|
|
|
} |