|
@ -9,14 +9,22 @@ char toLower(char ch) { |
|
|
return ch; |
|
|
return ch; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void playHangman(char *wordToGuess) { |
|
|
|
|
|
|
|
|
void playHangman() { |
|
|
|
|
|
char *wordToGuess; |
|
|
int mistakes = 0; |
|
|
int mistakes = 0; |
|
|
int score = 10; |
|
|
int score = 10; |
|
|
char guessedLetters[30] = ""; //Guessed letters |
|
|
char guessedLetters[30] = ""; //Guessed letters |
|
|
char currentGuess[50]; //Current state of the guessed word |
|
|
char currentGuess[50]; //Current state of the guessed word |
|
|
|
|
|
int difficulty; |
|
|
|
|
|
|
|
|
displayRules(); |
|
|
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 |
|
|
// Initialize the current guess and print the rules |
|
|
initializeHangman(wordToGuess, currentGuess); |
|
|
initializeHangman(wordToGuess, currentGuess); |
|
|
currentState(currentGuess, mistakes); |
|
|
currentState(currentGuess, mistakes); |
|
|