diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 884aefb..7d5b5d0 100644 Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index 0a3593e..d117789 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -7,3 +7,9 @@ 0 106 1706551301992114407 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o de5f7edc6c2379d7 1 44 1706122039878920765 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Template/game100.c.o 69a5bcd8c57a43b3 106 195 1706551302079685763 pmuw_projekt_notebinder fbb48fd3bf0b96c1 +0 213 1706706276607336012 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421 +1 214 1706706276607356095 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/currentState.c.o c4eef1ff589ab182 +1 214 1706706276608460832 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6 +1 214 1706706276607344137 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o de5f7edc6c2379d7 +1 214 1706706276607374928 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/rules.c.o cdaff7b94c55641c +1 214 1706706276607365429 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97 diff --git a/cmake-build-debug/CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o b/cmake-build-debug/CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o index d4f2c70..a81ae51 100644 Binary files a/cmake-build-debug/CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o and b/cmake-build-debug/CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o differ diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index 178c872..e90d030 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/src/main/c/Hangman/playHangman.c @@ -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); + } } } \ No newline at end of file diff --git a/src/main/c/Hangman/playHangman.h b/src/main/c/Hangman/playHangman.h index c28fb46..6a96e42 100644 --- a/src/main/c/Hangman/playHangman.h +++ b/src/main/c/Hangman/playHangman.h @@ -9,4 +9,5 @@ #include "initializeHangman.c" #include "rules.c" #include "currentState.c" +#include "drawHangman.c" #endif //PMUW_PROJEKT_NOTEBINDER_PLAYHANGMAN_H