From dbde6ebd43ec6aeb4d3abe935121ac8d4bcd5f96 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Fri, 2 Feb 2024 15:33:49 +0000 Subject: [PATCH 001/109] Update team.md --- team.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/team.md b/team.md index d2652c3..76bf093 100644 --- a/team.md +++ b/team.md @@ -3,4 +3,5 @@ Peter Wiebe, fdai7773 Simon Hildebrandt, fdai7864 Lucas Heil, fdai7356 Celine Khazarian, fdai7781 -Ahmad Thaljeh, fdai7726 \ No newline at end of file +Ahmad Thaljeh, fdai7726 +Yasin Al Satouf, fdai7731 From bf139ce197b80679afc141797340a3bf67646c42 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 17:59:40 +0100 Subject: [PATCH 002/109] Commit 1 - Bibliotheken --- src/main/c/hangman.c | 6 ++++++ src/main/c/hangman.txt | 1 + src/main/c/hangman_words.txt | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 src/main/c/hangman.c create mode 100644 src/main/c/hangman.txt create mode 100644 src/main/c/hangman_words.txt diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c new file mode 100644 index 0000000..e2f3360 --- /dev/null +++ b/src/main/c/hangman.c @@ -0,0 +1,6 @@ +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/src/main/c/hangman.txt b/src/main/c/hangman.txt new file mode 100644 index 0000000..4456b2e --- /dev/null +++ b/src/main/c/hangman.txt @@ -0,0 +1 @@ +name:peter,level:01 \ No newline at end of file diff --git a/src/main/c/hangman_words.txt b/src/main/c/hangman_words.txt new file mode 100644 index 0000000..0720bb4 --- /dev/null +++ b/src/main/c/hangman_words.txt @@ -0,0 +1,20 @@ +fulda +galgenmann +programmiermethoden +test +peter +ahmad +joe +celine +sigi +jonas +mitochondrien +aufmerksamkeitsdefizithyperaktivitaetsstoerung +donaudampfschifffahrtelekrizitaetenhauptbetriebswerkbauunternehmenbeamtengesellschaft +malaysia +lucas +yasin +samuel +celli +hochschule +fulda \ No newline at end of file From 0f601c53bdb1f7db864b049a98e06e6b58bf964f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:00:46 +0100 Subject: [PATCH 003/109] =?UTF-8?q?Commit=202=20-=20func=20Protokoll=20hin?= =?UTF-8?q?zuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index e2f3360..7bcb8a3 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -3,4 +3,8 @@ #include #include #include -#include \ No newline at end of file +#include + +void protokoll(); + +void protokoll(){} \ No newline at end of file From bde4a9ddd58c970c37b037a893000956fea155ec Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:01:27 +0100 Subject: [PATCH 004/109] =?UTF-8?q?Commit=203=20-=20func=20clearscreen=20h?= =?UTF-8?q?inzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 7bcb8a3..f04044a 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -6,5 +6,14 @@ #include void protokoll(); +void clear_screen(); -void protokoll(){} \ No newline at end of file +void protokoll(){ + clear_screen(); +} + +void clear_screen() { + system("clear"); + // system("cls"); // fuer Windows + // system("clear"); // fuer UNIX/Linux +} \ No newline at end of file From 5f115df6847ac96cd437d9084a74f420eb25241b Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:02:06 +0100 Subject: [PATCH 005/109] =?UTF-8?q?Commit=204=20-=20func=20willkomen=20hin?= =?UTF-8?q?zuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index f04044a..932b123 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -7,13 +7,19 @@ void protokoll(); void clear_screen(); +void willkommen(); void protokoll(){ clear_screen(); + willkommen(); } void clear_screen() { system("clear"); // system("cls"); // fuer Windows // system("clear"); // fuer UNIX/Linux +} + +void willkommen(){ + //Druecke Enter zun fortfahren } \ No newline at end of file From 9d644608cdc208bdf6dc673ef42710e22a823bc7 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:02:51 +0100 Subject: [PATCH 006/109] Commit 5 - func willkommen funktion einbauen --- src/main/c/hangman.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 932b123..11ab69d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -21,5 +21,8 @@ void clear_screen() { } void willkommen(){ - //Druecke Enter zun fortfahren + char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; + + printf("%s", ENTERtxt); + getchar(); } \ No newline at end of file From dd520029451a273a673366f951a48113a6a3df9c Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:05:36 +0100 Subject: [PATCH 007/109] =?UTF-8?q?Commit=206=20-=20func=20namepruefen=20e?= =?UTF-8?q?inf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 11ab69d..b013cca 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -8,10 +8,12 @@ void protokoll(); void clear_screen(); void willkommen(); +int namePruefen(); void protokoll(){ clear_screen(); willkommen(); + namePruefen(); } void clear_screen() { @@ -25,4 +27,32 @@ void willkommen(){ printf("%s", ENTERtxt); getchar(); +} + +int namePruefen() { + char KonfDatei[100]; + int laengeKonfDatei = 0; + + FILE *fp = NULL; + fp = fopen("hangman.txt", "r"); + + if (fp == NULL) { + printf("Fehler beim Öffnen der Konfigurationsdatei\n"); + return 1; + } else { + fscanf(fp, "%s", KonfDatei); //Inhalt der KonfDatei wird ins Array gelesen + + while(KonfDatei[laengeKonfDatei] != 0){ //Laenge der KonfDatei wird ermittelt + laengeKonfDatei++; + } + + if(laengeKonfDatei > 14){ //mit der Laenge wird geschaut, ob ein Name gespeichert ist oder nicht + fclose(fp); + return 0; + } else { + fclose(fp); + return 0; + } + } + fclose(fp); } \ No newline at end of file From adf66c53137f92c28a0ec7284b40ab4a619d171d Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:06:39 +0100 Subject: [PATCH 008/109] =?UTF-8?q?Commit=207=20-=20func=20namewahelen=20h?= =?UTF-8?q?inzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index b013cca..1263218 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -9,6 +9,7 @@ void protokoll(); void clear_screen(); void willkommen(); int namePruefen(); +void nameWaehlen(); void protokoll(){ clear_screen(); @@ -55,4 +56,23 @@ int namePruefen() { } } fclose(fp); +} + +void nameWaehlen(){ + char name[50]; + + FILE *fp = NULL; + fp = fopen("hangman.txt", "w"); + + clear_screen(); // + printf("Geben Sie den Namen ein: "); + scanf("%s", name); + + char KonfDatei[100]; + snprintf(KonfDatei, sizeof(KonfDatei), "name:%s,level:01", name); + + fprintf(fp, "%s", KonfDatei); + fclose(fp); + + startauswahl(); } \ No newline at end of file From a1603172fefda69d14d2a77627f843e571a66e54 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:07:51 +0100 Subject: [PATCH 009/109] Commit 8 - namewaehlen einbinden --- src/main/c/hangman.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 1263218..fe020bf 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -26,6 +26,7 @@ void clear_screen() { void willkommen(){ char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; + printf("%s", ENTERtxt); getchar(); } @@ -51,6 +52,8 @@ int namePruefen() { fclose(fp); return 0; } else { + printf("Sieht aus, als haettest du noch keinen Namen :(\n"); + nameWaehlen(); fclose(fp); return 0; } @@ -65,6 +68,7 @@ void nameWaehlen(){ fp = fopen("hangman.txt", "w"); clear_screen(); // + printf("Geben Sie den Namen ein: "); scanf("%s", name); @@ -73,6 +77,4 @@ void nameWaehlen(){ fprintf(fp, "%s", KonfDatei); fclose(fp); - - startauswahl(); } \ No newline at end of file From 8308d24c85ce1d524584c87f86a465f7621b70b0 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:08:33 +0100 Subject: [PATCH 010/109] =?UTF-8?q?Commit=209=20-=20func=20startauswahl=20?= =?UTF-8?q?hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index fe020bf..f17a135 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -10,11 +10,13 @@ void clear_screen(); void willkommen(); int namePruefen(); void nameWaehlen(); +void startauswahl(); void protokoll(){ clear_screen(); willkommen(); namePruefen(); + startauswahl(); } void clear_screen() { @@ -77,4 +79,9 @@ void nameWaehlen(){ fprintf(fp, "%s", KonfDatei); fclose(fp); +} + +void startauswahl() { + printf("Willkommen "); + printf("[1] Spielen\n[2] Namen aendern\n"); } \ No newline at end of file From 8b45bc51ecefd0c079c7d44ff784f614f4e28ede Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:09:07 +0100 Subject: [PATCH 011/109] Commit 10 - Func startauswahl funktion einbauen --- src/main/c/hangman.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index f17a135..61763f7 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -82,6 +82,20 @@ void nameWaehlen(){ } void startauswahl() { + int auswahl; + int modus; + + clear_screen(); // + printf("Willkommen "); printf("[1] Spielen\n[2] Namen aendern\n"); + scanf("%d", &auswahl); + + if(auswahl == 1){ + //levelauswahl + } else if (auswahl == 2){ + nameWaehlen(); + } else { + printf("Eingabe ungueltig"); + } } \ No newline at end of file From e2eb6bcab96d9c53335a25bfab2cc70aab7293b7 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:09:52 +0100 Subject: [PATCH 012/109] =?UTF-8?q?Commit=2011=20-=20func=20nameausgeben?= =?UTF-8?q?=20f=C3=BCr=20func=20startauswahl=20einbauen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 61763f7..f89cc80 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -11,6 +11,7 @@ void willkommen(); int namePruefen(); void nameWaehlen(); void startauswahl(); +void nameAusgeben(); void protokoll(){ clear_screen(); @@ -98,4 +99,35 @@ void startauswahl() { } else { printf("Eingabe ungueltig"); } +} + +void nameAusgeben(){ + char KonfDatei[100]; + char name[50]; + int i = 5; + int zaehler = 0; + int nullt; + + FILE *fp = NULL; + fp = fopen("hangman.txt", "r"); + + fscanf(fp, "%s", KonfDatei); + while(KonfDatei[i] != ','){ + zaehler++; + i++; + } + nullt = zaehler; + while(zaehler != 0){ + name[--zaehler] = KonfDatei[--i]; + } + + i = 0; + while(name[i] != 0){ + i++; + } + + name[nullt] = '\0'; + printf("%s\n", name); + + fclose(fp); } \ No newline at end of file From a7023651e87b803a87273fc88bd78e70a9149999 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:10:35 +0100 Subject: [PATCH 013/109] =?UTF-8?q?Commit=2012=20-=20func=20nameausgeben?= =?UTF-8?q?=20in=20func=20startauswahl=20einf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index f89cc80..64f828a 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -89,6 +89,7 @@ void startauswahl() { clear_screen(); // printf("Willkommen "); + nameAusgeben(); printf("[1] Spielen\n[2] Namen aendern\n"); scanf("%d", &auswahl); From eaf67504f0a7f6542dd27f31fe6cf8d107f69a57 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:11:16 +0100 Subject: [PATCH 014/109] Commit 13 - func levelauswahl erstellen --- src/main/c/hangman.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 64f828a..c5f8452 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -12,6 +12,7 @@ int namePruefen(); void nameWaehlen(); void startauswahl(); void nameAusgeben(); +void levelauswahl(); void protokoll(){ clear_screen(); @@ -87,7 +88,7 @@ void startauswahl() { int modus; clear_screen(); // - + printf("Willkommen "); nameAusgeben(); printf("[1] Spielen\n[2] Namen aendern\n"); @@ -130,5 +131,30 @@ void nameAusgeben(){ name[nullt] = '\0'; printf("%s\n", name); + fclose(fp); +} + +void levelauswahl(){ + char levelstr[3]; + char KonfDatei[100]; + int level; + int i = 0; + + clear_screen(); // + + + FILE *fp = NULL; + fp = fopen("hangman.txt", "r"); + + fscanf(fp, "%s", KonfDatei); + while(KonfDatei[i] != 0){ + i++; + } + levelstr[0] = KonfDatei[i-2]; + levelstr[1] = KonfDatei[i-1]; + levelstr[2] = '\0'; + level = atoi(levelstr); + //hauptspiel mit dem Level starten + fclose(fp); } \ No newline at end of file From cdb61e6e7b93011fc423d3baec9f853d939e82ef Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:21:14 +0100 Subject: [PATCH 015/109] =?UTF-8?q?Commit=2014=20-=20func=20levelauswahl?= =?UTF-8?q?=20in=20func=20startauswahl=20einf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index c5f8452..6454af6 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -30,7 +30,7 @@ void clear_screen() { void willkommen(){ char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; - + printf("%s", ENTERtxt); getchar(); } @@ -72,7 +72,7 @@ void nameWaehlen(){ fp = fopen("hangman.txt", "w"); clear_screen(); // - + printf("Geben Sie den Namen ein: "); scanf("%s", name); @@ -95,7 +95,7 @@ void startauswahl() { scanf("%d", &auswahl); if(auswahl == 1){ - //levelauswahl + levelauswahl(); } else if (auswahl == 2){ nameWaehlen(); } else { @@ -155,6 +155,5 @@ void levelauswahl(){ levelstr[2] = '\0'; level = atoi(levelstr); //hauptspiel mit dem Level starten - fclose(fp); } \ No newline at end of file From 2a4b49f8a12ec8a907dc26c1e267980f3ce8e71c Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:21:58 +0100 Subject: [PATCH 016/109] Commit 15 - func hauptspiel erstellen --- src/main/c/hangman.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 6454af6..446fa7a 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -13,6 +13,7 @@ void nameWaehlen(); void startauswahl(); void nameAusgeben(); void levelauswahl(); +void hauptSpiel(int level); void protokoll(){ clear_screen(); @@ -156,4 +157,21 @@ void levelauswahl(){ level = atoi(levelstr); //hauptspiel mit dem Level starten fclose(fp); +} + +void hauptSpiel(int level){ + char secret_word[100]; + int attempts = 0; + char guessed_letter; + char guessed_letters[100]; + char path[] = "hangman_words.txt"; + int result; + int won = 0; + //secret_word soll vergeben werden + //secret_word soll geladen werden + //path soll erstellt werden + //hangman soll gemalt werden + //Buchstaben sollen gezeigt werden + //Buchstaben sollen eingegeben werden können + //eingegeben Buchstaben sollen überprüft und dem Lösungswort hinzugefügt werden, damit Gewinn ermittelt werden kann } \ No newline at end of file From 2cb16c70024b9f2f1a30a13f46348e5f4ec9e031 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:23:00 +0100 Subject: [PATCH 017/109] =?UTF-8?q?Commit=2016=20-=20func=20hangman=20soll?= =?UTF-8?q?=20gezeichnet=20werden=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 75 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 446fa7a..847a301 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -14,6 +14,7 @@ void startauswahl(); void nameAusgeben(); void levelauswahl(); void hauptSpiel(int level); +void draw_hangman(int attempts); void protokoll(){ clear_screen(); @@ -174,4 +175,78 @@ void hauptSpiel(int level){ //Buchstaben sollen gezeigt werden //Buchstaben sollen eingegeben werden können //eingegeben Buchstaben sollen überprüft und dem Lösungswort hinzugefügt werden, damit Gewinn ermittelt werden kann +} + +void draw_hangman(int attempts) { + clear_screen(); + printf("Galgenmann!\n"); + printf("v.1.0.2\n\n"); + + switch(attempts) { + case 0: + printf(" _______\n"); + printf(" | |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + case 1: + printf(" _______\n"); + printf(" | |\n"); + printf(" | O\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + case 2: + printf(" _______\n"); + printf(" | |\n"); + printf(" | O\n"); + printf(" | |\n"); + printf(" |\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + case 3: + printf(" _______\n"); + printf(" | |\n"); + printf(" | O\n"); + printf(" | /|\n"); + printf(" |\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + case 4: + printf(" _______\n"); + printf(" | |\n"); + printf(" | O\n"); + printf(" | /|\\\n"); + printf(" |\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + case 5: + printf(" _______\n"); + printf(" | |\n"); + printf(" | O\n"); + printf(" | /|\\\n"); + printf(" | /\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + case 6: + printf(" _______\n"); + printf(" | |\n"); + printf(" | O\n"); + printf(" | /|\\\n"); + printf(" | / \\\n"); + printf(" |\n"); + printf("__|_________\n\n\n\n"); + break; + default: + break; + } } \ No newline at end of file From eef1885341c7fe5aa7fef2aa9999bed7098f6fb2 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:24:06 +0100 Subject: [PATCH 018/109] =?UTF-8?q?Commit=2017=20-=20jeder=20eingegebene?= =?UTF-8?q?=20Buchstabe=20soll=20dem=20Array=20aller=20eingegebenen=20Buch?= =?UTF-8?q?staben=20hinzugef=C3=BCgt=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 847a301..4a8045d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -15,6 +15,7 @@ void nameAusgeben(); void levelauswahl(); void hauptSpiel(int level); void draw_hangman(int attempts); +void add_guessed_letter(char* guessed_letters, char guessed_letter); void protokoll(){ clear_screen(); @@ -249,4 +250,12 @@ void draw_hangman(int attempts) { default: break; } +} + +void add_guessed_letter(char* guessed_letters, char guessed_letter){ + for (int i = 0; i < strlen(guessed_letters); i++){ + if (guessed_letters[i] == guessed_letter){ + return; + } + } } \ No newline at end of file From acff3629568741492c0ce4533fef963453f315e1 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:25:15 +0100 Subject: [PATCH 019/109] Commit 18 - Erweiterung der Funktion add_guessed_letter --- src/main/c/hangman.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 4a8045d..dd978ec 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -258,4 +258,6 @@ void add_guessed_letter(char* guessed_letters, char guessed_letter){ return; } } + guessed_letters[strlen(guessed_letters)] = guessed_letter; + guessed_letters[strlen(guessed_letters) + 1] = '\0'; } \ No newline at end of file From 82b77097a0a00369ed2cf86f05faa30f4829a120 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:26:26 +0100 Subject: [PATCH 020/109] =?UTF-8?q?Commit=2019=20-=20eingabe=20eines=20Buc?= =?UTF-8?q?hstaben=20in=20die=20func=20Hauptspiel=20soll=20erm=C3=B6glicht?= =?UTF-8?q?=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index dd978ec..bec8f47 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -16,6 +16,7 @@ void levelauswahl(); void hauptSpiel(int level); void draw_hangman(int attempts); void add_guessed_letter(char* guessed_letters, char guessed_letter); +char eingabe_buchstabe(); void protokoll(){ clear_screen(); @@ -260,4 +261,11 @@ void add_guessed_letter(char* guessed_letters, char guessed_letter){ } guessed_letters[strlen(guessed_letters)] = guessed_letter; guessed_letters[strlen(guessed_letters) + 1] = '\0'; +} + +char eingabe_buchstabe(){ + char guess; + scanf(" %c", &guess); + guess = tolower(guess); + return guess; } \ No newline at end of file From 6bc8c8dfc5de732ba69fc167cc81d1495a3ac7fa Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:28:30 +0100 Subject: [PATCH 021/109] Commit 20 - func lade secret_word zum laden des wortes soll erstellt werden --- src/main/c/hangman.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index bec8f47..93892bb 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -17,6 +17,7 @@ void hauptSpiel(int level); void draw_hangman(int attempts); void add_guessed_letter(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); +void lade_secret_word(char* secret_word, int level, char* path); void protokoll(){ clear_screen(); @@ -268,4 +269,27 @@ char eingabe_buchstabe(){ scanf(" %c", &guess); guess = tolower(guess); return guess; +} + +void lade_secret_word(char* secret_word, int level, char* path){ + FILE *file = fopen(path, "r"); + int count = 0; + if ( file != NULL ) + { + char line[100]; /* or other suitable maximum line size */ + while (fgets(line, sizeof line, file) != NULL) /* read a line */ + { + if (count == level) + { + strcpy(secret_word, line); + secret_word[strlen(secret_word) - 1] = '\0'; + return; + } + else + { + count++; + } + } + fclose(file); + } } \ No newline at end of file From bb1c11d4e38cf26a3bf514401065ae678e001a21 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:41:49 +0100 Subject: [PATCH 022/109] =?UTF-8?q?Commit=2021=20-=20lade=20secret=5Fword?= =?UTF-8?q?=20in=20hauptspiel=20einf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 93892bb..f10ca13 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -171,9 +171,9 @@ void hauptSpiel(int level){ char path[] = "hangman_words.txt"; int result; int won = 0; - //secret_word soll vergeben werden - //secret_word soll geladen werden - //path soll erstellt werden + + lade_secret_word(secret_word, level, path); + //hangman soll gemalt werden //Buchstaben sollen gezeigt werden //Buchstaben sollen eingegeben werden können From 8d30fbee47d633b91afdd5c4cc466c548dc8952b Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:42:57 +0100 Subject: [PATCH 023/109] Commit 22 - Buchstaben sollen gezeigt werden --- src/main/c/hangman.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index f10ca13..6f4a00f 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -18,6 +18,7 @@ void draw_hangman(int attempts); void add_guessed_letter(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); +void show_letters(char secret_word[100], char guessed_letters[100]); void protokoll(){ clear_screen(); @@ -292,4 +293,13 @@ void lade_secret_word(char* secret_word, int level, char* path){ } fclose(file); } +} + +void show_letters(char secret_word[100], char guessed_letters[100]){ + printf("Erratene Buchstaben: "); + for(int i = 0; i < strlen(secret_word); i++) { + if(strchr(guessed_letters, secret_word[i])){ + printf("%c ", secret_word[i]); + } +} } \ No newline at end of file From 273fa7c4dab5aa1c4345688a60354ce9826a0571 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:43:50 +0100 Subject: [PATCH 024/109] Commit 23 - func show_letters um else Bedingung erweitern --- src/main/c/hangman.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 6f4a00f..1be3268 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -301,5 +301,9 @@ void show_letters(char secret_word[100], char guessed_letters[100]){ if(strchr(guessed_letters, secret_word[i])){ printf("%c ", secret_word[i]); } -} + else{ + printf("_ "); + } + } + printf("\n"); } \ No newline at end of file From 81eddf4ec227f1cf1a88fd1d0e79ce5530f15701 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:44:46 +0100 Subject: [PATCH 025/109] Commit 24 - func letters in secret word wird eingebaut --- src/main/c/hangman.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 1be3268..be37548 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -19,6 +19,7 @@ void add_guessed_letter(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); void show_letters(char secret_word[100], char guessed_letters[100]); +int letter_in_secret_word(char guessed_letter, char secret_word[100]); void protokoll(){ clear_screen(); @@ -306,4 +307,13 @@ void show_letters(char secret_word[100], char guessed_letters[100]){ } } printf("\n"); +} + +int letter_in_secret_word(char guessed_letter, char secret_word[100]){ + for(int i = 0; i < strlen(secret_word); i++){ + if(guessed_letter == secret_word[i]){ + return 0; + } + } + return 1; } \ No newline at end of file From f62a2d3e76f963d8eb1f68ada7824a59b6098fba Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:46:12 +0100 Subject: [PATCH 026/109] Commit 25 - hauptspiel bisweit erweitern --- src/main/c/hangman.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index be37548..25cb67d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -176,10 +176,19 @@ void hauptSpiel(int level){ lade_secret_word(secret_word, level, path); - //hangman soll gemalt werden - //Buchstaben sollen gezeigt werden - //Buchstaben sollen eingegeben werden können - //eingegeben Buchstaben sollen überprüft und dem Lösungswort hinzugefügt werden, damit Gewinn ermittelt werden kann + while (attempts < 6) { //um gewinnen erweitern + draw_hangman(attempts); + show_letters(secret_word, guessed_letters); + guessed_letter = eingabe_buchstabe(); + result = letter_in_secret_word(guessed_letter, secret_word); + if (result == 0){ + add_guessed_letter(guessed_letters, guessed_letter); + } + else { + attempts++; + } + //gewonnen erweitern + } } void draw_hangman(int attempts) { From d8b150ea5417278034955404ed54d537ed47b064 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:48:37 +0100 Subject: [PATCH 027/109] Commit 27 - gewonnen funktionalitt in hauptspiel einbinden --- src/main/c/hangman.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 25cb67d..d20711d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -20,6 +20,7 @@ char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); void show_letters(char secret_word[100], char guessed_letters[100]); int letter_in_secret_word(char guessed_letter, char secret_word[100]); +int has_won(char secret_word[100], char guessed_letters[100]); void protokoll(){ clear_screen(); @@ -176,7 +177,7 @@ void hauptSpiel(int level){ lade_secret_word(secret_word, level, path); - while (attempts < 6) { //um gewinnen erweitern + while (attempts < 6 && won == 0) { draw_hangman(attempts); show_letters(secret_word, guessed_letters); guessed_letter = eingabe_buchstabe(); @@ -187,7 +188,7 @@ void hauptSpiel(int level){ else { attempts++; } - //gewonnen erweitern + won = has_won(secret_word, guessed_letters); } } @@ -325,4 +326,20 @@ int letter_in_secret_word(char guessed_letter, char secret_word[100]){ } } return 1; +} + +int has_won(char secret_word[100], char guessed_letters[100]){ + int occured; + for (int i = 0; i < strlen(secret_word); i++){ + occured = 0; + for (int k = 0; k < strlen(guessed_letters); k++){ + if (secret_word[i] == guessed_letters[k]){ + occured = 1; + } + } + if (occured == 0){ + return 0; + } + } + return 1; } \ No newline at end of file From cfb70011a9d987c618739c73d026d79e256b4b05 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:49:35 +0100 Subject: [PATCH 028/109] Commit 28 - func level_plus einbauen --- src/main/c/hangman.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index d20711d..037c170 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -21,6 +21,7 @@ void lade_secret_word(char* secret_word, int level, char* path); void show_letters(char secret_word[100], char guessed_letters[100]); int letter_in_secret_word(char guessed_letter, char secret_word[100]); int has_won(char secret_word[100], char guessed_letters[100]); +void level_plus(); void protokoll(){ clear_screen(); @@ -342,4 +343,31 @@ int has_won(char secret_word[100], char guessed_letters[100]){ } } return 1; +} + +void level_plus(){ + char KonfDatei[100]; + char levelstr[3]; + int i = 0; + + FILE *fp = NULL; + fp = fopen("hangman.txt", "r+"); + fscanf(fp, "%s", KonfDatei); + + while(KonfDatei[i] != 0){ + i++; + } + levelstr[0] = KonfDatei[i-2]; + levelstr[1] = KonfDatei[i-1]; + levelstr[2] = '\0'; + if (levelstr[1] == '9'){ + KonfDatei[i-2]++; + KonfDatei[i-1] = '0'; + } else { + KonfDatei[i-1]++; + } + fclose(fp); + fp = fopen("hangman.txt", "w"); + fprintf(fp, "%s", KonfDatei); + fclose(fp); } \ No newline at end of file From 862ea944d09e98b63904c2a244fec8b2ba480696 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:50:31 +0100 Subject: [PATCH 029/109] Commit 29 - level_plus in Hauptspiel einbauen --- src/main/c/hangman.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 037c170..d1f72c3 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -191,6 +191,9 @@ void hauptSpiel(int level){ } won = has_won(secret_word, guessed_letters); } + if (won == 1){ + level_plus(); + } } void draw_hangman(int attempts) { From ce9fcaef3147fa6b10209556fb48251f299bdc32 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:51:31 +0100 Subject: [PATCH 030/109] Commit 30 - func Overlay einbauen & hauptspiel mit levelauswahl verbinden --- src/main/c/hangman.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index d1f72c3..2fc5f8a 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -22,6 +22,7 @@ void show_letters(char secret_word[100], char guessed_letters[100]); int letter_in_secret_word(char guessed_letter, char secret_word[100]); int has_won(char secret_word[100], char guessed_letters[100]); void level_plus(); +int overlay(); void protokoll(){ clear_screen(); @@ -39,7 +40,7 @@ void clear_screen() { void willkommen(){ char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; - + overlay(); printf("%s", ENTERtxt); getchar(); } @@ -81,7 +82,7 @@ void nameWaehlen(){ fp = fopen("hangman.txt", "w"); clear_screen(); // - + overlay(); printf("Geben Sie den Namen ein: "); scanf("%s", name); @@ -97,7 +98,7 @@ void startauswahl() { int modus; clear_screen(); // - + overlay(); printf("Willkommen "); nameAusgeben(); printf("[1] Spielen\n[2] Namen aendern\n"); @@ -150,7 +151,7 @@ void levelauswahl(){ int i = 0; clear_screen(); // - + overlay(); FILE *fp = NULL; fp = fopen("hangman.txt", "r"); @@ -163,7 +164,7 @@ void levelauswahl(){ levelstr[1] = KonfDatei[i-1]; levelstr[2] = '\0'; level = atoi(levelstr); - //hauptspiel mit dem Level starten + hauptSpiel(level); fclose(fp); } @@ -373,4 +374,25 @@ void level_plus(){ fp = fopen("hangman.txt", "w"); fprintf(fp, "%s", KonfDatei); fclose(fp); +} + +int overlay(){ + char hangmanArt[10][41] = { + " _______ ", + " | | ", + " | ", + " | ", + " | ", + " | ", + "__|_________\n" + }; + + printf("Galgenmann!\n"); + printf("v.1.0.2\n\n"); + + + for (int i = 0; i < 9; i++) { + printf("%s\n", hangmanArt[i]); + } + return 0; } \ No newline at end of file From 128bfa21d26b2a424935637176d2be39bac6d918 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:19:55 +0100 Subject: [PATCH 031/109] Importiere wichtige Bibliotheken --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/main/c/VierGewinnt.c diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c new file mode 100644 index 0000000..cf058e3 --- /dev/null +++ b/src/main/c/VierGewinnt.c @@ -0,0 +1,3 @@ +//Importiere wichtige Bibliotheken +#include +#include From 0f92499ece4dfe239b70bface7b5477d33b8f222 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:20:41 +0100 Subject: [PATCH 032/109] =?UTF-8?q?Definiere=20Feldgr=C3=B6=C3=9Fe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index cf058e3..661ea87 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -1,3 +1,7 @@ //Importiere wichtige Bibliotheken #include #include + +//Definiere Feldgröße +#define ROWS 6 +#define COLS 7 From bf61a009911977c0148c6ec6d50b14de3011355e Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:21:21 +0100 Subject: [PATCH 033/109] Definiere Farben --- src/main/c/VierGewinnt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 661ea87..5d0a497 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -5,3 +5,14 @@ //Definiere Feldgröße #define ROWS 6 #define COLS 7 + +// Definiere Farben +#define RESET_COLOR "\033[0m" +#define BLACK "\033[0;30m" +#define RED "\033[0;31m" +#define GREEN "\033[0;32m" +#define YELLOW "\033[0;33m" +#define BLUE "\033[0;34m" +#define MAGENTA "\033[0;35m" +#define CYAN "\033[0;36m" +#define WHITE "\033[0;37m" From 107475af8f4a011a6093d1d55cbbac77ab42f1d9 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:22:18 +0100 Subject: [PATCH 034/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20initiali?= =?UTF-8?q?zeBoard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 5d0a497..d07efff 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -16,3 +16,7 @@ #define MAGENTA "\033[0;35m" #define CYAN "\033[0;36m" #define WHITE "\033[0;37m" + + +//Funktionsprototyp für initializeBoard +void initializeBoard(char board[ROWS][COLS]); From 7fe15fcedca072ba8e556e196c8351fc3d023198 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:23:13 +0100 Subject: [PATCH 035/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20printBoa?= =?UTF-8?q?rd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index d07efff..5a6ddb2 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -20,3 +20,6 @@ //Funktionsprototyp für initializeBoard void initializeBoard(char board[ROWS][COLS]); + +//Funktionsprototyp für printBoard +void printBoard(char board[ROWS][COLS]); From 99373604d53b7ee0b9ada1fad7fb325c05120ee8 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:24:00 +0100 Subject: [PATCH 036/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20clearScr?= =?UTF-8?q?een?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 5a6ddb2..e4a5031 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -23,3 +23,6 @@ void initializeBoard(char board[ROWS][COLS]); //Funktionsprototyp für printBoard void printBoard(char board[ROWS][COLS]); + +// Funktionsprototyp für clearScreen +void clearScreen(); From f166bb60ff691bf47508fd569f667c07707c78ee Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:24:55 +0100 Subject: [PATCH 037/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20isColumn?= =?UTF-8?q?Full?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index e4a5031..bc8d922 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -26,3 +26,6 @@ void printBoard(char board[ROWS][COLS]); // Funktionsprototyp für clearScreen void clearScreen(); + +//Funktionsprototyp für isColumnFull +int isColumnFull(char board[ROWS][COLS], int col); From 4898e38878c5b0ab2aa8a6e0a3b150a48a2903bf Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:25:38 +0100 Subject: [PATCH 038/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20dropPiec?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index bc8d922..edcbe34 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -29,3 +29,7 @@ void clearScreen(); //Funktionsprototyp für isColumnFull int isColumnFull(char board[ROWS][COLS], int col); + +//Funktionsprototyp für dropPiece +int dropPiece(char board[ROWS][COLS], int col, char player); + From 399950a81b1e3632825e3bc19b761dcc349f0fd4 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:26:24 +0100 Subject: [PATCH 039/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20checkWin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index edcbe34..7139b27 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -32,4 +32,6 @@ int isColumnFull(char board[ROWS][COLS], int col); //Funktionsprototyp für dropPiece int dropPiece(char board[ROWS][COLS], int col, char player); +//Funktionsprototyp für checkWin +int checkWin(char board[ROWS][COLS], char player); From 8cd86a70242fde344826d673093bd2757905737a Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:27:10 +0100 Subject: [PATCH 040/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20checkHor?= =?UTF-8?q?izontal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 7139b27..3e60a29 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -34,4 +34,6 @@ int isColumnFull(char board[ROWS][COLS], int col); int dropPiece(char board[ROWS][COLS], int col, char player); //Funktionsprototyp für checkWin int checkWin(char board[ROWS][COLS], char player); +// Funktionsprototyp für checkHorizontal +int checkHorizontal(char board[ROWS][COLS], char player); From 9f9046af94507448f70496949d08a7670c128296 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:27:57 +0100 Subject: [PATCH 041/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20checkVer?= =?UTF-8?q?tical?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 3e60a29..dcb003d 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -37,3 +37,6 @@ int checkWin(char board[ROWS][COLS], char player); // Funktionsprototyp für checkHorizontal int checkHorizontal(char board[ROWS][COLS], char player); +// Funktionsprototyp für checkVertical +int checkVertical(char board[ROWS][COLS], char player); + From f3f300a91694b7abd02ff62442ab8a0248d1b312 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:29:00 +0100 Subject: [PATCH 042/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20checkDia?= =?UTF-8?q?gonalLR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index dcb003d..939c436 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -40,3 +40,6 @@ int checkHorizontal(char board[ROWS][COLS], char player); // Funktionsprototyp für checkVertical int checkVertical(char board[ROWS][COLS], char player); +// Funktionsprototyp für checkDiagonalLR +int checkDiagonalLR(char board[ROWS][COLS], char player); + From 1b3477fd2da316cfc538f874be2f5c90ef0d1709 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:30:22 +0100 Subject: [PATCH 043/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20checkDia?= =?UTF-8?q?gonalRL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 939c436..77795f7 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -43,3 +43,6 @@ int checkVertical(char board[ROWS][COLS], char player); // Funktionsprototyp für checkDiagonalLR int checkDiagonalLR(char board[ROWS][COLS], char player); +// Funktionsprototyp für checkDiagonalRL +int checkDiagonalRL(char board[ROWS][COLS], char player); + From 1e33053766e4e1d671672b625dde2147b9d0e979 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:31:02 +0100 Subject: [PATCH 044/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20showMess?= =?UTF-8?q?age?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 77795f7..4fdd8c3 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -46,3 +46,6 @@ int checkDiagonalLR(char board[ROWS][COLS], char player); // Funktionsprototyp für checkDiagonalRL int checkDiagonalRL(char board[ROWS][COLS], char player); +// Funktionsprototyp für showMessage +void showMessage(const char* messageColor, const char* message); + From 20b97fe1eaf62fc9c3a2c06d31a34b0e741a1f75 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:31:44 +0100 Subject: [PATCH 045/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20showInva?= =?UTF-8?q?lidInputMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 4fdd8c3..2a68a6e 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -48,4 +48,5 @@ int checkDiagonalRL(char board[ROWS][COLS], char player); // Funktionsprototyp für showMessage void showMessage(const char* messageColor, const char* message); - +//Funktionsprototyp für showInvalidInputMessage +void showInvalidInputMessage(); From 04ca12eff98fcff5aeae8a1616c259dbc71c7ed3 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:32:48 +0100 Subject: [PATCH 046/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20showColu?= =?UTF-8?q?mnFullMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 2a68a6e..f77c5da 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -50,3 +50,6 @@ int checkDiagonalRL(char board[ROWS][COLS], char player); void showMessage(const char* messageColor, const char* message); //Funktionsprototyp für showInvalidInputMessage void showInvalidInputMessage(); + +//Funktionsprototyp für showColumnFullMessage +void showColumnFullMessage(); From fd012eff4f61d664856afb9cd3e983085915d300 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:33:37 +0100 Subject: [PATCH 047/109] =?UTF-8?q?Funktionsprototyp=20f=C3=BCr=20showWinM?= =?UTF-8?q?essage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index f77c5da..b1b9d51 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -53,3 +53,6 @@ void showInvalidInputMessage(); //Funktionsprototyp für showColumnFullMessage void showColumnFullMessage(); + +//Funktionsprototyp für showWinMessage +void showWinMessage(int player); From 1b57cd1dba5593247014c405ff77c7385a4cb26f Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:34:40 +0100 Subject: [PATCH 048/109] Write starter function --- src/main/c/VierGewinnt.c | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index b1b9d51..9108a58 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -56,3 +56,44 @@ void showColumnFullMessage(); //Funktionsprototyp für showWinMessage void showWinMessage(int player); + + +//Write starter function +int main_function() { + char board[ROWS][COLS]; + int currentPlayer = 1; // Spieler 1 beginnt + + initializeBoard(board); + printBoard(board); + + int column; + while (1) { + printf(YELLOW"Spieler %d, wähle eine Spalte (1-7): "RESET_COLOR, currentPlayer); + + scanf("%d", &column); + if (column < 1 || column > 7) { + showInvalidInputMessage(); + continue; + } + + column--; + + if (isColumnFull(board, column)) { + showColumnFullMessage(); + continue; + } + + if (dropPiece(board, column, (currentPlayer == 1) ? 'X' : 'O')) { + printBoard(board); + if (checkWin(board, (currentPlayer == 1) ? 'X' : 'O')) { + showWinMessage(currentPlayer); + break; + } + + currentPlayer = (currentPlayer == 1) ? 2 : 1; + } + } + + return 0; +} + From e5a065d12a668302ed7c0b3c214d8b77637e1cb5 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:35:23 +0100 Subject: [PATCH 049/109] Write initializeBoard function --- src/main/c/VierGewinnt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 9108a58..0b7b0c1 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -96,4 +96,11 @@ int main_function() { return 0; } - +// Write initializeBoard function +void initializeBoard(char board[ROWS][COLS]) { + for (int i = 0; i < ROWS; i++) { + for (int j = 0; j < COLS; j++) { + board[i][j] = ' '; + } + } +} From 177bf0211d8eb297697dbfb6c3b3fa79bf90b905 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:36:25 +0100 Subject: [PATCH 050/109] Write printBoard function --- src/main/c/VierGewinnt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 0b7b0c1..7fde45c 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -104,3 +104,25 @@ void initializeBoard(char board[ROWS][COLS]) { } } } + + +// Write printBoard function +void printBoard(char board[ROWS][COLS]) { + clearScreen(); + printf("\n"); + + for (int i = 0; i < ROWS; i++) { + for (int j = 0; j < COLS; j++) { + printf("| %c ", board[i][j]); + } + printf("|\n"); + + for (int j = 0; j < COLS; j++) { + printf("----"); + } + printf("-\n"); + } + + printf(" 1 2 3 4 5 6 7\n\n"); +} + From e5e445ec0faa798ee505f7bcf35986a3b5f4785f Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:37:13 +0100 Subject: [PATCH 051/109] Write clearScreen function --- src/main/c/VierGewinnt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 7fde45c..043054e 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -125,4 +125,11 @@ void printBoard(char board[ROWS][COLS]) { printf(" 1 2 3 4 5 6 7\n\n"); } - +// Write clearScreen function +void clearScreen() { +#ifdef _WIN32 + system("cls"); +#else + system("clear"); +#endif +} From 7640258c05046740d35146998eeed2a8e3a883d7 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:37:48 +0100 Subject: [PATCH 052/109] Write isColumnFull function --- src/main/c/VierGewinnt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 043054e..000a60e 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -133,3 +133,8 @@ void clearScreen() { system("clear"); #endif } + +// Write isColumnFull function +int isColumnFull(char board[ROWS][COLS], int col) { + return (board[0][col] != ' '); +} From d796abbae3c3c296f25aaebe3d027a76fa341241 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:38:30 +0100 Subject: [PATCH 053/109] Write dropPiece function --- src/main/c/VierGewinnt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 000a60e..5959d98 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -138,3 +138,15 @@ void clearScreen() { int isColumnFull(char board[ROWS][COLS], int col) { return (board[0][col] != ' '); } + +//Write dropPiece function +int dropPiece(char board[ROWS][COLS], int col, char player) { + for (int i = ROWS - 1; i >= 0; i--) { + if (board[i][col] == ' ') { + board[i][col] = player; + return 1; + } + } + + return 0; // Column is full +} From 1e1e37b79180d2a17a6759aa9d6b2daae9542e04 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:39:09 +0100 Subject: [PATCH 054/109] Write checkHorizontal function --- src/main/c/VierGewinnt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 5959d98..2ae4fc6 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -150,3 +150,19 @@ int dropPiece(char board[ROWS][COLS], int col, char player) { return 0; // Column is full } + + +// Write checkHorizontal function +int checkHorizontal(char board[ROWS][COLS], char player) { + for (int row = 0; row < ROWS; row++) { + for (int col = 0; col <= COLS - 4; col++) { + if (board[row][col] == player && + board[row][col + 1] == player && + board[row][col + 2] == player && + board[row][col + 3] == player) { + return 1; // Gewonnen + } + } + } + return 0; +} From 46f3cb93c69cfc7630e1ce3d8ce7fdf998a3af96 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:39:53 +0100 Subject: [PATCH 055/109] Write checkVertical function --- src/main/c/VierGewinnt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 2ae4fc6..9bcbac0 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -166,3 +166,18 @@ int checkHorizontal(char board[ROWS][COLS], char player) { } return 0; } + +//Write checkVertical function +int checkVertical(char board[ROWS][COLS], char player) { + for (int col = 0; col < COLS; col++) { + for (int row = 0; row <= ROWS - 4; row++) { + if (board[row][col] == player && + board[row + 1][col] == player && + board[row + 2][col] == player && + board[row + 3][col] == player) { + return 1; // Gewonnen + } + } + } + return 0; +} From 234b2bf10390c9fe6477f39d423d9ec6f514d46e Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:40:29 +0100 Subject: [PATCH 056/109] Write checkDiagonalLR function --- src/main/c/VierGewinnt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 9bcbac0..fd18639 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -181,3 +181,27 @@ int checkVertical(char board[ROWS][COLS], char player) { } return 0; } + + + +// Write checkDiagonalLR function +int checkDiagonalLR(char board[ROWS][COLS], char player) { + for (int row = 0; row <= ROWS - 4; row++) { + for (int col = 0; col <= COLS - 4; col++) { + if (board[row][col] == player && + board[row + 1][col + 1] == player && + board[row + 2][col + 2] == player && + board[row + 3][col + 3] == player) { + return 1; // Gewonnen + } + } + } + return 0; +} + + + + + + + From 79e09720038332773849c206aafa833cc0e33bd7 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:41:14 +0100 Subject: [PATCH 057/109] Write checkDiagonalRL function --- src/main/c/VierGewinnt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index fd18639..d54a6bf 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -202,6 +202,21 @@ int checkDiagonalLR(char board[ROWS][COLS], char player) { +// Write checkDiagonalRL function +int checkDiagonalRL(char board[ROWS][COLS], char player) { + for (int row = 0; row <= ROWS - 4; row++) { + for (int col = 3; col < COLS; col++) { + if (board[row][col] == player && + board[row + 1][col - 1] == player && + board[row + 2][col - 2] == player && + board[row + 3][col - 3] == player) { + return 1; // Gewonnen + } + } + } + return 0; +} + From 095a9188c2b00c5e2ee91467825ce66a1e5ed21c Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:41:49 +0100 Subject: [PATCH 058/109] Write checkWin function --- src/main/c/VierGewinnt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index d54a6bf..13b8674 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -215,6 +215,15 @@ int checkDiagonalRL(char board[ROWS][COLS], char player) { } } return 0; + +} + +// Write checkWin function +int checkWin(char board[ROWS][COLS], char player) { + return checkHorizontal(board, player) || + checkVertical(board, player) || + checkDiagonalLR(board, player) || + checkDiagonalRL(board, player); } From 20a83ac492fcc3713cc32cab71db4a3ef29059ea Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:42:23 +0100 Subject: [PATCH 059/109] Write showMessage function --- src/main/c/VierGewinnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 13b8674..a1e92e3 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -227,5 +227,8 @@ int checkWin(char board[ROWS][COLS], char player) { } - +// Write showMessage function +void showMessage(const char* messageColor, const char* message) { + printf("%s%s"RESET_COLOR, messageColor, message); +} From 949cce4dc8ca1f0807bbd3d97af74c147ca815ec Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:43:04 +0100 Subject: [PATCH 060/109] Write showInvalidInputMessage function --- src/main/c/VierGewinnt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index a1e92e3..d9261e8 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -232,3 +232,7 @@ void showMessage(const char* messageColor, const char* message) { printf("%s%s"RESET_COLOR, messageColor, message); } +// Write showInvalidInputMessage function +void showInvalidInputMessage() { + showMessage(RED, "Ungültige Eingabe. Bitte wähle eine Spalte zwischen 1 und 7.\n"); +} From b3e4f6284788eb82c518a1d69708c9dce06c4d3b Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:43:42 +0100 Subject: [PATCH 061/109] Write showColumnFullMessage function --- src/main/c/VierGewinnt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index d9261e8..37d49cc 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -236,3 +236,14 @@ void showMessage(const char* messageColor, const char* message) { void showInvalidInputMessage() { showMessage(RED, "Ungültige Eingabe. Bitte wähle eine Spalte zwischen 1 und 7.\n"); } + + + + +// Write showColumnFullMessage function +void showColumnFullMessage() { + showMessage(RED, "Die Spalte ist voll. Bitte wähle eine andere.\n"); +} + + + From 8cf7073811eabff1b121d9b5e4dc0ca455fa2237 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:44:31 +0100 Subject: [PATCH 062/109] Write showWinMessage function} --- src/main/c/VierGewinnt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 37d49cc..c4d1419 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -247,3 +247,10 @@ void showColumnFullMessage() { +// Write showWinMessage function +void showWinMessage(int player) { + printf("Spieler %d hat gewonnen!\n", player); +} + + + From d7ea58f33a9145995d6b7e63e418759a63029313 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:46:40 +0100 Subject: [PATCH 063/109] add constants --- src/main/c/VierGewinnt.h | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/c/VierGewinnt.h diff --git a/src/main/c/VierGewinnt.h b/src/main/c/VierGewinnt.h new file mode 100644 index 0000000..6ec2043 --- /dev/null +++ b/src/main/c/VierGewinnt.h @@ -0,0 +1,5 @@ +#ifndef VIERGEWINNT_H +#define VIERGEWINNT_H + +#define ROWS 6 +#define COLS 7 From 4b61913ed74468c25733390daf6f5b2dc4a15542 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:47:16 +0100 Subject: [PATCH 064/109] define function --- src/main/c/VierGewinnt.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/c/VierGewinnt.h b/src/main/c/VierGewinnt.h index 6ec2043..a52d6cd 100644 --- a/src/main/c/VierGewinnt.h +++ b/src/main/c/VierGewinnt.h @@ -3,3 +3,17 @@ #define ROWS 6 #define COLS 7 + +void initializeBoard(char board[ROWS][COLS]); +void printBoard(char board[ROWS][COLS]); +int isColumnFull(char board[ROWS][COLS], int col); +int dropPiece(char board[ROWS][COLS], int col, char player); +int checkWin(char board[ROWS][COLS], char player); +int checkHorizontal(char board[ROWS][COLS], char player); +int checkVertical(char board[ROWS][COLS], char player); +int checkDiagonalLR(char board[ROWS][COLS], char player); +int checkDiagonalRL(char board[ROWS][COLS], char player); +void showMessage(const char* messageColor, const char* message); +void showInvalidInputMessage(); +void showColumnFullMessage(); +void showWinMessage(int player); From 7dd63bde307f30f32a705194115fcd611bb1c517 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:47:52 +0100 Subject: [PATCH 065/109] define function --- src/main/c/VierGewinnt.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/VierGewinnt.h b/src/main/c/VierGewinnt.h index a52d6cd..689034c 100644 --- a/src/main/c/VierGewinnt.h +++ b/src/main/c/VierGewinnt.h @@ -17,3 +17,4 @@ void showMessage(const char* messageColor, const char* message); void showInvalidInputMessage(); void showColumnFullMessage(); void showWinMessage(int player); +#endif From 7292f053a2be6851c30652da4819c29655afdba5 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:55:52 +0100 Subject: [PATCH 066/109] test_dropPiece_ValidMove --- src/test/c/test_VierGewinnt.c | 17 +++++++++++++++++ src/test/c/test_test.c | 28 ---------------------------- 2 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 src/test/c/test_VierGewinnt.c delete mode 100644 src/test/c/test_test.c diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c new file mode 100644 index 0000000..4690b45 --- /dev/null +++ b/src/test/c/test_VierGewinnt.c @@ -0,0 +1,17 @@ +#include "unity.h" +#include "VierGewinnt.h" + +void setUp(void) { +} + +void tearDown(void) { +} + + +void test_dropPiece_ValidMove(void) { + char board[6][7]; + initializeBoard(board); + + TEST_ASSERT_EQUAL_INT(1, dropPiece(board, 3, 'X')); +} + diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c deleted file mode 100644 index 4f61ea7..0000000 --- a/src/test/c/test_test.c +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef TEST - -#include "unity.h" - -#include "test.h" - -void setUp(void) -{ -} - -void tearDown(void) -{ -} - -void test_test__return_5(void) -{ - /* arrange */ - int expected = 5; - int actual; - - /* act */ - actual = return_5(); - - /* assert */ - TEST_ASSERT_EQUAL_INT(expected, actual); -} - -#endif // TEST From 2824ad7a74355cb1b245558ab4d2691b3a2a2fc7 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:57:30 +0100 Subject: [PATCH 067/109] test_dropPiece_FullColum --- src/test/c/test_VierGewinnt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 4690b45..91bfaff 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -15,3 +15,16 @@ void test_dropPiece_ValidMove(void) { TEST_ASSERT_EQUAL_INT(1, dropPiece(board, 3, 'X')); } + +void test_dropPiece_FullColumn(void) { + char board[6][7] = { + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'} + }; + + TEST_ASSERT_EQUAL_INT(0, dropPiece(board, 3, 'X')); // Spalte ist voll, sollte 0 zurückgeben +} From 0b85b5496c1c8ad4f189b39e27223e6d253fb0a3 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:59:00 +0100 Subject: [PATCH 068/109] test_checkWin_Horizontal_X --- src/test/c/test_VierGewinnt.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 91bfaff..8ad593b 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -28,3 +28,38 @@ void test_dropPiece_FullColumn(void) { TEST_ASSERT_EQUAL_INT(0, dropPiece(board, 3, 'X')); // Spalte ist voll, sollte 0 zurückgeben } + + +void test_checkWin_Horizontal_X(void) { + char board[6][7] = { + {'X', 'X', ' ', ' ', ' ', ' ', ' '}, + {'O', 'O', 'O', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', 'X', 'X', 'X', 'X', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '} + }; + + TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'X')); // Horizontale Gewinnsituation für 'X' +} + + + + + + + + + + + + + + + + + + + + + From 389ca705ed111104f02495bb9145727ff6bad3f4 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:00:24 +0100 Subject: [PATCH 069/109] test_checkWin_Horizontal_O --- src/test/c/test_VierGewinnt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 8ad593b..f487364 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -43,7 +43,18 @@ void test_checkWin_Horizontal_X(void) { TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'X')); // Horizontale Gewinnsituation für 'X' } +void test_checkWin_Horizontal_O(void) { + char board[6][7] = { + {'X', 'X', ' ', ' ', ' ', ' ', ' '}, + {'O', 'O', 'O', 'O', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', 'X', 'X', ' ', 'X', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '} + }; + TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'O')); // Horizontale Gewinnsituation für 'X' +} From 3209502194d434c378be157aadc21d6e23703811 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:02:32 +0100 Subject: [PATCH 070/109] test_checkWin_Diagonal_X --- src/test/c/test_VierGewinnt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index f487364..73f89e0 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -56,6 +56,19 @@ void test_checkWin_Horizontal_O(void) { TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'O')); // Horizontale Gewinnsituation für 'X' } +void test_checkWin_Diagonal_X(void) { + char board[6][7] = { + {'X', 'X', ' ', ' ', ' ', ' ', ' '}, + {'O', 'O', 'O', 'X', ' ', ' ', ' '}, + {' ', 'X', ' ', ' ', ' ', ' ', ' '}, + {' ', 'X', 'X', 'X', 'X', ' ', ' '}, + {' ', ' ', ' ','X', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', 'X', ' '} + }; + + TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'X')); // Horizontale Gewinnsituation für 'X' +} + From fe1df3e2224f7c86bdbc02576a17661fc9cbf3da Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:04:02 +0100 Subject: [PATCH 071/109] test_checkWin_Diagonal_O --- src/test/c/test_VierGewinnt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 73f89e0..9681ea7 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -73,7 +73,18 @@ void test_checkWin_Diagonal_X(void) { +void test_checkWin_Diagonal_O(void) { + char board[6][7] = { + {'X', 'X', ' ', ' ', ' ', ' ', ' '}, + {'O', 'O', 'O', 'X', ' ', ' ', ' '}, + {' ', 'O', ' ', ' ', ' ', ' ', ' '}, + {' ', 'X', 'O', 'X', 'X', ' ', ' '}, + {' ', ' ', ' ','O', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', 'X', ' '} + }; + TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'O')); // Horizontale Gewinnsituation für 'X' +} From 8fa684587d69292a79be5d69aa0f03d20811e156 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:05:34 +0100 Subject: [PATCH 072/109] test_checkWin_Vertical_X --- src/test/c/test_VierGewinnt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 9681ea7..6896efe 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -92,7 +92,18 @@ void test_checkWin_Diagonal_O(void) { +void test_checkWin_Vertical_X(void) { + char board[6][7] = { + {'X', 'O', ' ', ' ', ' ', ' ', ' '}, + {'X', 'O', ' ', ' ', ' ', ' ', ' '}, + {'X', 'O', ' ', ' ', ' ', ' ', ' '}, + {'X', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '} + }; + TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'X')); // Vertikale Gewinnsituation für 'X' +} From 00da72c029afbda55cd5631e055d797bb16a7ff2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:07:26 +0100 Subject: [PATCH 073/109] test_checkWin_Vertical_O --- src/test/c/test_VierGewinnt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 6896efe..6569d15 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -107,5 +107,16 @@ void test_checkWin_Vertical_X(void) { +void test_checkWin_Vertical_O(void) { + char board[6][7] = { + {'X', 'O', ' ', ' ', ' ', ' ', ' '}, + {'X', 'O', ' ', ' ', ' ', ' ', ' '}, + {'X', 'O', ' ', ' ', ' ', ' ', ' '}, + {' ', 'O', ' ', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '}, + {' ', ' ', ' ', ' ', ' ', ' ', ' '} + }; + TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'O')); // Vertikale Gewinnsituation für 'X' +} From 30327565fe7dc0ac2eb2463d9e9db1693f8c7061 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:12:14 +0100 Subject: [PATCH 074/109] test_checkWin_NoWinner --- src/test/c/test_VierGewinnt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index 6569d15..efe7a13 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -119,4 +119,19 @@ void test_checkWin_Vertical_O(void) { TEST_ASSERT_EQUAL_INT(1, checkWin(board, 'O')); // Vertikale Gewinnsituation für 'X' } +void test_checkWin_NoWinner(void) { +char board[6][7] = { + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'} + }; + + + + TEST_ASSERT_EQUAL_INT(0, checkWin(board, 'X')); // Kein Gewinner, horizontale Reihe ist voll + TEST_ASSERT_EQUAL_INT(0, checkWin(board, 'O')); // Kein Gewinner, horizontale Reihe ist voll +} From b9c75e4a231b8a8e291434c72a4cb8d19ffe6a05 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:44:41 +0100 Subject: [PATCH 075/109] refactoring: attempts --> versuche --- src/main/c/hangman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 2fc5f8a..03667c1 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -14,7 +14,7 @@ void startauswahl(); void nameAusgeben(); void levelauswahl(); void hauptSpiel(int level); -void draw_hangman(int attempts); +void draw_hangman(int versuche); void add_guessed_letter(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); From 8c500778398edaf2cbbd1e7a6151ec66925caf00 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:45:04 +0100 Subject: [PATCH 076/109] refactoring: attempts --> versuche --- src/main/c/hangman.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 03667c1..ad7a86f 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -170,7 +170,7 @@ void levelauswahl(){ void hauptSpiel(int level){ char secret_word[100]; - int attempts = 0; + int versuche = 0; char guessed_letter; char guessed_letters[100]; char path[] = "hangman_words.txt"; @@ -179,8 +179,8 @@ void hauptSpiel(int level){ lade_secret_word(secret_word, level, path); - while (attempts < 6 && won == 0) { - draw_hangman(attempts); + while (versuche < 6 && won == 0) { + draw_hangman(versuche); show_letters(secret_word, guessed_letters); guessed_letter = eingabe_buchstabe(); result = letter_in_secret_word(guessed_letter, secret_word); @@ -188,7 +188,7 @@ void hauptSpiel(int level){ add_guessed_letter(guessed_letters, guessed_letter); } else { - attempts++; + versuche++; } won = has_won(secret_word, guessed_letters); } @@ -197,12 +197,12 @@ void hauptSpiel(int level){ } } -void draw_hangman(int attempts) { +void draw_hangman(int versuche) { clear_screen(); printf("Galgenmann!\n"); printf("v.1.0.2\n\n"); - switch(attempts) { + switch(versuche) { case 0: printf(" _______\n"); printf(" | |\n"); From 2a1e0f356ba97f57e427c2d3b3ff22616a7b3b07 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:46:41 +0100 Subject: [PATCH 077/109] refactoring: draw_hangman --> zeichne_galgen --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index ad7a86f..b5fb04c 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -14,7 +14,7 @@ void startauswahl(); void nameAusgeben(); void levelauswahl(); void hauptSpiel(int level); -void draw_hangman(int versuche); +void zeichne_galgen(int versuche); void add_guessed_letter(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); @@ -180,7 +180,7 @@ void hauptSpiel(int level){ lade_secret_word(secret_word, level, path); while (versuche < 6 && won == 0) { - draw_hangman(versuche); + zeichne_galgen(versuche); show_letters(secret_word, guessed_letters); guessed_letter = eingabe_buchstabe(); result = letter_in_secret_word(guessed_letter, secret_word); @@ -197,7 +197,7 @@ void hauptSpiel(int level){ } } -void draw_hangman(int versuche) { +void zeichne_galgen(int versuche) { clear_screen(); printf("Galgenmann!\n"); printf("v.1.0.2\n\n"); From d462e29b615a12b70d51e70ec65fd8a738845a38 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:48:36 +0100 Subject: [PATCH 078/109] refactoring: add_guessed_letter --> erratene_buchstaben_hinzufuegen --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index b5fb04c..62fc135 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -15,7 +15,7 @@ void nameAusgeben(); void levelauswahl(); void hauptSpiel(int level); void zeichne_galgen(int versuche); -void add_guessed_letter(char* guessed_letters, char guessed_letter); +void erratenen_buchstaben_hinzufuegen(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void lade_secret_word(char* secret_word, int level, char* path); void show_letters(char secret_word[100], char guessed_letters[100]); @@ -185,7 +185,7 @@ void hauptSpiel(int level){ guessed_letter = eingabe_buchstabe(); result = letter_in_secret_word(guessed_letter, secret_word); if (result == 0){ - add_guessed_letter(guessed_letters, guessed_letter); + erratenen_buchstaben_hinzufuegen(guessed_letters, guessed_letter); } else { versuche++; @@ -271,7 +271,7 @@ void zeichne_galgen(int versuche) { } } -void add_guessed_letter(char* guessed_letters, char guessed_letter){ +void erratenen_buchstaben_hinzufuegen(char* guessed_letters, char guessed_letter){ for (int i = 0; i < strlen(guessed_letters); i++){ if (guessed_letters[i] == guessed_letter){ return; From 745e22138d0967dbcd65de5731457b681107129f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:50:24 +0100 Subject: [PATCH 079/109] refactoring: load_secret_word --> hole_zu_erratendes_wort --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 62fc135..b558f02 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -17,7 +17,7 @@ void hauptSpiel(int level); void zeichne_galgen(int versuche); void erratenen_buchstaben_hinzufuegen(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); -void lade_secret_word(char* secret_word, int level, char* path); +void hole_zu_erratendes_wort(char* secret_word, int level, char* path); void show_letters(char secret_word[100], char guessed_letters[100]); int letter_in_secret_word(char guessed_letter, char secret_word[100]); int has_won(char secret_word[100], char guessed_letters[100]); @@ -177,7 +177,7 @@ void hauptSpiel(int level){ int result; int won = 0; - lade_secret_word(secret_word, level, path); + hole_zu_erratendes_wort(secret_word, level, path); while (versuche < 6 && won == 0) { zeichne_galgen(versuche); @@ -288,7 +288,7 @@ char eingabe_buchstabe(){ return guess; } -void lade_secret_word(char* secret_word, int level, char* path){ +void hole_zu_erratendes_wort(char* secret_word, int level, char* path){ FILE *file = fopen(path, "r"); int count = 0; if ( file != NULL ) From 416d01bce77f02f895ed86f9396248bc1149d8ab Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:51:33 +0100 Subject: [PATCH 080/109] refactoring: show_letters --> zeige_Buchstabenfeld --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index b558f02..81d746d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -18,7 +18,7 @@ void zeichne_galgen(int versuche); void erratenen_buchstaben_hinzufuegen(char* guessed_letters, char guessed_letter); char eingabe_buchstabe(); void hole_zu_erratendes_wort(char* secret_word, int level, char* path); -void show_letters(char secret_word[100], char guessed_letters[100]); +void zeige_Buchstabenfeld(char secret_word[100], char guessed_letters[100]); int letter_in_secret_word(char guessed_letter, char secret_word[100]); int has_won(char secret_word[100], char guessed_letters[100]); void level_plus(); @@ -181,7 +181,7 @@ void hauptSpiel(int level){ while (versuche < 6 && won == 0) { zeichne_galgen(versuche); - show_letters(secret_word, guessed_letters); + zeige_Buchstabenfeld(secret_word, guessed_letters); guessed_letter = eingabe_buchstabe(); result = letter_in_secret_word(guessed_letter, secret_word); if (result == 0){ @@ -311,7 +311,7 @@ void hole_zu_erratendes_wort(char* secret_word, int level, char* path){ } } -void show_letters(char secret_word[100], char guessed_letters[100]){ +void zeige_Buchstabenfeld(char secret_word[100], char guessed_letters[100]){ printf("Erratene Buchstaben: "); for(int i = 0; i < strlen(secret_word); i++) { if(strchr(guessed_letters, secret_word[i])){ From 936934f3b9f2f408073b1b8fee94b2499544f4e6 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:53:07 +0100 Subject: [PATCH 081/109] refactoring: letter_in_secret_word --> Buchstabe_im_zu_erratenden_wort --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 81d746d..bc7d492 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -19,7 +19,7 @@ void erratenen_buchstaben_hinzufuegen(char* guessed_letters, char guessed_letter char eingabe_buchstabe(); void hole_zu_erratendes_wort(char* secret_word, int level, char* path); void zeige_Buchstabenfeld(char secret_word[100], char guessed_letters[100]); -int letter_in_secret_word(char guessed_letter, char secret_word[100]); +int buchstabe_im_zu_erratenden_wort(char guessed_letter, char secret_word[100]); int has_won(char secret_word[100], char guessed_letters[100]); void level_plus(); int overlay(); @@ -183,7 +183,7 @@ void hauptSpiel(int level){ zeichne_galgen(versuche); zeige_Buchstabenfeld(secret_word, guessed_letters); guessed_letter = eingabe_buchstabe(); - result = letter_in_secret_word(guessed_letter, secret_word); + result = buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); if (result == 0){ erratenen_buchstaben_hinzufuegen(guessed_letters, guessed_letter); } @@ -324,7 +324,7 @@ void zeige_Buchstabenfeld(char secret_word[100], char guessed_letters[100]){ printf("\n"); } -int letter_in_secret_word(char guessed_letter, char secret_word[100]){ +int buchstabe_im_zu_erratenden_wort(char guessed_letter, char secret_word[100]){ for(int i = 0; i < strlen(secret_word); i++){ if(guessed_letter == secret_word[i]){ return 0; From a292fb10619856bf493998aa1dd6228bbd424a97 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:54:13 +0100 Subject: [PATCH 082/109] refactoring: has_won --> gewonnen --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index bc7d492..4b54af8 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -20,7 +20,7 @@ char eingabe_buchstabe(); void hole_zu_erratendes_wort(char* secret_word, int level, char* path); void zeige_Buchstabenfeld(char secret_word[100], char guessed_letters[100]); int buchstabe_im_zu_erratenden_wort(char guessed_letter, char secret_word[100]); -int has_won(char secret_word[100], char guessed_letters[100]); +int gewonnen(char secret_word[100], char guessed_letters[100]); void level_plus(); int overlay(); @@ -190,7 +190,7 @@ void hauptSpiel(int level){ else { versuche++; } - won = has_won(secret_word, guessed_letters); + won = gewonnen(secret_word, guessed_letters); } if (won == 1){ level_plus(); @@ -333,7 +333,7 @@ int buchstabe_im_zu_erratenden_wort(char guessed_letter, char secret_word[100]){ return 1; } -int has_won(char secret_word[100], char guessed_letters[100]){ +int gewonnen(char secret_word[100], char guessed_letters[100]){ int occured; for (int i = 0; i < strlen(secret_word); i++){ occured = 0; From a0de73329667ea7211ad149056d7b42744132ef9 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:56:20 +0100 Subject: [PATCH 083/109] refactoring: nameAusgeben nullt --> nullterminante --- src/main/c/hangman.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 4b54af8..1d490a4 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -118,7 +118,7 @@ void nameAusgeben(){ char name[50]; int i = 5; int zaehler = 0; - int nullt; + int nullterminante; FILE *fp = NULL; fp = fopen("hangman.txt", "r"); @@ -128,7 +128,7 @@ void nameAusgeben(){ zaehler++; i++; } - nullt = zaehler; + nullterminante = zaehler; while(zaehler != 0){ name[--zaehler] = KonfDatei[--i]; } @@ -138,7 +138,7 @@ void nameAusgeben(){ i++; } - name[nullt] = '\0'; + name[nullterminante] = '\0'; printf("%s\n", name); fclose(fp); From 34e44fbcbd3c0fb6871d95bb102013d00ec74b4b Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:05:23 +0100 Subject: [PATCH 084/109] refactoring: level --- src/main/c/hangman.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 1d490a4..41bfcda 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -351,7 +351,7 @@ int gewonnen(char secret_word[100], char guessed_letters[100]){ void level_plus(){ char KonfDatei[100]; - char levelstr[3]; + char level[3]; int i = 0; FILE *fp = NULL; @@ -361,10 +361,10 @@ void level_plus(){ while(KonfDatei[i] != 0){ i++; } - levelstr[0] = KonfDatei[i-2]; - levelstr[1] = KonfDatei[i-1]; - levelstr[2] = '\0'; - if (levelstr[1] == '9'){ + level[0] = KonfDatei[i-2]; + level[1] = KonfDatei[i-1]; + level[2] = '\0'; + if (level[1] == '9'){ KonfDatei[i-2]++; KonfDatei[i-1] = '0'; } else { From b054a28ae875235457bea447b862f600952a0f22 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:06:15 +0100 Subject: [PATCH 085/109] refactoring: galgen_overlay --- src/main/c/hangman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 41bfcda..014302c 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -377,7 +377,7 @@ void level_plus(){ } int overlay(){ - char hangmanArt[10][41] = { + char galgen_overlay[10][41] = { " _______ ", " | | ", " | ", @@ -392,7 +392,7 @@ int overlay(){ for (int i = 0; i < 9; i++) { - printf("%s\n", hangmanArt[i]); + printf("%s\n", galgen_overlay[i]); } return 0; } \ No newline at end of file From 7786aa4f6b50a33e956c2fb79541578c3946573a Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:23:37 +0100 Subject: [PATCH 086/109] test_Buchstabe_im_zu_erratenden_wort 1 --- src/main/c/hangman.h | 23 +++++++++++++++++++++++ src/main/c/hangman.txt | 2 +- src/test/c/test_hangman_test.c | 24 ++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/main/c/hangman.h create mode 100644 src/test/c/test_hangman_test.c diff --git a/src/main/c/hangman.h b/src/main/c/hangman.h new file mode 100644 index 0000000..8d2ac70 --- /dev/null +++ b/src/main/c/hangman.h @@ -0,0 +1,23 @@ +#ifndef TEST_H +#define TEST_H + +void protokoll(); +void clear_screen(); +void willkommen(); +int namePruefen(); +void nameWaehlen(); +void startauswahl(); +void nameAusgeben(); +void levelauswahl(); +void hauptSpiel(int level); +void zeichne_galgen(int versuche); +void erratenen_buchstaben_hinzufuegen(char* guessed_letters, char guessed_letter); +char eingabe_buchstabe(); +void hole_zu_erratendes_wort(char* secret_word, int level, char* path); +void zeige_Buchstabenfeld(char secret_word[100], char guessed_letters[100]); +int buchstabe_im_zu_erratenden_wort(char guessed_letter, char secret_word[100]); +int gewonnen(char secret_word[100], char guessed_letters[100]); +void level_plus(); +int overlay(); + +#endif // TEST_H diff --git a/src/main/c/hangman.txt b/src/main/c/hangman.txt index 4456b2e..4e41ffd 100644 --- a/src/main/c/hangman.txt +++ b/src/main/c/hangman.txt @@ -1 +1 @@ -name:peter,level:01 \ No newline at end of file +name:peter,level:02 \ No newline at end of file diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c new file mode 100644 index 0000000..b29661a --- /dev/null +++ b/src/test/c/test_hangman_test.c @@ -0,0 +1,24 @@ +#ifdef TEST + +#include "unity.h" +#include "hangman.h" + +void setUp(void) {} + +void tearDown(void) {} + +void test_Buchstabe_im_zu_erratenden_wort_eingabe_j_in_leerstring_falsch() { + // arrange + int expected = 1; + int actual; + char guessed_letter = 'j'; + char secret_word[100] = ""; + + // act + actual = Buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + +#endif // TEST From dbfa72438aa84dca3d643c366d3a6e7797c55cc5 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:25:30 +0100 Subject: [PATCH 087/109] test_buchstabe_im_zu_erratenden_wort 1 richtigstellung --- src/test/c/test_hangman_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index b29661a..b84d988 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -7,7 +7,7 @@ void setUp(void) {} void tearDown(void) {} -void test_Buchstabe_im_zu_erratenden_wort_eingabe_j_in_leerstring_falsch() { +void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_leerstring_falsch() { // arrange int expected = 1; int actual; @@ -15,7 +15,7 @@ void test_Buchstabe_im_zu_erratenden_wort_eingabe_j_in_leerstring_falsch() { char secret_word[100] = ""; // act - actual = Buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); + actual = buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); // assert TEST_ASSERT_EQUAL_INT(expected, actual); From 16403a8a6fd49012d46cdcfa29342ef244d4ef06 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:26:29 +0100 Subject: [PATCH 088/109] test_buchstabe_im_zu_erratenden_wort 2 --- src/test/c/test_hangman_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index b84d988..6f70048 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -21,4 +21,18 @@ void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_leerstring_falsch() { TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_joe_richtig() { + // arrange + int expected = 0; + int actual; + char guessed_letter = 'j'; + char secret_word[100] = "joe"; + + // act + actual = buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif // TEST From 3c8a80091a6102216bd213b9f26c10f5a27dbb57 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:27:13 +0100 Subject: [PATCH 089/109] test_buchstabe_im_zu_erratenden_wort 3 --- src/test/c/test_hangman_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index 6f70048..f244008 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -35,4 +35,18 @@ void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_joe_richtig() { TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_buchstabe_im_zu_erratenden_wort_eingabe_k_in_joe_falsch() { + // arrange + int expected = 1; + int actual; + char guessed_letter = 'k'; + char secret_word[100] = "joe"; + + // act + actual = buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif // TEST From 44c23009a6ee4df11c5ed9ea0a032403e52393de Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:28:49 +0100 Subject: [PATCH 090/109] test_buchstabe_im_zu_erratenden_wort 4 --- src/test/c/test_hangman_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index f244008..a092ee3 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -49,4 +49,18 @@ void test_buchstabe_im_zu_erratenden_wort_eingabe_k_in_joe_falsch() { TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_eoj_richtig() { + // arrange + int expected = 0; + int actual; + char guessed_letter = 'j'; + char secret_word[100] = "eoj"; + + // act + actual = buchstabe_im_zu_erratenden_wort(guessed_letter, secret_word); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif // TEST From b4331381c018243325f5b72b918b283f594a958c Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:29:44 +0100 Subject: [PATCH 091/109] test_erratene_buchstaben_hinzufuegen 1 --- src/test/c/test_hangman_test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index a092ee3..c8fe86b 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -63,4 +63,17 @@ void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_eoj_richtig() { TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_erratene_buchstaben_hinzufuegen_anhaengen_r_an_leerstring_zu_peter_richtig() { + // arrange + char expected[100] = "r"; + char actual[100] = ""; + char to_add = 'r'; + + // act + erratene_buchstaben_hinzufuegen(actual, to_add); + + // assert + TEST_ASSERT_EQUAL_STRING(expected, actual); +} + #endif // TEST From bd85f32d84e9e3ec48fd09622f4241f03bface92 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:30:49 +0100 Subject: [PATCH 092/109] test_erratene_buchstaben_hinzufuegen 1 richtigstellung --- src/test/c/test_hangman_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index c8fe86b..a799622 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -63,14 +63,14 @@ void test_buchstabe_im_zu_erratenden_wort_eingabe_j_in_eoj_richtig() { TEST_ASSERT_EQUAL_INT(expected, actual); } -void test_erratene_buchstaben_hinzufuegen_anhaengen_r_an_leerstring_zu_peter_richtig() { +void test_erratenen_buchstaben_hinzufuegen_anhaengen_r_an_leerstring_zu_peter_richtig() { // arrange char expected[100] = "r"; char actual[100] = ""; char to_add = 'r'; // act - erratene_buchstaben_hinzufuegen(actual, to_add); + erratenen_buchstaben_hinzufuegen(actual, to_add); // assert TEST_ASSERT_EQUAL_STRING(expected, actual); From 84daac09abe3602274daa279fd390a249b5c158a Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:31:44 +0100 Subject: [PATCH 093/109] test_erratene_buchstaben_hinzufuegen 2 --- src/test/c/test_hangman_test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index a799622..98308e8 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -76,4 +76,17 @@ void test_erratenen_buchstaben_hinzufuegen_anhaengen_r_an_leerstring_zu_peter_ri TEST_ASSERT_EQUAL_STRING(expected, actual); } +void test_erratenen_buchstaben_hinzufuegen_anhaengen_r_an_pete_zu_peter_richtig() { + // arrange + char expected[100] = "peter"; + char actual[100] = "pete"; + char to_add = 'r'; + + // act + erratenen_buchstaben_hinzufuegen(actual, to_add); + + // assert + TEST_ASSERT_EQUAL_STRING(expected, actual); +} + #endif // TEST From 7a4bc9f343ab331700cdc71188f61a7adec43668 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:32:22 +0100 Subject: [PATCH 094/109] test_erratene_buchstaben_hinzufuegen 3 --- src/test/c/test_hangman_test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index 98308e8..aade409 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -89,4 +89,17 @@ void test_erratenen_buchstaben_hinzufuegen_anhaengen_r_an_pete_zu_peter_richtig( TEST_ASSERT_EQUAL_STRING(expected, actual); } +void test_erratenen_buchstaben_hinzufuegen_anhaengen_r_an_peter_zu_peter_falsch() { + // arrange + char expected[100] = "peter"; + char actual[100] = "peter"; + char to_add = 'r'; + + // act + erratenen_buchstaben_hinzufuegen(actual, to_add); + + // assert + TEST_ASSERT_FALSE(expected == actual); +} + #endif // TEST From 76e514199ce4855f6d55763d0458cd600e587f0f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:32:57 +0100 Subject: [PATCH 095/109] test_gewonnen 1 --- src/test/c/test_hangman_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index aade409..99550b1 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -102,4 +102,18 @@ void test_erratenen_buchstaben_hinzufuegen_anhaengen_r_an_peter_zu_peter_falsch( TEST_ASSERT_FALSE(expected == actual); } +void test_gewonnen_petr_in_peter_richtig() { + // arrange + int expected = 1; + char actual; + char secret_word[100] = "peter"; + char guessed_letters[100] = "petr"; + + // act + actual = gewonnen(secret_word, guessed_letters); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif // TEST From c68a10ea8e048694bfb135f367d30e464d359252 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:33:23 +0100 Subject: [PATCH 096/109] test_gewonnen 2 --- src/test/c/test_hangman_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index 99550b1..07ceafa 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -116,4 +116,18 @@ void test_gewonnen_petr_in_peter_richtig() { TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_gewonnen_p_in_peter_falsch() { + // arrange + int expected = 0; + char actual; + char secret_word[100] = "peter"; + char guessed_letters[100] = "p"; + + // act + actual = gewonnen(secret_word, guessed_letters); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif // TEST From e8ad1176a1fa114d942c8f59ffeffc325b5b5df1 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:33:53 +0100 Subject: [PATCH 097/109] test_gewonnen 3 --- src/test/c/test_hangman_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_hangman_test.c b/src/test/c/test_hangman_test.c index 07ceafa..e63bdba 100644 --- a/src/test/c/test_hangman_test.c +++ b/src/test/c/test_hangman_test.c @@ -130,4 +130,18 @@ void test_gewonnen_p_in_peter_falsch() { TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_gewonnen_petr_in_leerstring_richtig() { + // arrange + int expected = 1; + char actual; + char secret_word[100] = ""; + char guessed_letters[100] = "petr"; + + // act + actual = gewonnen(secret_word, guessed_letters); + + // assert + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif // TEST From 46ae979f08ff3c39ead782c4187b01db9989c6c2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:23:03 +0100 Subject: [PATCH 098/109] test_isColumnFull --- src/test/c/test_VierGewinnt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_VierGewinnt.c b/src/test/c/test_VierGewinnt.c index efe7a13..1f14b9f 100644 --- a/src/test/c/test_VierGewinnt.c +++ b/src/test/c/test_VierGewinnt.c @@ -135,3 +135,17 @@ char board[6][7] = { TEST_ASSERT_EQUAL_INT(0, checkWin(board, 'X')); // Kein Gewinner, horizontale Reihe ist voll TEST_ASSERT_EQUAL_INT(0, checkWin(board, 'O')); // Kein Gewinner, horizontale Reihe ist voll } + +void test_isColumnFull(void) { + char board[6][7] = { + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'}, + {'X', 'O', 'X', 'O', 'X', 'O', 'X'}, + {'O', 'X', 'O', 'X', 'O', 'X', 'O'} + }; + + TEST_ASSERT_EQUAL_INT(1, isColumnFull(board, 3)); // Column 3 is full +} + From ff4961c714bd5b80b2078734227002a5e69e34e5 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:33:31 +0100 Subject: [PATCH 099/109] refactoring: change function name from showInvalidInputMessage() int showInvalidInputWarning() --- src/main/c/VierGewinnt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index c4d1419..ee289c8 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -49,7 +49,7 @@ int checkDiagonalRL(char board[ROWS][COLS], char player); // Funktionsprototyp für showMessage void showMessage(const char* messageColor, const char* message); //Funktionsprototyp für showInvalidInputMessage -void showInvalidInputMessage(); +void showInvalidInputWarning(); //Funktionsprototyp für showColumnFullMessage void showColumnFullMessage(); @@ -72,7 +72,7 @@ int main_function() { scanf("%d", &column); if (column < 1 || column > 7) { - showInvalidInputMessage(); + showInvalidInputWarning(); continue; } @@ -233,7 +233,7 @@ void showMessage(const char* messageColor, const char* message) { } // Write showInvalidInputMessage function -void showInvalidInputMessage() { +void showInvalidInputWarning() { showMessage(RED, "Ungültige Eingabe. Bitte wähle eine Spalte zwischen 1 und 7.\n"); } From 802e23fa9bc627e49f4fea738cc39896f2cbb0a7 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:36:35 +0100 Subject: [PATCH 100/109] refactoring: Ausgabetext Anpassen --- src/main/c/VierGewinnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index ee289c8..f91b268 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -242,7 +242,7 @@ void showInvalidInputWarning() { // Write showColumnFullMessage function void showColumnFullMessage() { - showMessage(RED, "Die Spalte ist voll. Bitte wähle eine andere.\n"); + showMessage(RED, "Die ausgewählte Spalte ist bereits belegt. Bitte wähle eine andere Spalte aus.\n"); } From 241aa5116b64d44149dc1d3f1ee9bd24d4052836 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:41:20 +0100 Subject: [PATCH 101/109] =?UTF-8?q?refactoring:=20Funktionsprototypen=20An?= =?UTF-8?q?passen=20und=20unn=C3=B6tige=20Kommentare=20l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index f91b268..65613cf 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -17,44 +17,18 @@ #define CYAN "\033[0;36m" #define WHITE "\033[0;37m" - -//Funktionsprototyp für initializeBoard +//Funktionsprototypen void initializeBoard(char board[ROWS][COLS]); - -//Funktionsprototyp für printBoard void printBoard(char board[ROWS][COLS]); - -// Funktionsprototyp für clearScreen void clearScreen(); - -//Funktionsprototyp für isColumnFull int isColumnFull(char board[ROWS][COLS], int col); - -//Funktionsprototyp für dropPiece int dropPiece(char board[ROWS][COLS], int col, char player); -//Funktionsprototyp für checkWin int checkWin(char board[ROWS][COLS], char player); -// Funktionsprototyp für checkHorizontal int checkHorizontal(char board[ROWS][COLS], char player); - -// Funktionsprototyp für checkVertical int checkVertical(char board[ROWS][COLS], char player); - -// Funktionsprototyp für checkDiagonalLR -int checkDiagonalLR(char board[ROWS][COLS], char player); - -// Funktionsprototyp für checkDiagonalRL int checkDiagonalRL(char board[ROWS][COLS], char player); - -// Funktionsprototyp für showMessage -void showMessage(const char* messageColor, const char* message); -//Funktionsprototyp für showInvalidInputMessage void showInvalidInputWarning(); - -//Funktionsprototyp für showColumnFullMessage void showColumnFullMessage(); - -//Funktionsprototyp für showWinMessage void showWinMessage(int player); From 651527c3bbe9472dc9521e19108853483de185e6 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:43:33 +0100 Subject: [PATCH 102/109] =?UTF-8?q?refactoring:=20unn=C3=B6tige=20Kommenta?= =?UTF-8?q?re=20l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 65613cf..88b2b33 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -32,10 +32,9 @@ void showColumnFullMessage(); void showWinMessage(int player); -//Write starter function int main_function() { char board[ROWS][COLS]; - int currentPlayer = 1; // Spieler 1 beginnt + int currentPlayer = 1; initializeBoard(board); printBoard(board); @@ -70,7 +69,6 @@ int main_function() { return 0; } -// Write initializeBoard function void initializeBoard(char board[ROWS][COLS]) { for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLS; j++) { @@ -80,7 +78,6 @@ void initializeBoard(char board[ROWS][COLS]) { } -// Write printBoard function void printBoard(char board[ROWS][COLS]) { clearScreen(); printf("\n"); @@ -99,7 +96,6 @@ void printBoard(char board[ROWS][COLS]) { printf(" 1 2 3 4 5 6 7\n\n"); } -// Write clearScreen function void clearScreen() { #ifdef _WIN32 system("cls"); @@ -108,12 +104,10 @@ void clearScreen() { #endif } -// Write isColumnFull function int isColumnFull(char board[ROWS][COLS], int col) { return (board[0][col] != ' '); } -//Write dropPiece function int dropPiece(char board[ROWS][COLS], int col, char player) { for (int i = ROWS - 1; i >= 0; i--) { if (board[i][col] == ' ') { @@ -122,11 +116,10 @@ int dropPiece(char board[ROWS][COLS], int col, char player) { } } - return 0; // Column is full + return 0; } -// Write checkHorizontal function int checkHorizontal(char board[ROWS][COLS], char player) { for (int row = 0; row < ROWS; row++) { for (int col = 0; col <= COLS - 4; col++) { @@ -134,14 +127,13 @@ int checkHorizontal(char board[ROWS][COLS], char player) { board[row][col + 1] == player && board[row][col + 2] == player && board[row][col + 3] == player) { - return 1; // Gewonnen + return 1; } } } return 0; } -//Write checkVertical function int checkVertical(char board[ROWS][COLS], char player) { for (int col = 0; col < COLS; col++) { for (int row = 0; row <= ROWS - 4; row++) { @@ -149,7 +141,7 @@ int checkVertical(char board[ROWS][COLS], char player) { board[row + 1][col] == player && board[row + 2][col] == player && board[row + 3][col] == player) { - return 1; // Gewonnen + return 1; } } } @@ -158,7 +150,6 @@ int checkVertical(char board[ROWS][COLS], char player) { -// Write checkDiagonalLR function int checkDiagonalLR(char board[ROWS][COLS], char player) { for (int row = 0; row <= ROWS - 4; row++) { for (int col = 0; col <= COLS - 4; col++) { @@ -166,7 +157,7 @@ int checkDiagonalLR(char board[ROWS][COLS], char player) { board[row + 1][col + 1] == player && board[row + 2][col + 2] == player && board[row + 3][col + 3] == player) { - return 1; // Gewonnen + return 1; } } } @@ -176,7 +167,6 @@ int checkDiagonalLR(char board[ROWS][COLS], char player) { -// Write checkDiagonalRL function int checkDiagonalRL(char board[ROWS][COLS], char player) { for (int row = 0; row <= ROWS - 4; row++) { for (int col = 3; col < COLS; col++) { @@ -184,7 +174,7 @@ int checkDiagonalRL(char board[ROWS][COLS], char player) { board[row + 1][col - 1] == player && board[row + 2][col - 2] == player && board[row + 3][col - 3] == player) { - return 1; // Gewonnen + return 1; } } } @@ -192,7 +182,6 @@ int checkDiagonalRL(char board[ROWS][COLS], char player) { } -// Write checkWin function int checkWin(char board[ROWS][COLS], char player) { return checkHorizontal(board, player) || checkVertical(board, player) || @@ -201,12 +190,10 @@ int checkWin(char board[ROWS][COLS], char player) { } -// Write showMessage function void showMessage(const char* messageColor, const char* message) { printf("%s%s"RESET_COLOR, messageColor, message); } -// Write showInvalidInputMessage function void showInvalidInputWarning() { showMessage(RED, "Ungültige Eingabe. Bitte wähle eine Spalte zwischen 1 und 7.\n"); } @@ -214,14 +201,12 @@ void showInvalidInputWarning() { -// Write showColumnFullMessage function void showColumnFullMessage() { showMessage(RED, "Die ausgewählte Spalte ist bereits belegt. Bitte wähle eine andere Spalte aus.\n"); } -// Write showWinMessage function void showWinMessage(int player) { printf("Spieler %d hat gewonnen!\n", player); } From e4024a180d839af04327e00ad6ea77d4d13431c3 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:47:08 +0100 Subject: [PATCH 103/109] =?UTF-8?q?refactoring:=20=C3=84ndere=20variabel?= =?UTF-8?q?=20currentPlayer=20zu=20=20Player?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 88b2b33..711d018 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -34,14 +34,14 @@ void showWinMessage(int player); int main_function() { char board[ROWS][COLS]; - int currentPlayer = 1; + int Player = 1; initializeBoard(board); printBoard(board); int column; while (1) { - printf(YELLOW"Spieler %d, wähle eine Spalte (1-7): "RESET_COLOR, currentPlayer); + printf(YELLOW"Spieler %d, wähle eine Spalte (1-7): "RESET_COLOR, Player); scanf("%d", &column); if (column < 1 || column > 7) { @@ -56,14 +56,14 @@ int main_function() { continue; } - if (dropPiece(board, column, (currentPlayer == 1) ? 'X' : 'O')) { + if (dropPiece(board, column, (Player == 1) ? 'X' : 'O')) { printBoard(board); - if (checkWin(board, (currentPlayer == 1) ? 'X' : 'O')) { - showWinMessage(currentPlayer); + if (checkWin(board, (Player == 1) ? 'X' : 'O')) { + showWinMessage(Player); break; } - currentPlayer = (currentPlayer == 1) ? 2 : 1; + Player = (Player == 1) ? 2 : 1; } } From 382719583bd68c52c438b2a3fd0a25a6a4c684e4 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:03:50 +0100 Subject: [PATCH 104/109] =?UTF-8?q?refactoring:=20F=C3=BCge=20fdai-Nummer?= =?UTF-8?q?=20als=20Kommentar=20im=20Code=20f=C3=BCr=20Support=20hinzu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 711d018..a9bfaa0 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -1,3 +1,5 @@ +// Author fdai7726 + //Importiere wichtige Bibliotheken #include #include From af94b552d42d531c34c80df69749694aa45a0cd7 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:10:57 +0100 Subject: [PATCH 105/109] =?UTF-8?q?refactoring:=20Spiel=20Beschreibung=20a?= =?UTF-8?q?ls=20Kommentar=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index a9bfaa0..e6b84cc 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -1,5 +1,17 @@ // Author fdai7726 +/* +*Ein Vier-Gewinnt-Spiel, das in der Kommandozeile gespielt wird. +*Das Programm ermöglicht es zwei Spielern, abwechselnd Steine in eine Spalte zu setzen, +*um eine Reihe von vier Steinen horizontal, +*vertikal oder diagonal zu bilden und das Spiel zu gewinnen. +*Das Spielfeld wird grafisch in der Kommandozeile dargestellt, +*und das Programm überprüft automatisch, +*ob einer der Spieler gewonnen hat oder ob das Spielfeld voll ist. + */ + + + //Importiere wichtige Bibliotheken #include #include From a7cff576b79eebb61a1f8a93eaa9dce62280c352 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:15:55 +0100 Subject: [PATCH 106/109] =?UTF-8?q?refactoring:=20Gewinner=20Nachrricht=20?= =?UTF-8?q?=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/VierGewinnt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index e6b84cc..44b22ee 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -222,7 +222,8 @@ void showColumnFullMessage() { void showWinMessage(int player) { - printf("Spieler %d hat gewonnen!\n", player); +printf("Spieler %d ist der Gewinner!\n", player); + } From 7a8cd52f0d93e9dfe5d3a9debef99c43debe7070 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:17:39 +0100 Subject: [PATCH 107/109] refactoring: Funktion showMessage beschreiben --- src/main/c/VierGewinnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index 44b22ee..a8609ca 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -203,7 +203,7 @@ int checkWin(char board[ROWS][COLS], char player) { checkDiagonalRL(board, player); } - +// Die Funktion showMessage gibt eine formatierte Nachricht aus, wobei die Farbe der Nachricht dynamisch festgelegt werden kann. void showMessage(const char* messageColor, const char* message) { printf("%s%s"RESET_COLOR, messageColor, message); } From 3b75ec27be04597cc58e9d1bdaf276f1a1e3534c Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:22:30 +0100 Subject: [PATCH 108/109] refactoring: Beschreibung der Funktion showInvalidInputWarning() --- src/main/c/VierGewinnt.c | 2 ++ src/main/c/a.out | Bin 0 -> 10336 bytes 2 files changed, 2 insertions(+) create mode 100755 src/main/c/a.out diff --git a/src/main/c/VierGewinnt.c b/src/main/c/VierGewinnt.c index a8609ca..2072110 100644 --- a/src/main/c/VierGewinnt.c +++ b/src/main/c/VierGewinnt.c @@ -208,6 +208,8 @@ void showMessage(const char* messageColor, const char* message) { printf("%s%s"RESET_COLOR, messageColor, message); } +//Die Funktion showInvalidInputWarning zeigt eine Warnung für ungültige Benutzereingaben an. Sie ruft die Funktion showMessage auf, um die Nachricht in roter Farbe auszugeben, die den Benutzer darüber informiert, dass die Eingabe ungültig ist und er eine Spalte zwischen 1 und 7 wählen soll. + void showInvalidInputWarning() { showMessage(RED, "Ungültige Eingabe. Bitte wähle eine Spalte zwischen 1 und 7.\n"); } diff --git a/src/main/c/a.out b/src/main/c/a.out new file mode 100755 index 0000000000000000000000000000000000000000..b6a2002109ba2d4eef443ffc2d731c453a0436f7 GIT binary patch literal 10336 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 literal 0 HcmV?d00001 From 8aea03cf9826bf6db11a2dcfd9dbe91656befc02 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 17:48:21 +0000 Subject: [PATCH 109/109] Delete a.out --- src/main/c/a.out | Bin 10336 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 src/main/c/a.out diff --git a/src/main/c/a.out b/src/main/c/a.out deleted file mode 100755 index b6a2002109ba2d4eef443ffc2d731c453a0436f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10336 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