Browse Source

super hard level added to game

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
d0197b20aa
  1. 3
      src/main/c/Hangman/playHangman.c
  2. 2
      src/main/c/Hangman/word_selector.c

3
src/main/c/Hangman/playHangman.c

@ -19,9 +19,10 @@ void playHangman() {
displayRules(); displayRules();
printf("choose the difficulty level: (1 or 2)\n");
printf("choose the difficulty level: (1, 2 or 3)\n");
printf("1. Easy \n"); printf("1. Easy \n");
printf("2. Hard \n"); printf("2. Hard \n");
printf("3. Super hard \n");
scanf("%d", &difficulty); scanf("%d", &difficulty);
wordToGuess = selectRandomWord(difficulty); wordToGuess = selectRandomWord(difficulty);

2
src/main/c/Hangman/word_selector.c

@ -86,7 +86,7 @@ char* selectRandomWord(int difficulty) {
case 3: case 3:
return wordsList_super_hard[randomIndex]; return wordsList_super_hard[randomIndex];
default: default:
printf("Invalid difficulty level. Using easy difficulty.\n");
printf("Invalid difficulty level. We choose easy level for you.\n");
return wordsList_easy[randomIndex]; return wordsList_easy[randomIndex];
} }
} }
Loading…
Cancel
Save