Browse Source

rules explained

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
d93ae73046
  1. BIN
      cmake-build-debug/.ninja_deps
  2. 3
      cmake-build-debug/.ninja_log
  3. 12
      src/main/c/Hangman/initializeHangman.c
  4. 2
      src/main/c/Hangman/playHangman.c

BIN
cmake-build-debug/.ninja_deps

3
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

12
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");
}

2
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");

Loading…
Cancel
Save