diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 44b6d3e..d9e7752 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 a7916c1..db26d5f 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -35,3 +35,6 @@ 45 72 1707236593357601081 pmuw_projekt_notebinder a5668107eb06d295 0 44 1707250874478682419 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6 44 70 1707250874504270369 pmuw_projekt_notebinder a5668107eb06d295 +1 192 1707251949669860983 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97 +1 193 1707251949670799948 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6 +193 280 1707251949757039868 pmuw_projekt_notebinder a5668107eb06d295 diff --git a/src/main/c/Hangman/initializeHangman.c b/src/main/c/Hangman/initializeHangman.c index 9ea56a2..011799a 100644 --- a/src/main/c/Hangman/initializeHangman.c +++ b/src/main/c/Hangman/initializeHangman.c @@ -13,6 +13,16 @@ void initializeHangman(char *wordToGuess, char *currentGuess) { } void printRules(){ - printf("Rules: \n"); + printf("Welcome to hangman game!\n"); + printf("How to play: \n"); + printf(" - A word be randomly selected from the list of words.\n"); + printf(" - A series of dashes will be displayed, each representing a letter in the secret word.\n"); + printf(" - You are allowed a maximum of 6 mistakes.\n"); + printf(" - You will start guessing letters one at a time.\n"); + printf(" - Each guess should be a single letter of the alphabet, either uppercase or lowercase.\n"); + printf(" - After each guess, the computer will check if the letter you guessed is in the secret word.\n"); + printf(" - If the guessed letter is in the word, the computer will reveal all occurrences of that letter in the word.\n"); + printf(" - If the guessed letter is not in the word, the computer will count the incorrect guesses.\n"); + printf(" - Wrong guesses are represented by drawing parts of a hangman figure.\n"); printf(" - You are allowed a maximum of 6 mistakes.\n"); } \ No newline at end of file diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index 9923dab..7ee3ee3 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/src/main/c/Hangman/playHangman.c @@ -36,6 +36,7 @@ char getSingleCharInput() { return '\0'; // More than one character entered } } + void playHangman(char *wordToGuess) { int mistakes = 0; char guessedLetters[30]; //Guessed letters @@ -69,7 +70,6 @@ void playHangman(char *wordToGuess) { continue; } - // Check if the letter has already been guessed by the player if (strchr(guessedLetters, guess) != NULL) { printf("You already guessed that letter. Try another letter.\n");