Browse Source

display rules - separate function

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
6a442533f6
  1. BIN
      cmake-build-debug/.ninja_deps
  2. 16
      cmake-build-debug/.ninja_log
  3. 4
      cmake-build-debug/Testing/Temporary/LastTest.log
  4. 15
      src/main/c/Hangman/initializeHangman.c
  5. 13
      src/main/c/Hangman/playHangman.c
  6. 2
      src/main/c/Hangman/playHangman.h

BIN
cmake-build-debug/.ninja_deps

16
cmake-build-debug/.ninja_log

@ -46,3 +46,19 @@
38 64 1707252806014628850 pmuw_projekt_notebinder a5668107eb06d295
0 40 1707252878137714916 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
40 64 1707252878161423786 pmuw_projekt_notebinder a5668107eb06d295
1 45 1707253160551840215 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
45 71 1707253160577192846 pmuw_projekt_notebinder a5668107eb06d295
1 41 1707253193210670246 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
41 66 1707253193235573958 pmuw_projekt_notebinder a5668107eb06d295
1 37 1707253252737582552 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
38 62 1707253252761716341 pmuw_projekt_notebinder a5668107eb06d295
0 27 1707253441396920863 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97
0 29 1707253441399178212 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
0 32 1707253441401953897 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o f1dbf76e6b4bc97d
32 57 1707253441426668233 pmuw_projekt_notebinder a5668107eb06d295
1 40 1707253551600054698 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
40 66 1707253551625723206 pmuw_projekt_notebinder a5668107eb06d295
0 37 1707253577044332311 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
37 62 1707253577068558309 pmuw_projekt_notebinder a5668107eb06d295
0 24 1707253657269506843 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97
24 47 1707253657292872794 pmuw_projekt_notebinder a5668107eb06d295

4
cmake-build-debug/Testing/Temporary/LastTest.log

@ -1,3 +1,3 @@
Start testing: Feb 06 21:54 CET
Start testing: Feb 06 22:07 CET
----------------------------------------------------------
End testing: Feb 06 21:54 CET
End testing: Feb 06 22:07 CET

15
src/main/c/Hangman/initializeHangman.c

@ -25,4 +25,19 @@ void printRules(){
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");
}
void displayRules(){
int readRules;
printf("Do you know how to play? (type number 1 or 2): \n");
printf("1. YES \n");
printf("2. NO \n");
scanf("%d", &readRules);
if(readRules == 2){
printRules();
} else if (readRules == 1) {
printf("Let's get started!\n");
} else {
printf("Please enter either 1 or 2 to continue: \n");
}
}

13
src/main/c/Hangman/playHangman.c

@ -45,18 +45,7 @@ void playHangman(char *wordToGuess) {
// Initialize the current guess and print the rules
initializeHangman(wordToGuess, currentGuess);
int readRules;
printf("Do you know how to play? (type number 1 or 2): \n");
printf("1. YES \n");
printf("2. NO \n");
scanf("%d", &readRules);
if( readRules == 2){
printRules();
} else if (readRules == 1) {
printf("Let's get started!\n");
} else {
printf("Please enter either 1 or 2 to continue: \n");
}
displayRules();
while (mistakes < MAX_MISTAKES) {
currentState(currentGuess, mistakes);

2
src/main/c/Hangman/playHangman.h

@ -17,7 +17,7 @@ void drawHangman(int incorrectGuesses);
void currentState(char *currentGuess, int mistakes);
const char* selectRandomWord();
const char wordsList[NUM_WORDS][MAX_WORD_LENGTH + 1];
void displayRules();
#define MAX_MISTAKES 6
#endif // PMUW_PROJEKT_NOTEBINDER_PLAYHANGMAN_H
Loading…
Cancel
Save