|
@ -46,14 +46,17 @@ void playHangman(char *wordToGuess) { |
|
|
mistakes++; |
|
|
mistakes++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Check if the player guessed all the letters |
|
|
|
|
|
|
|
|
// Win: Check if the player guessed all the letters |
|
|
if (strcmp(currentGuess,wordToGuess) == 0){ |
|
|
if (strcmp(currentGuess,wordToGuess) == 0){ |
|
|
currentState(currentGuess, mistakes); |
|
|
currentState(currentGuess, mistakes); |
|
|
printf("Bravo! You guessed the word: %s \n", wordToGuess); |
|
|
printf("Bravo! You guessed the word: %s \n", wordToGuess); |
|
|
break; |
|
|
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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |