From d0cf9a6ff074cdd60590b9247bd9d12d361244fa Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Wed, 31 Jan 2024 13:22:54 +0100 Subject: [PATCH] Current State added + small changes in header files --- CMakeLists.txt | 2 ++ src/main/c/Hangman/currentState.c | 6 ++++++ src/main/c/Hangman/currentState.h | 4 ++++ src/main/c/Hangman/drawHangman.c | 2 +- src/main/c/Hangman/drawHangman.h | 6 ++---- src/main/c/Hangman/initializeHangman.c | 5 +---- src/main/c/Hangman/initializeHangman.h | 8 +++----- src/main/c/Hangman/rules.c | 1 - src/main/c/Hangman/rules.h | 6 +----- src/main/c/Hangman/word_selector.c | 4 ---- src/main/c/Hangman/word_selector.h | 4 ---- 11 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 src/main/c/Hangman/currentState.c create mode 100644 src/main/c/Hangman/currentState.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a6af89f..fb852cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,4 +19,6 @@ add_executable(pmuw_projekt_notebinder src/main/c/Hangman/rules.h src/main/c/Hangman/initializeHangman.c src/main/c/Hangman/initializeHangman.h + src/main/c/Hangman/currentState.c + src/main/c/Hangman/currentState.h ) diff --git a/src/main/c/Hangman/currentState.c b/src/main/c/Hangman/currentState.c new file mode 100644 index 0000000..6ee9bac --- /dev/null +++ b/src/main/c/Hangman/currentState.c @@ -0,0 +1,6 @@ +#include "currentState.h" + +void currentState(char *currentGuess, int mistakes) { + printf("Current Word: %s \n", currentGuess); + printf("Mistakes Made: %d/6 \n", mistakes); +} \ No newline at end of file diff --git a/src/main/c/Hangman/currentState.h b/src/main/c/Hangman/currentState.h new file mode 100644 index 0000000..41a99ec --- /dev/null +++ b/src/main/c/Hangman/currentState.h @@ -0,0 +1,4 @@ +#ifndef PMUW_PROJEKT_NOTEBINDER_CURRENTSTATE_H +#define PMUW_PROJEKT_NOTEBINDER_CURRENTSTATE_H +#include +#endif //PMUW_PROJEKT_NOTEBINDER_CURRENTSTATE_H diff --git a/src/main/c/Hangman/drawHangman.c b/src/main/c/Hangman/drawHangman.c index a4ae31f..4a78ad5 100644 --- a/src/main/c/Hangman/drawHangman.c +++ b/src/main/c/Hangman/drawHangman.c @@ -1,4 +1,4 @@ -#include +#include "drawHangman.h" void drawHangman(int incorrectGuesses) { diff --git a/src/main/c/Hangman/drawHangman.h b/src/main/c/Hangman/drawHangman.h index 6c6334f..2c31273 100644 --- a/src/main/c/Hangman/drawHangman.h +++ b/src/main/c/Hangman/drawHangman.h @@ -1,8 +1,6 @@ -// -// Created by Saba Fazlali on 29.01.24. -// - #ifndef PMUW_PROJEKT_NOTEBINDER_DRAWHANGMAN_H #define PMUW_PROJEKT_NOTEBINDER_DRAWHANGMAN_H +#include + #endif //PMUW_PROJEKT_NOTEBINDER_DRAWHANGMAN_H diff --git a/src/main/c/Hangman/initializeHangman.c b/src/main/c/Hangman/initializeHangman.c index 08b980d..221e50e 100644 --- a/src/main/c/Hangman/initializeHangman.c +++ b/src/main/c/Hangman/initializeHangman.c @@ -1,7 +1,4 @@ -#include -#include -#include - +#include "initializeHangman.h" void initializeHangman(char *wordToGuess, char *currentGuess) { int wordLength = strlen(wordToGuess); diff --git a/src/main/c/Hangman/initializeHangman.h b/src/main/c/Hangman/initializeHangman.h index 2ea55ca..58f5700 100644 --- a/src/main/c/Hangman/initializeHangman.h +++ b/src/main/c/Hangman/initializeHangman.h @@ -1,8 +1,6 @@ -// -// Created by Saba Fazlali on 31.01.24. -// - #ifndef PMUW_PROJEKT_NOTEBINDER_INITIALIZEHANGMAN_H #define PMUW_PROJEKT_NOTEBINDER_INITIALIZEHANGMAN_H - +#include +#include +#include #endif //PMUW_PROJEKT_NOTEBINDER_INITIALIZEHANGMAN_H diff --git a/src/main/c/Hangman/rules.c b/src/main/c/Hangman/rules.c index 6286db9..f7802bb 100644 --- a/src/main/c/Hangman/rules.c +++ b/src/main/c/Hangman/rules.c @@ -1,5 +1,4 @@ #include "rules.h" -#include void printRules(){ printf("Rules: \n"); diff --git a/src/main/c/Hangman/rules.h b/src/main/c/Hangman/rules.h index 5e52710..35b01a1 100644 --- a/src/main/c/Hangman/rules.h +++ b/src/main/c/Hangman/rules.h @@ -1,8 +1,4 @@ -// -// Created by Saba Fazlali on 29.01.24. -// - #ifndef PMUW_PROJEKT_NOTEBINDER_RULES_H #define PMUW_PROJEKT_NOTEBINDER_RULES_H - +#include #endif //PMUW_PROJEKT_NOTEBINDER_RULES_H diff --git a/src/main/c/Hangman/word_selector.c b/src/main/c/Hangman/word_selector.c index 0375253..157fb93 100644 --- a/src/main/c/Hangman/word_selector.c +++ b/src/main/c/Hangman/word_selector.c @@ -1,7 +1,3 @@ -// -// Created by Saba Fazlali on 22.01.24. -// - #include "word_selector.h" const char wordsList[NUM_WORDS][MAX_WORD_LENGTH + 1] = { diff --git a/src/main/c/Hangman/word_selector.h b/src/main/c/Hangman/word_selector.h index 9d5dd39..d606871 100644 --- a/src/main/c/Hangman/word_selector.h +++ b/src/main/c/Hangman/word_selector.h @@ -1,7 +1,3 @@ -// -// Created by Saba Fazlali on 24.01.24. -// - #ifndef PMUW_PROJEKT_NOTEBINDER_WORD_SELECTOR_H #define PMUW_PROJEKT_NOTEBINDER_WORD_SELECTOR_H