diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..9599e0f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index 68e34c0..166a23b 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/src/main/c/Hangman/playHangman.c @@ -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); diff --git a/src/main/c/Hangman/playHangman.h b/src/main/c/Hangman/playHangman.h index 01e6e6d..b516283 100644 --- a/src/main/c/Hangman/playHangman.h +++ b/src/main/c/Hangman/playHangman.h @@ -10,13 +10,13 @@ // Include function implementations directly from .c files -void playHangman(char *wordToGuess); +void playHangman(); void initializeHangman(char *wordToGuess, char *currentGuess); void printRules(); void drawHangman(int incorrectGuesses); void currentState(char *currentGuess, int mistakes); const char* selectRandomWord(); -const char wordsList[NUM_WORDS][MAX_WORD_LENGTH + 1]; +const char wordsList_easy[NUM_WORDS][MAX_WORD_LENGTH + 1]; void displayRules(); #define MAX_MISTAKES 6