From d93ae730461da199972ad51f97747f03fa5f1ad0 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Tue, 6 Feb 2024 21:39:32 +0100 Subject: [PATCH] rules explained --- cmake-build-debug/.ninja_deps | Bin 23832 -> 24452 bytes cmake-build-debug/.ninja_log | 3 +++ src/main/c/Hangman/initializeHangman.c | 12 +++++++++++- src/main/c/Hangman/playHangman.c | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 44b6d3eeed46916022fe71a6a5182d84f5b4b66a..d9e775224281dcb27378e91d3186bd0701636184 100644 GIT binary patch delta 44 zcmbQSi?L-t;|7V?$u^E0Y~^lRL9-GjdpVxt>tSSQNMm4N@R?-+6xtl;+QbL|Sz`{q delta 9 QcmZqK&p2Zj;|7UX02F@%y#N3J 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");