|
|
@ -9,14 +9,22 @@ char toLower(char ch) { |
|
|
|
return ch; |
|
|
|
} |
|
|
|
|
|
|
|
void playHangman(char *wordToGuess) { |
|
|
|
void playHangman() { |
|
|
|
char *wordToGuess; |
|
|
|
int mistakes = 0; |
|
|
|
int score = 10; |
|
|
|
char guessedLetters[30] = ""; //Guessed letters |
|
|
|
char currentGuess[50]; //Current state of the guessed word |
|
|
|
int difficulty; |
|
|
|
|
|
|
|
displayRules(); |
|
|
|
|
|
|
|
printf("choose the difficulty level: (1 or 2)\n"); |
|
|
|
printf("1. Easy \n"); |
|
|
|
printf("2. Hard \n"); |
|
|
|
scanf("%d", &difficulty); |
|
|
|
wordToGuess = selectRandomWord(difficulty); |
|
|
|
|
|
|
|
// Initialize the current guess and print the rules |
|
|
|
initializeHangman(wordToGuess, currentGuess); |
|
|
|
currentState(currentGuess, mistakes); |
|
|
|