From dbde6ebd43ec6aeb4d3abe935121ac8d4bcd5f96 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Fri, 2 Feb 2024 15:33:49 +0000 Subject: [PATCH 001/647] 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 77023b58e32b784bf47a8c5b1bd40d0a3bf9c598 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Fri, 2 Feb 2024 16:40:53 +0100 Subject: [PATCH 002/647] add Yasin to team --- 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 003/647] 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 004/647] =?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 005/647] =?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 006/647] =?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 007/647] 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 414a018ea5c33a9a8d58064405c1ed22640a2eaf Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:03:21 +0100 Subject: [PATCH 008/647] Direction; change_direction N --> E --- src/main/c/global.h | 8 ++++++++ src/main/c/labyrinth.c | 14 ++++++++++++++ src/main/c/labyrinth.h | 8 ++++++++ src/main/c/test.c | 6 ------ src/main/c/test.h | 6 ------ src/test/c/support/.invis | 0 src/test/c/test_labyrinth.c | 27 +++++++++++++++++++++++++++ src/test/c/test_test.c | 28 ---------------------------- 8 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 src/main/c/global.h create mode 100644 src/main/c/labyrinth.c create mode 100644 src/main/c/labyrinth.h delete mode 100644 src/main/c/test.c delete mode 100644 src/main/c/test.h delete mode 100644 src/test/c/support/.invis create mode 100644 src/test/c/test_labyrinth.c delete mode 100644 src/test/c/test_test.c diff --git a/src/main/c/global.h b/src/main/c/global.h new file mode 100644 index 0000000..b6aa8f0 --- /dev/null +++ b/src/main/c/global.h @@ -0,0 +1,8 @@ +#ifndef GLOBAL_H +#define GLOBAL_H + +typedef enum { + N, E, S, W +} Dir; + +#endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c new file mode 100644 index 0000000..8067030 --- /dev/null +++ b/src/main/c/labyrinth.c @@ -0,0 +1,14 @@ +#include "labyrinth.h" + +#include "global.h" + +#include "stdio.h" +#include "stdlib.h" + +void change_direction(Dir *direction){ + switch (*direction) { + case N: + *direction = E; + break; + } +} diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h new file mode 100644 index 0000000..0ab2124 --- /dev/null +++ b/src/main/c/labyrinth.h @@ -0,0 +1,8 @@ +#ifndef TEST_H +#define TEST_H + +#include "global.h" + +void change_direction(Dir *direction); + +#endif // TEST_H diff --git a/src/main/c/test.c b/src/main/c/test.c deleted file mode 100644 index 52489ec..0000000 --- a/src/main/c/test.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "test.h" - -int return_5(){ - return 5; -} - diff --git a/src/main/c/test.h b/src/main/c/test.h deleted file mode 100644 index 4458e13..0000000 --- a/src/main/c/test.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef TEST_H -#define TEST_H - -int return_5(); - -#endif // TEST_H diff --git a/src/test/c/support/.invis b/src/test/c/support/.invis deleted file mode 100644 index e69de29..0000000 diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c new file mode 100644 index 0000000..9426c2c --- /dev/null +++ b/src/test/c/test_labyrinth.c @@ -0,0 +1,27 @@ +#include "unity.h" + +#include "stdlib.h" + +#include "labyrinth.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_change_direction_from_N_expected_E(void) +{ + /* arrange */ + Dir actual = N; + Dir expected = E; + + /* act */ + change_direction(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} + 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 dd520029451a273a673366f951a48113a6a3df9c Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:05:36 +0100 Subject: [PATCH 009/647] =?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 010/647] =?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 011/647] 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 012/647] =?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 013/647] 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 014/647] =?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 015/647] =?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 016/647] 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 17dd3fd25486f350b25cadbaa389492b3d3fa1f5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:12:44 +0100 Subject: [PATCH 017/647] refactoring: change_direction --- src/main/c/global.h | 2 +- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- src/test/c/test_labyrinth.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/c/global.h b/src/main/c/global.h index b6aa8f0..556a1f1 100644 --- a/src/main/c/global.h +++ b/src/main/c/global.h @@ -3,6 +3,6 @@ typedef enum { N, E, S, W -} Dir; +} Direction; #endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 8067030..980b367 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -5,7 +5,7 @@ #include "stdio.h" #include "stdlib.h" -void change_direction(Dir *direction){ +void turn_direction_right(Direction *direction){ switch (*direction) { case N: *direction = E; diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 0ab2124..4c077e9 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -3,6 +3,6 @@ #include "global.h" -void change_direction(Dir *direction); +void turn_direction_right(Direction *direction); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 9426c2c..a31da00 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -15,11 +15,11 @@ void tearDown(void) void test_change_direction_from_N_expected_E(void) { /* arrange */ - Dir actual = N; - Dir expected = E; + Direction actual = N; + Direction expected = E; /* act */ - change_direction(&actual); + turn_direction_right(&actual); /* assert */ TEST_ASSERT_TRUE(expected == actual); From 603769c08a68decfbb782a10bd056b803d11766e Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:14:53 +0100 Subject: [PATCH 018/647] change direction right E --> S --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 980b367..adaaab5 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -10,5 +10,8 @@ void turn_direction_right(Direction *direction){ case N: *direction = E; break; + case E: + *direction = S; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index a31da00..563d886 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -25,3 +25,15 @@ void test_change_direction_from_N_expected_E(void) TEST_ASSERT_TRUE(expected == actual); } +void test_turn_direction_right_from_E_expected_S(void) +{ + /* arrange */ + Direction actual = E; + Direction expected = S; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} From 9d4ba68d90b8769545b464d77ea290e453bf1f1f Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:16:33 +0100 Subject: [PATCH 019/647] change direction right S --> W --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index adaaab5..d53c95b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -13,5 +13,8 @@ void turn_direction_right(Direction *direction){ case E: *direction = S; break; + case S: + *direction = W; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 563d886..555736d 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -37,3 +37,17 @@ void test_turn_direction_right_from_E_expected_S(void) /* assert */ TEST_ASSERT_TRUE(expected == actual); } + +void test_turn_direction_right_from_S_expected_W(void) +{ + /* arrange */ + Direction actual = S; + Direction expected = W; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} + From fad2f3430dfd7cd1bf3e049202596074a9281054 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:18:08 +0100 Subject: [PATCH 020/647] turn_direction_right W --> N --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index d53c95b..a76a53b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -16,5 +16,8 @@ void turn_direction_right(Direction *direction){ case S: *direction = W; break; + case W: + *direction = N; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 555736d..e257b07 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -51,3 +51,16 @@ void test_turn_direction_right_from_S_expected_W(void) TEST_ASSERT_TRUE(expected == actual); } +void test_turn_direction_right_from_W_expected_N(void) +{ + /* arrange */ + Direction actual = W; + Direction expected = N; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} + From c8feba1040dacf97de11c14b989becc0c27448c9 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:20:32 +0100 Subject: [PATCH 021/647] move north set x 0 --- src/main/c/labyrinth.c | 10 ++++++++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index a76a53b..89227c3 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -21,3 +21,13 @@ void turn_direction_right(Direction *direction){ break; } } + +void move(unsigned short *x, unsigned short *y, Direction direction){ + + if (direction == N){ + *x = 0; + return; + } + +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 4c077e9..402e915 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -4,5 +4,6 @@ #include "global.h" void turn_direction_right(Direction *direction); +void move(unsigned short *x, unsigned short *y, Direction direction); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index e257b07..5e63380 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -64,3 +64,20 @@ void test_turn_direction_right_from_W_expected_N(void) TEST_ASSERT_TRUE(expected == actual); } +void test_lab_move_from_1_1_N_expected_0_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = N; + + unsigned short x_expected = 0; + unsigned short y_expected = 1; + + /* act */ + move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From cdb61e6e7b93011fc423d3baec9f853d939e82ef Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:21:14 +0100 Subject: [PATCH 022/647] =?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 023/647] 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 024/647] =?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 025/647] =?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 026/647] 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 1e2edfd89df4737a6bf0360c5ea3e14cd899f612 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:21:43 +0100 Subject: [PATCH 027/647] refactoring: move --> lab_move --- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- src/test/c/test_labyrinth.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 89227c3..d4cec1d 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -22,7 +22,7 @@ void turn_direction_right(Direction *direction){ } } -void move(unsigned short *x, unsigned short *y, Direction direction){ +void lab_move(unsigned short *x, unsigned short *y, Direction direction){ if (direction == N){ *x = 0; diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 402e915..3bd9821 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -4,6 +4,6 @@ #include "global.h" void turn_direction_right(Direction *direction); -void move(unsigned short *x, unsigned short *y, Direction direction); +void lab_move(unsigned short *x, unsigned short *y, Direction direction); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 5e63380..5233c20 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -75,7 +75,7 @@ void test_lab_move_from_1_1_N_expected_0_1(void) unsigned short y_expected = 1; /* act */ - move(&x, &y, direction); + lab_move(&x, &y, direction); /* assert */ TEST_ASSERT_TRUE(x == x_expected && y == y_expected); From 82b77097a0a00369ed2cf86f05faa30f4829a120 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:26:26 +0100 Subject: [PATCH 028/647] =?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 029/647] 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 7c440691530fa95f8c8c89c2a776664671e3baeb Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:33:10 +0100 Subject: [PATCH 030/647] lab move N --> x - 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index d4cec1d..5b18703 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -25,7 +25,7 @@ void turn_direction_right(Direction *direction){ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ if (direction == N){ - *x = 0; + *x = *x - 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 5233c20..022c2e8 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -81,3 +81,20 @@ void test_lab_move_from_1_1_N_expected_0_1(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_N_expected_4_5(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = N; + + unsigned short x_expected = 4; + unsigned short y_expected = 5; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From eb2b6fc6d57a42f5baaf266e9dda4c534c175e50 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:34:30 +0100 Subject: [PATCH 031/647] lab_move direction E --> y = 2 --- src/main/c/labyrinth.c | 4 ++++ src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 5b18703..2575180 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -28,6 +28,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ *x = *x - 1; return; } + if (direction == E){ + *y = 2; + return; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 022c2e8..85ad115 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -98,3 +98,20 @@ void test_lab_move_from_5_5_N_expected_4_5(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_1_1_E_expected_1_2(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = E; + + unsigned short x_expected = 1; + unsigned short y_expected = 2; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From ccf6661ffd9764ef9f26339554a782fa5cc5886d Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:35:38 +0100 Subject: [PATCH 032/647] lab_move direction East y --> y + 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 2575180..2ac9193 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -29,7 +29,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ return; } if (direction == E){ - *y = 2; + *y = *y + 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 85ad115..9599c01 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -115,3 +115,20 @@ void test_lab_move_from_1_1_E_expected_1_2(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_E_expected_5_6(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = E; + + unsigned short x_expected = 5; + unsigned short y_expected = 6; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 091726334d0bdff1dc899653396c318b0378e805 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:37:41 +0100 Subject: [PATCH 033/647] lab_move direction S x --> 2 --- src/main/c/labyrinth.c | 4 ++++ src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 2ac9193..ed5b973 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -32,6 +32,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ *y = *y + 1; return; } + if (direction == S){ + *x = 2; + return; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 9599c01..ad8180f 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -132,3 +132,20 @@ void test_lab_move_from_5_5_E_expected_5_6(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_1_1_S_expected_2_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = S; + + unsigned short x_expected = 2; + unsigned short y_expected = 1; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 6a30cdf1b748448692cdcbd3e023c57358ac9f5a Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:39:17 +0100 Subject: [PATCH 034/647] lab_move direction S x --> x + 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index ed5b973..b3d95b2 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -33,7 +33,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ return; } if (direction == S){ - *x = 2; + *x = *x + 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index ad8180f..bd2c483 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -149,3 +149,20 @@ void test_lab_move_from_1_1_S_expected_2_1(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_S_expected_6_5(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = S; + + unsigned short x_expected = 6; + unsigned short y_expected = 5; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From df822f61a9a732f5b9048a548a854a577b640e22 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:40:55 +0100 Subject: [PATCH 035/647] lab_move direction W y --> 0 --- src/main/c/labyrinth.c | 4 ++++ src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index b3d95b2..59bff17 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -36,6 +36,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ *x = *x + 1; return; } + if (direction == W){ + *y = 0; + return; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index bd2c483..03b1642 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -166,3 +166,20 @@ void test_lab_move_from_5_5_S_expected_6_5(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_1_1_W_expected_1_0(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = W; + + unsigned short x_expected = 1; + unsigned short y_expected = 0; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From bb1c11d4e38cf26a3bf514401065ae678e001a21 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:41:49 +0100 Subject: [PATCH 036/647] =?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 356f53ef5bbec65ebb2169e9d0f23183fc014fd3 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:42:11 +0100 Subject: [PATCH 037/647] lab_move direction W y --> y - 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 59bff17..ba08944 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -37,7 +37,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ return; } if (direction == W){ - *y = 0; + *y = *y - 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 03b1642..98d4f2f 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -183,3 +183,20 @@ void test_lab_move_from_1_1_W_expected_1_0(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_W_expected_5_4(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = W; + + unsigned short x_expected = 5; + unsigned short y_expected = 4; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 8d30fbee47d633b91afdd5c4cc466c548dc8952b Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:42:57 +0100 Subject: [PATCH 038/647] 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 5f2941c3f7d0e9d462883909e5a98c10a81f2904 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:43:15 +0100 Subject: [PATCH 039/647] set_wall at 0 0 --- src/main/c/global.h | 4 ++++ src/main/c/labyrinth.c | 4 ++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/src/main/c/global.h b/src/main/c/global.h index 556a1f1..1dea8db 100644 --- a/src/main/c/global.h +++ b/src/main/c/global.h @@ -5,4 +5,8 @@ typedef enum { N, E, S, W } Direction; +typedef enum { + WAY, WALL, SOLUTION +} State; + #endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index ba08944..7b13e6e 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -43,3 +43,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ } +void set_wall(State** field, unsigned short x, unsigned short y) { + field[0][0] = WALL; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 3bd9821..15cd364 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -5,5 +5,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); +void set_wall(State** field, unsigned short x, unsigned short y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 98d4f2f..f950838 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -200,3 +200,34 @@ void test_lab_move_from_5_5_W_expected_5_4(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_set_wall_at_0_0_expected_WALL(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + + unsigned short len_x = 1, len_y = 1; + State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WAY; + + State expected = WALL; + + /* act */ + set_wall(field, x, y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 273fa7c4dab5aa1c4345688a60354ce9826a0571 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:43:50 +0100 Subject: [PATCH 040/647] 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 041/647] 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 d372b301600849dd7be8b79e7b95b45e672e6b0b Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:45:26 +0100 Subject: [PATCH 042/647] refactoring: State --> Field_State --- src/main/c/global.h | 2 +- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- src/test/c/test_labyrinth.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/c/global.h b/src/main/c/global.h index 1dea8db..6da861c 100644 --- a/src/main/c/global.h +++ b/src/main/c/global.h @@ -7,6 +7,6 @@ typedef enum { typedef enum { WAY, WALL, SOLUTION -} State; +} Field_State; #endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 7b13e6e..71ccb5c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -43,7 +43,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ } -void set_wall(State** field, unsigned short x, unsigned short y) { +void set_wall(Field_State** field, unsigned short x, unsigned short y) { field[0][0] = WALL; } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 15cd364..5b789f4 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -5,6 +5,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); -void set_wall(State** field, unsigned short x, unsigned short y); +void set_wall(Field_State** field, unsigned short x, unsigned short y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index f950838..9ef1074 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -207,7 +207,7 @@ void test_set_wall_at_0_0_expected_WALL(void) unsigned short y = 0; unsigned short len_x = 1, len_y = 1; - State **field; + Field_State **field; field = malloc(len_x * sizeof *field); for (int c_index = 0; c_index < len_x; c_index++){ @@ -216,7 +216,7 @@ void test_set_wall_at_0_0_expected_WALL(void) field[x][y] = WAY; - State expected = WALL; + Field_State expected = WALL; /* act */ set_wall(field, x, y); From f62a2d3e76f963d8eb1f68ada7824a59b6098fba Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:46:12 +0100 Subject: [PATCH 043/647] 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 690ae4eeaf6a3778869ca48fc904eee63146571a Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:47:01 +0100 Subject: [PATCH 044/647] set_wall at any x y --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 71ccb5c..8afa959 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -44,6 +44,6 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ } void set_wall(Field_State** field, unsigned short x, unsigned short y) { - field[0][0] = WALL; + field[x][y] = WALL; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 9ef1074..b5d9091 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -231,3 +231,34 @@ void test_set_wall_at_0_0_expected_WALL(void) free(field); } +void test_set_wall_at_2_3_expected_WALL(void) +{ + /* arrange */ + unsigned short x = 2; + unsigned short y = 3; + + unsigned short len_x = 5, len_y = 5; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WAY; + + Field_State expected = WALL; + + /* act */ + set_wall(field, x, y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From d8b150ea5417278034955404ed54d537ed47b064 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:48:37 +0100 Subject: [PATCH 045/647] 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 ce4005981d335169d8f7446860e2ea0c47e5f2b4 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:48:59 +0100 Subject: [PATCH 046/647] init_field with WAY at 0 0 --- src/main/c/labyrinth.c | 4 ++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 8afa959..75c718b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -47,3 +47,7 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { field[x][y] = WALL; } +void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ + field[0][0] = WAY; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 5b789f4..19b1835 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -6,5 +6,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); +void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index b5d9091..3658ce2 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -262,3 +262,33 @@ void test_set_wall_at_2_3_expected_WALL(void) free(field); } +void test_init_field_at_0_0_expected_WAY(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WALL; + + Field_State expected = WAY; + + /* act */ + init_field(field, len_x, len_y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} From cfb70011a9d987c618739c73d026d79e256b4b05 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:49:35 +0100 Subject: [PATCH 047/647] 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 048/647] 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 96863d5beaf2a303b2ba44dc746955f5820e7fb8 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:51:20 +0100 Subject: [PATCH 049/647] init_field with all x --> WAY --- src/main/c/labyrinth.c | 4 +++- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 75c718b..4c10c06 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -48,6 +48,8 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { } void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ - field[0][0] = WAY; + for (int x = 0; x < len_x; x++){ + field[x][0] = WAY; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 3658ce2..c8fa6cf 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -292,3 +292,34 @@ void test_init_field_at_0_0_expected_WAY(void) } free(field); } + +void test_init_field_at_2_0_expected_WAY(void) +{ + /* arrange */ + unsigned short x = 2; + unsigned short y = 0; + + unsigned short len_x = 5, len_y = 5; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WALL; + + Field_State expected = WAY; + + /* act */ + init_field(field, len_x, len_y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} From ce9fcaef3147fa6b10209556fb48251f299bdc32 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:51:31 +0100 Subject: [PATCH 050/647] 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 3758ec226cddfde007c0353fefad660fe3c16198 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:52:27 +0100 Subject: [PATCH 051/647] init_field any x y --> WAY --- src/main/c/labyrinth.c | 4 +++- src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 4c10c06..63d9f94 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -49,7 +49,9 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ for (int x = 0; x < len_x; x++){ - field[x][0] = WAY; + for (int y = 0; y < len_y; y++){ + field[x][y] = WAY; + } } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index c8fa6cf..2027c8b 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -323,3 +323,35 @@ void test_init_field_at_2_0_expected_WAY(void) } free(field); } + +void test_init_field_at_2_3_expected_WAY(void) +{ + /* arrange */ + unsigned short x = 2; + unsigned short y = 3; + + unsigned short len_x = 5, len_y = 5; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WALL; + + Field_State expected = WAY; + + /* act */ + init_field(field, len_x, len_y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 09b8bc1e75c5277dd0b95ec55b328ba732781c5a Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:56:31 +0100 Subject: [PATCH 052/647] refactoring: init_field --- src/main/c/labyrinth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 63d9f94..9259093 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -48,9 +48,9 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { } void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ - for (int x = 0; x < len_x; x++){ - for (int y = 0; y < len_y; y++){ - field[x][y] = WAY; + for (int c_x = 0; c_x < len_x; c_x++){ + for (int c_y = 0; c_y < len_y; c_y++){ + field[c_x][c_y] = WAY; } } } From 5de30c9dc50499a45cddb92c77cd73cdb0493427 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:58:10 +0100 Subject: [PATCH 053/647] lab_can_move North undefined --- src/main/c/labyrinth.c | 10 ++++++++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 9259093..8087c3b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -55,3 +55,13 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) } } +short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y){ + + lab_move(&x, &y, direction); + if (x == 65535){ + return 1; + } + + return 0; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 19b1835..ef19e30 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -7,5 +7,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); +short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 2027c8b..7192ff4 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -355,3 +355,34 @@ void test_init_field_at_2_3_expected_WAY(void) free(field); } +void test_lab_can_move_at_0_0_direction_N_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = N; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From fc9181ff5f077b5e20b94a9bf3841460f078f31e Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:00:18 +0100 Subject: [PATCH 054/647] lab_can_move y undefined --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 8087c3b..4686b6c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -61,6 +61,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (x == 65535){ return 1; } + if (y == 1){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 7192ff4..aa50607 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -385,4 +385,35 @@ void test_lab_can_move_at_0_0_direction_N_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_0_0_direction_E_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = E; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From f6caf8b8e2c5e6045d37468667212bdad1821152 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:01:44 +0100 Subject: [PATCH 055/647] lab_can_move x undefined over 0 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 4686b6c..ea27816 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -58,7 +58,7 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y){ lab_move(&x, &y, direction); - if (x == 65535){ + if (x >= len_x){ return 1; } if (y == 1){ diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index aa50607..83abd75 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -415,5 +415,36 @@ void test_lab_can_move_at_0_0_direction_E_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_0_0_direction_S_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = S; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From c53ffc1fa86392f771a828f2b9b7797c544d40b0 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:03:36 +0100 Subject: [PATCH 056/647] lab_can_move y undefined below 0 (overflow) --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index ea27816..50db9df 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -61,7 +61,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (x >= len_x){ return 1; } - if (y == 1){ + if (y >= len_y){ return 1; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 83abd75..0d8d6bc 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -445,6 +445,37 @@ void test_lab_can_move_at_0_0_direction_S_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_0_0_direction_W_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = W; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 8bfd95afccc04a23cc4b448e99d3c871ba1c1f93 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:04:46 +0100 Subject: [PATCH 057/647] lab_can_move direction N WALL above --- src/main/c/labyrinth.c | 5 ++++- src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 50db9df..688ef35 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -56,7 +56,7 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) } short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y){ - + lab_move(&x, &y, direction); if (x >= len_x){ return 1; @@ -64,6 +64,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (y >= len_y){ return 1; } + if (direction == N && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 0d8d6bc..a392006 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -475,6 +475,40 @@ void test_lab_can_move_at_0_0_direction_W_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_N_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 0; + unsigned short y_target = 1; + Direction direction = N; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 1e36e6b4c1e2e7cf66a4a6f221c8106566376574 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:06:22 +0100 Subject: [PATCH 058/647] lab_can_move direction E WALL heading WALL --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 688ef35..004c661 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -67,6 +67,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == N && field[x][y] == WALL){ return 1; } + if (direction == E && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index a392006..3c00353 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -508,6 +508,40 @@ void test_lab_can_move_at_1_1_direction_N_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_E_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 2; + Direction direction = E; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 7f3925512d86b424006fdec789cb07bab4d3acc9 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:08:55 +0100 Subject: [PATCH 059/647] lab_can_move direction S heading WALL --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 004c661..7b9a2a8 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -70,6 +70,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == E && field[x][y] == WALL){ return 1; } + if (direction == S && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 3c00353..de5b7c6 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -541,6 +541,40 @@ void test_lab_can_move_at_1_1_direction_E_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_S_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 2; + unsigned short y_target = 1; + Direction direction = S; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 32e5b54cab6b52ab257ed491895d4a5e10adfc6e Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:09:56 +0100 Subject: [PATCH 060/647] lab_can_move direction W heading WALL --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 7b9a2a8..c0aa3ed 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -73,6 +73,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == S && field[x][y] == WALL){ return 1; } + if (direction == W && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index de5b7c6..4a60303 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -574,6 +574,40 @@ void test_lab_can_move_at_1_1_direction_S_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 0; + Direction direction = W; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 5b28c39baac32859b51907ec6ec51d876b93c3f5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:11:32 +0100 Subject: [PATCH 061/647] refactoring: lab_can_move --- src/main/c/labyrinth.c | 11 +---------- src/test/c/test_labyrinth.c | 8 -------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index c0aa3ed..6acd557 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -64,16 +64,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (y >= len_y){ return 1; } - if (direction == N && field[x][y] == WALL){ - return 1; - } - if (direction == E && field[x][y] == WALL){ - return 1; - } - if (direction == S && field[x][y] == WALL){ - return 1; - } - if (direction == W && field[x][y] == WALL){ + if (field[x][y] == WALL){ return 1; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 4a60303..5cde2e1 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -607,11 +607,3 @@ void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) free(field); } - - - - - - - - From 36507739f86906594f240738afd7e7e45eafba6e Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:13:03 +0100 Subject: [PATCH 062/647] lab_can_move direction N heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 6acd557..e6f9ed5 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -67,6 +67,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (field[x][y] == WALL){ return 1; } + if (direction == N && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 5cde2e1..27bc07f 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -607,3 +607,35 @@ void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_N_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 0; + unsigned short y_target = 1; + Direction direction = N; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 5612121dab3d543ef9f3917a6b633ce9d7069cb5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:14:15 +0100 Subject: [PATCH 063/647] lab_can_move direction E heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index e6f9ed5..6e168d9 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -70,6 +70,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == N && field[x][y] == SOLUTION){ return 1; } + if (direction == E && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 27bc07f..99d45be 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -639,3 +639,35 @@ void test_lab_can_move_at_1_1_direction_N_target_SOLUTION_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_E_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 2; + Direction direction = E; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From def3a558e3f04bc215c70983e65494ee63a07a6f Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:15:22 +0100 Subject: [PATCH 064/647] lab_can_move direction S heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 6e168d9..42b180c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -73,6 +73,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == E && field[x][y] == SOLUTION){ return 1; } + if (direction == S && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 99d45be..4f30f4b 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -671,3 +671,35 @@ void test_lab_can_move_at_1_1_direction_E_target_SOLUTION_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_S_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 2; + unsigned short y_target = 1; + Direction direction = S; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 76cbafc7b24ec17e8f2d822f98abedb0e0c0723b Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:17:08 +0100 Subject: [PATCH 065/647] lab_can_move direction W heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 42b180c..53bf12d 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -76,6 +76,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == S && field[x][y] == SOLUTION){ return 1; } + if (direction == W && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 4f30f4b..4f52132 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -703,3 +703,35 @@ void test_lab_can_move_at_1_1_direction_S_target_SOLUTION_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_W_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 0; + Direction direction = W; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 2302392b0cef6822231b61c518ce91f43f2705c7 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:24:57 +0100 Subject: [PATCH 066/647] refactoring: lab_can_move --- src/main/c/labyrinth.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 53bf12d..09e00a1 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -70,13 +70,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == N && field[x][y] == SOLUTION){ return 1; } - if (direction == E && field[x][y] == SOLUTION){ - return 1; - } - if (direction == S && field[x][y] == SOLUTION){ - return 1; - } - if (direction == W && field[x][y] == SOLUTION){ + if (field[x][y] == SOLUTION){ return 1; } From ce38e86808adf74bcc2bbf30d10653582d302045 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:26:40 +0100 Subject: [PATCH 067/647] show_solution --- src/main/c/labyrinth.c | 12 +++++++++--- src/main/c/labyrinth.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 09e00a1..bc3c05c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -5,6 +5,15 @@ #include "stdio.h" #include "stdlib.h" +void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y){ + for (int c_x = 0; c_x < len_x; c_x++){ + for (int c_y = 0; c_y < len_y; c_y++){ + printf("%hi", field[c_x][c_y]); + } + printf("\n"); + } +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: @@ -67,9 +76,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (field[x][y] == WALL){ return 1; } - if (direction == N && field[x][y] == SOLUTION){ - return 1; - } if (field[x][y] == SOLUTION){ return 1; } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index ef19e30..42c953a 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -8,5 +8,6 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); +void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 126fd0d3d6e3d2cfd4ed7d7e9fce94618b485a38 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:27:39 +0100 Subject: [PATCH 068/647] get_natural_number --- src/main/c/labyrinth.c | 7 +++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index bc3c05c..1d70380 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -14,6 +14,13 @@ void show_solution(Field_State** field, unsigned short len_x, unsigned short len } } +unsigned short get_natural_number(char text[]){ + unsigned short result; + printf("%s", text); + scanf("%hu", &result); + return result; +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 42c953a..593d111 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -9,5 +9,6 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); +unsigned short get_natural_number(char text[]); #endif // TEST_H From 711d24f20e30022d239bda4e4fcf5b658a8d6a3d Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:31:49 +0100 Subject: [PATCH 069/647] dimesions --- src/main/c/labyrinth.c | 5 +++++ src/main/c/labyrinth.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 1d70380..997f1b7 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -21,6 +21,11 @@ unsigned short get_natural_number(char text[]){ return result; } +void dimesions(unsigned short *len_x, unsigned short *len_y){ + *len_x = get_natural_number("Bitte gib die x-Laenge des Labyrinthes an:\n"); + *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 593d111..4494394 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -10,5 +10,6 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); +void dimesions(unsigned short *len_x, unsigned short *len_y); #endif // TEST_H From 7d46b6020ecb65828d01303c011b62523e0c1f86 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:33:21 +0100 Subject: [PATCH 070/647] refactoring: dimesions --> get_lab_dimensions --- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 997f1b7..81b9ed4 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -21,7 +21,7 @@ unsigned short get_natural_number(char text[]){ return result; } -void dimesions(unsigned short *len_x, unsigned short *len_y){ +void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y){ *len_x = get_natural_number("Bitte gib die x-Laenge des Labyrinthes an:\n"); *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 4494394..d9cb80c 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -10,6 +10,6 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); -void dimesions(unsigned short *len_x, unsigned short *len_y); +void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); #endif // TEST_H From c508f0ae095569445a01f3e6784bbc85d5dab7f1 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:34:34 +0100 Subject: [PATCH 071/647] wall input --- src/main/c/labyrinth.c | 20 ++++++++++++++++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 81b9ed4..690f831 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -26,6 +26,26 @@ void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y){ *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); } +short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y){ + char answer; + printf("Moechten Sie die Koordinaten einer weiteren Labyrinthwand angeben? (y/n)\n"); + scanf(" %c", &answer); + + if (answer == 'n'){ + return 1; + } + + printf("Bitte geben Sie die Koordinaten von Labyrinthwaenden im Format x, y ein.\n"); + scanf("%hu, %hu", x, y); + + if (*x >= len_x || *y >= len_y){ + printf("Die eingegebenen Koordinaten sind zu gross.\n"); + return -1; + } + + return 0; +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index d9cb80c..b2160ff 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -11,5 +11,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); +short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 435fe6dc4766aeb2471a1477b15c2cdb322bdde9 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:35:39 +0100 Subject: [PATCH 072/647] refactoring: wall --> get_wall_input --- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 690f831..06def76 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -26,7 +26,7 @@ void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y){ *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); } -short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y){ +short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y){ char answer; printf("Moechten Sie die Koordinaten einer weiteren Labyrinthwand angeben? (y/n)\n"); scanf(" %c", &answer); diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index b2160ff..c50580c 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -11,6 +11,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); -short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); +short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 818266ef5e32a5f37626134077edf363dd7d5635 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:36:37 +0100 Subject: [PATCH 073/647] ask_lab_walls --- src/main/c/labyrinth.c | 15 +++++++++++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 06def76..5acb7d5 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -115,3 +115,18 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire return 0; } +void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y){ + unsigned short x, y; + short a; + + init_field(field, len_x, len_y); + + do { + a = get_wall_input(&x, &y, len_x, len_y); + if (a == 0){ + set_wall(field, x, y); + show_solution(field, len_x, len_y); + } + } while (a != 1); +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index c50580c..c731167 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -12,5 +12,6 @@ void show_solution(Field_State** field, unsigned short len_x, unsigned short len unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); +void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 9e00574912d011c872213cde75c5c5895800d705 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:38:24 +0100 Subject: [PATCH 074/647] refactoring: ask_lab_walls --- src/main/c/labyrinth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 5acb7d5..fafbe33 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -117,16 +117,16 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y){ unsigned short x, y; - short a; + short wall_input_continue; init_field(field, len_x, len_y); do { - a = get_wall_input(&x, &y, len_x, len_y); - if (a == 0){ + wall_input_continue = get_wall_input(&x, &y, len_x, len_y); + if (wall_input_continue == 0){ set_wall(field, x, y); show_solution(field, len_x, len_y); } - } while (a != 1); + } while (wall_input_continue != 1); } From 4a697fad046bb4a25f8b8970e1c186e10b5bbda2 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:41:56 +0100 Subject: [PATCH 075/647] calculate_lab_way --- src/main/c/labyrinth.c | 29 +++++++++++++++++++++++++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 30 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index fafbe33..584f88c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -130,3 +130,32 @@ void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len } while (wall_input_continue != 1); } +short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y){ + Direction direction = N; + + unsigned short c_x; + unsigned short c_y; + + if (x == len_x-1 && y == len_y-1){ + field[x][y] = SOLUTION; + return 0; + } + + do { + c_x = x; + c_y = y; + if (lab_can_move(field, c_x, c_y, direction, len_x, len_y) == 0){ + lab_move(&c_x, &c_y, direction); + printf("%d - %d\n", c_x, c_y); + field[c_x][c_y] = SOLUTION; + if (calculate_lab_way(field, len_x, len_y, c_x, c_y) == 0){ + return 0; + } + field[c_x][c_y] = WAY; + } + turn_direction_right(&direction); + } + while (direction != N); + return 1; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index c731167..fc6001c 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -13,5 +13,6 @@ unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y); +short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y); #endif // TEST_H From f1321b298c0fa9895ccf7f055b18722df3de4fdf Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:43:07 +0100 Subject: [PATCH 076/647] refactoring: calculate_lab_way --- src/main/c/labyrinth.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 584f88c..7f3d89f 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -133,8 +133,8 @@ void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y){ Direction direction = N; - unsigned short c_x; - unsigned short c_y; + unsigned short current_x; + unsigned short current_y; if (x == len_x-1 && y == len_y-1){ field[x][y] = SOLUTION; @@ -142,16 +142,16 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor } do { - c_x = x; - c_y = y; - if (lab_can_move(field, c_x, c_y, direction, len_x, len_y) == 0){ - lab_move(&c_x, &c_y, direction); - printf("%d - %d\n", c_x, c_y); - field[c_x][c_y] = SOLUTION; - if (calculate_lab_way(field, len_x, len_y, c_x, c_y) == 0){ + current_x = x; + current_y = y; + if (lab_can_move(field, current_x, current_y, direction, len_x, len_y) == 0){ + lab_move(¤t_x, ¤t_y, direction); + printf("%d - %d\n", current_x, current_y); + field[current_x][current_y] = SOLUTION; + if (calculate_lab_way(field, len_x, len_y, current_x, current_y) == 0){ return 0; } - field[c_x][c_y] = WAY; + field[current_x][current_y] = WAY; } turn_direction_right(&direction); } From ce9b9eab96809fdd4cb6828ef3345c4d57e9bb61 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:43:52 +0100 Subject: [PATCH 077/647] labyrinth --- src/main/c/labyrinth.c | 7 +++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 7f3d89f..70b3f74 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -159,3 +159,10 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor return 1; } +void labyrinth(){ + unsigned short x, y; + + ask_lab_dimensions(&x, &y); + +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index fc6001c..8e9f178 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -14,5 +14,6 @@ void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y); short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y); +void labyrinth(); #endif // TEST_H From 6783b5b8dbdca0337a3b75dc32872c3753c2b62b Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:44:55 +0100 Subject: [PATCH 078/647] refactoring: labyrinth --- src/main/c/labyrinth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 70b3f74..a83f54d 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -160,9 +160,9 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor } void labyrinth(){ - unsigned short x, y; + unsigned short len_x, len_y; - ask_lab_dimensions(&x, &y); + ask_lab_dimensions(&len_x, &len_y); } From 232425ef462c57ef7a9898878f6415d8c392bfa5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:46:05 +0100 Subject: [PATCH 079/647] final piece of cake in labyrinth --- src/main/c/labyrinth.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index a83f54d..221e0f7 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -161,8 +161,28 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor void labyrinth(){ unsigned short len_x, len_y; + Field_State **f; ask_lab_dimensions(&len_x, &len_y); + f = malloc(len_x * sizeof *f); + for (int c_index = 0; c_index < len_x; c_index++){ + f[c_index] = malloc(len_y * sizeof f[c_index]); + } + + ask_lab_walls(f, len_x, len_y); + + if (calculate_lab_way(f, len_x, len_y, 0, 0) == 1){ + printf("Keine Loesung moeglich!\n"); + } + + show_solution(f, len_x, len_y); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(f[c_index]); + } + free(f); + } From e0b81b5611c9bce1ea45980835d65ff971ef0be7 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:47:09 +0100 Subject: [PATCH 080/647] refactoring: labyrinth, final piece of cake --- src/main/c/labyrinth.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 221e0f7..11eaf59 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -161,28 +161,28 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor void labyrinth(){ unsigned short len_x, len_y; - Field_State **f; + Field_State **field; ask_lab_dimensions(&len_x, &len_y); - f = malloc(len_x * sizeof *f); + field = malloc(len_x * sizeof *field); for (int c_index = 0; c_index < len_x; c_index++){ - f[c_index] = malloc(len_y * sizeof f[c_index]); + field[c_index] = malloc(len_y * sizeof field[c_index]); } - ask_lab_walls(f, len_x, len_y); + ask_lab_walls(field, len_x, len_y); - if (calculate_lab_way(f, len_x, len_y, 0, 0) == 1){ + if (calculate_lab_way(field, len_x, len_y, 0, 0) == 1){ printf("Keine Loesung moeglich!\n"); } - show_solution(f, len_x, len_y); + show_solution(field, len_x, len_y); for (int c_index = 0; c_index < len_x; c_index++) { - free(f[c_index]); + free(field[c_index]); } - free(f); + free(field); } From 128bfa21d26b2a424935637176d2be39bac6d918 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:19:55 +0100 Subject: [PATCH 081/647] 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 082/647] =?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 083/647] 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 084/647] =?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 085/647] =?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 086/647] =?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 087/647] =?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 088/647] =?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 089/647] =?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 090/647] =?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 091/647] =?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 092/647] =?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 093/647] =?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 094/647] =?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 095/647] =?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 096/647] =?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 097/647] =?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 098/647] 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 099/647] 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 100/647] 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 101/647] 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 102/647] 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 103/647] 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 104/647] 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 105/647] 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 106/647] 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 107/647] 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 108/647] 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 109/647] 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 110/647] 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 111/647] 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 112/647] 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 113/647] 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 114/647] 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 115/647] 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 116/647] 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 117/647] 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 118/647] 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 119/647] 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 120/647] 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 121/647] 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 122/647] 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 123/647] 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 124/647] 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 125/647] 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 126/647] 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 127/647] 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 128/647] 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 129/647] 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 130/647] 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 131/647] 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 132/647] 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 133/647] 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 134/647] 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 135/647] 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 136/647] 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 137/647] 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 138/647] 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 139/647] 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 140/647] 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 141/647] 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 142/647] 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 143/647] 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 144/647] 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 145/647] 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 146/647] 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 147/647] 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 152fea0f0d3f47f17e9c8d348029b94965e66632 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:40:35 +0100 Subject: [PATCH 148/647] 1 Init Board --- src/main/c/TicTacToe.c | 14 ++++++++++++++ src/main/c/a.exe | Bin 0 -> 42690 bytes 2 files changed, 14 insertions(+) create mode 100644 src/main/c/TicTacToe.c create mode 100644 src/main/c/a.exe diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c new file mode 100644 index 0000000..e011caf --- /dev/null +++ b/src/main/c/TicTacToe.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +// Funktion, um das Spielfeld zu initialisieren +//1 +void Brett(char Feld[3][3]) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + Feld[i][j] = '_'; + } + } +} \ No newline at end of file diff --git a/src/main/c/a.exe b/src/main/c/a.exe new file mode 100644 index 0000000000000000000000000000000000000000..b9e385d1dd5fc87e0a27275592ca9c71612bbfaa GIT binary patch literal 42690 zcmeIb4}4VBwJ*NU%!CXi;}9;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Gr7dxI)t8%+0``29i+I(;Wk!(Ywj5?zm?v|sIN z!Uk9h{);VL)onD~nZWpDD;ug``< zjOl|!Phf9}BKmE1otKOJYl%_AZO(aYgjkHFfmZKCBA9`onG}ah(oaS~t{V-y7QQOITjt7nX)W zz6G$@e`JFX-*CX|%i{LSC8rpx+SpK4itq0XO=6YDyam-?yzx+*xeKhWiY11{;tNya zHY4V)YWR=dm3TNc#IWqX%Y!lBxR}$$e`A84hs{%H|5`K(Br*5g6&`5tqg!z!tO^Hc zjHxUp08PHl#DhBr?GIx(hvkzNbdUJpMO!Qx?I-rm)pPoEj|*-Mxb(oo+FHW>#@qYY zw32=U3Hiq9ha$#}=VHcIy^2Cj9MdT-ev$65k)g%7A!VF_EVgrTENqOO;PJpSe&85y zvudttYzyQuAs{}Wiw06nWuO~%j(pk*4|K6ePto7-FuFA{Bu)HhXyZ%CS8wpqEls94 zAAM;A6PCn(r>3J=H;qPX>E<=V<(NKTiSu27b|cJx?#ODL@fzak^Exi-Uz#IaKq>$K% zGV6VvZ9YG?8L0;_zH7z#r2g>82&HBV#|y~iiS2LBy-7sgL|r&)Z1d?@%UOemrD2+I zm!OZowPWT+oY_UEI-lRE#~WBUzp?RK_v6@Z+n*PZjnNe2hiTl{v`ryZM7+b)DekU> aVEF8u0)f%P^w2rhQWx#LTy%Z)`+os4M^G~W literal 0 HcmV?d00001 From 2107498e6bb3d070cb2aaee847fbb799bd32a4c2 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:41:40 +0100 Subject: [PATCH 149/647] 2 display Board --- src/main/c/TicTacToe.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index e011caf..837e2a2 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -4,11 +4,18 @@ #include // Funktion, um das Spielfeld zu initialisieren -//1 void Brett(char Feld[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Feld[i][j] = '_'; } } +} +void Bild(char Feld[3][3]) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + printf("%c ", Feld[i][j]); + } + printf("\n"); + } } \ No newline at end of file From 403fd219da53cef366d89b28afdde9d0e13e2dcc Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:43:01 +0100 Subject: [PATCH 150/647] 3 del old Board --- src/main/c/TicTacToe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 837e2a2..31999f4 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -12,6 +12,11 @@ void Brett(char Feld[3][3]) { } } void Bild(char Feld[3][3]) { +#ifdef _WIN32 + system("cls"); +#else + system("clear"); +#endif for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { printf("%c ", Feld[i][j]); From 4af9a27662f2e87139e7b8b09d9e6d373d578084 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:45:41 +0100 Subject: [PATCH 151/647] 4 win condition row --- src/main/c/TicTacToe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 31999f4..762fcb3 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -23,4 +23,16 @@ void Bild(char Feld[3][3]) { } printf("\n"); } +} +int Entscheiden(char Feld[3][3]) { + // Überprüfen Sieg + // Überprüfen Reihen + for (int i = 0; i < 3; i++) { + if (Feld[i][0] == Feld[i][1] && Feld[i][1] == Feld[i][2] && Feld[i][0] != '_') { + if (Feld[i][0] == 'X') { + return 1; + } + else return 2; + } + } } \ No newline at end of file From 7b8852835f197bb834d1fd62ed361d9c07510893 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:49:16 +0100 Subject: [PATCH 152/647] refactoring: function winner --- src/main/c/TicTacToe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 762fcb3..d6a2860 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -24,7 +24,7 @@ void Bild(char Feld[3][3]) { printf("\n"); } } -int Entscheiden(char Feld[3][3]) { +int Winner(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { From 54a3160ebe0cedbfd89f05a944fd7e8bed11bb84 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:57:12 +0100 Subject: [PATCH 153/647] 6 erster Test + Header --- src/main/c/TicTacToe.h | 7 +++++++ src/test/c/test_TicTacToe.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/c/TicTacToe.h create mode 100644 src/test/c/test_TicTacToe.c diff --git a/src/main/c/TicTacToe.h b/src/main/c/TicTacToe.h new file mode 100644 index 0000000..1e04a7d --- /dev/null +++ b/src/main/c/TicTacToe.h @@ -0,0 +1,7 @@ +#ifndef TICTACTOE_H +#define TICTACTOE_H + +int Winner(char board[3][3]); + +#endif + diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c new file mode 100644 index 0000000..b1c8b25 --- /dev/null +++ b/src/test/c/test_TicTacToe.c @@ -0,0 +1,29 @@ + +#include "unity.h" + +#include "TicTacToe.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_TicTacToe_Winner_X_line_1(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'X', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} \ No newline at end of file From 535f9a54b0c30211d50629c07034ca212c372f54 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 13:06:34 +0100 Subject: [PATCH 154/647] 7 zweiter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index b1c8b25..f8a1c62 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -26,4 +26,20 @@ void test_TicTacToe_Winner_X_line_1(void) /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_line_2(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'X', 'O', 'X'}, + {'O', 'O', 'O'}, + {'O', 'X', 'X'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From aa593e91a3ef765f6e3933d87430ff0f5e31eb56 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 13:09:37 +0100 Subject: [PATCH 155/647] 8 dritter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index f8a1c62..fc12b42 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -40,6 +40,22 @@ void test_TicTacToe_Winner_O_line_2(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_X_line_3(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'O', '_', '_'}, + {'O', 'O', '_'}, + {'X', 'X', 'X'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 65918b52a6d7ba8175f401ff0e59394aa1ac138c Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:22:49 +0100 Subject: [PATCH 156/647] 9 win condition column --- src/main/c/TicTacToe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index d6a2860..035d6c4 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -35,4 +35,13 @@ int Winner(char Feld[3][3]) { else return 2; } } + // Überprüfen Spalten + for (int j = 0; j < 3; j++) { + if (Feld[0][j] == Feld[1][j] && Feld[1][j] == Feld[2][j] && Feld[0][j] != '_') { + if (Feld[0][j] == 'X') { + return 1; + } + else return 2; + } + } } \ No newline at end of file From 46ae979f08ff3c39ead782c4187b01db9989c6c2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:23:03 +0100 Subject: [PATCH 157/647] 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 8b7146705acce6a764bc2b0b9901d3c1e7d4d7e1 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:26:03 +0100 Subject: [PATCH 158/647] 10 vierter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index fc12b42..57809a8 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -56,6 +56,22 @@ void test_TicTacToe_Winner_X_line_3(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_col_1(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'O', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 6a30e7372ca7ea669dcffe32357123c608c31048 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:28:06 +0100 Subject: [PATCH 159/647] =?UTF-8?q?11=20f=C3=BCnfter=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index 57809a8..d65895b 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -72,6 +72,22 @@ void test_TicTacToe_Winner_O_col_1(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_X_col_2(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'O', 'X', 'X'}, + {'_', 'X', 'O'}, + {'O', 'X', '_'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From ff4961c714bd5b80b2078734227002a5e69e34e5 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:33:31 +0100 Subject: [PATCH 160/647] 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 161/647] 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 162/647] =?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 163/647] =?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 164/647] =?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 165/647] =?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 166/647] =?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 167/647] =?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 168/647] 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 169/647] 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 zcmc&)e{5XGao)R=B8sFW>X$8&mic5$2$@>P<8RS!VM?S_%B2mLavTLw@OZp?BCk5$ zo!=cTS(0HkG7trJP+uV=0-RP#;2@Ndp!&msNx+EhC_o(42FDuh-rUkH@sCb`~Ew=}HHFp_~n$D$k zh8-bP!^ zX|Fl^Og86?H4i6J&B;XSgyVL$6D#%qc|6pg{i(Q{PQ($FO1Z6_!yunIwM4oj-7T#= z%AZ-yGC{I)%Q94{4XfZ3o-6S`unOL`3f{d6u2j(TkNg-=J>cc=SFsH=Yl4cySNnM# z5bB3aA!JRm?POv&W+zgKoU-lMsi+;zIj3~Nbw&~xKo`jIw0lBj+(asOTxDa?6yADl z6$yv4X*F>8K(A_!M{`m0ilxWG5FHyo)qFgWbh6FkSrmj52(dgkhqPvF^x(ACNs4%IiEXOe=fU+l#R5GZ z+&kaCm>RkEMlzQeajb)h)JSyL30nsextwF2y!Ogy(y^RG%CU}QqDerfPbRXlQ72`! zSmUX<)fKK(eF?{kj%P<4%?=)B#UNS3j_V|HSaKd_ShjV*h- znjW;kJf`+!_hfaZEMt+;Fv$9I=VT(4a@<{&MsdrS+KWW44Ah4ndIfYVo(J%H12hBr zA?Wj<^PrbO*I;n3g6;s_ylyy*E%_-Jl?**R)YA z1bxKRx3_O&q`!J+&EE(A4nagR6ecgCejC*z5j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y*~v;{u6omJC9jD2(VD+O(HMY&yn%U>x*)# z>{f7j*b_m|&?EVUoO<4qzz=LL}`UP?l7r&o%7UBRyiA1oZ@ s`9wtvkF+oI?_Yt5?Z}qWdEP(XEFmT%?Fu}P%u4bTyl=F9^T#j$-$UwV$N&HU literal 0 HcmV?d00001 From 36ba25bcdae6b6d0293e91a5a46e354fc652421e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 16:59:34 +0100 Subject: [PATCH 170/647] 12 sechster Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index d65895b..f0d5ab7 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -88,6 +88,22 @@ void test_TicTacToe_Winner_X_col_2(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_col_3(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'X', 'X', 'O'}, + {'_', 'O', 'O'}, + {'_', '_', 'O'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 47eadc816640b331792e8bbf545c6eb3fb7e5fe4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:01:40 +0100 Subject: [PATCH 171/647] 13 win condition diagonal --- src/main/c/TicTacToe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 035d6c4..14e960e 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -44,4 +44,13 @@ int Winner(char Feld[3][3]) { else return 2; } } + // Überprüfen Diagonalen + if ((Feld[0][0] == Feld[1][1] && Feld[1][1] == Feld[2][2]) || (Feld[0][2] == Feld[1][1] && Feld[1][1] == Feld[2][0])) { + if (Feld[1][1] != '_') { + if (Feld[1][1] == 'X') { + return 1; + } + else return 2; + } + } } \ No newline at end of file From cb7a7bc6682401d132f5734543df7d29ef286fed Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:04:28 +0100 Subject: [PATCH 172/647] 14 siebter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index f0d5ab7..0dc4844 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -104,6 +104,22 @@ void test_TicTacToe_Winner_O_col_3(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_X_diagonal_1(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'X', 'O', 'X'}, + {'O', 'X', 'O'}, + {'O', '_', 'X'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From f1d5198ae9bcb40bb4f20ef9383d687cb4d662db Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:05:25 +0100 Subject: [PATCH 173/647] 15 achter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index 0dc4844..fd80b53 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -120,6 +120,22 @@ void test_TicTacToe_Winner_X_diagonal_1(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_diagonal_2(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'O', 'X', 'O'}, + {'X', 'O', 'X'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 98f46f8da8299c0ac08b4137cbc4ed68112307d8 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:07:52 +0100 Subject: [PATCH 174/647] Commit 1 code --- src/main/c/sudoku.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/c/sudoku.c diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c new file mode 100644 index 0000000..8e7d480 --- /dev/null +++ b/src/main/c/sudoku.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +#define SIZE 9 +#define EMPTY 0 +#define LEVEL_NUMBER 3 + + +int difficulty; +int selected_level; + + +void startSudoku(); //is instead of main + +void startSudoku() { + int grid[SIZE][SIZE]; + selected_level = 0; + + while (1) { + printf("\nDifficulty Function - Choose difficulty:\n"); + printf("1. Easy\n2. Medium\n3. Hard\n"); + printf("Enter the corresponding number or type 'quit' to exit: "); + + char input[10]; + scanf("%s", input); + + if (strcmp(input, "quit") == 0) { + break; + } + + difficulty = input[0] - '0'; // Convert the first character to an integer + + if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { + printf("Input is correct"); + } else { + printf("Invalid input. Please enter a number between 1 and 3.\n"); + } + + } +} + +int main(){ + startSudoku(); + return 0; +} \ No newline at end of file From c021ee3a8829b5e933776d571aa5f4ad99d0ab8e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:08:24 +0100 Subject: [PATCH 175/647] 16 check round --- src/main/c/TicTacToe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 14e960e..72f52ae 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -53,4 +53,13 @@ int Winner(char Feld[3][3]) { else return 2; } } + //Überprüfe Runde + for (int k = 0; k < 3; k++) { + for (int l = 0; l < 3; l++) { + if (Feld[k][l] == '_') { + return 9; + } + } + } + } \ No newline at end of file From 8afce67efadd0f6e1496cab71c8b59b52300517f Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:08:26 +0100 Subject: [PATCH 176/647] Commit 2 code --- src/main/c/sudoku.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 8e7d480..a065a5d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,3 +1,8 @@ + + + + + #include #include #include @@ -13,6 +18,8 @@ int selected_level; void startSudoku(); //is instead of main +void availableLevelsFunction(int difficulty); + void startSudoku() { int grid[SIZE][SIZE]; @@ -33,7 +40,7 @@ void startSudoku() { difficulty = input[0] - '0'; // Convert the first character to an integer if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { - printf("Input is correct"); + availableLevelsFunction(difficulty); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -41,6 +48,11 @@ void startSudoku() { } } +void availableLevelsFunction(int difficulty) { + printf("\nAvailable Levels for Difficulty %d:\n", difficulty); + +} + int main(){ startSudoku(); return 0; From 577426a70c8b2d0f5622ba0bcb3dd58c72c63ff1 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Wed, 7 Feb 2024 17:08:59 +0100 Subject: [PATCH 177/647] refactoring: labyrinth --> start_labyrinth_game --- src/main/c/labyrinth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 11eaf59..bdad7fb 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -159,7 +159,7 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor return 1; } -void labyrinth(){ +void start_labyrinth_game(){ unsigned short len_x, len_y; Field_State **field; From 0df5a54a96546030940bf01ab52f61e5ac0a7396 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:09:52 +0100 Subject: [PATCH 178/647] Commit 3 code --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index a065a5d..4ea2db4 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,8 +1,6 @@ - - #include #include #include @@ -50,7 +48,9 @@ void startSudoku() { void availableLevelsFunction(int difficulty) { printf("\nAvailable Levels for Difficulty %d:\n", difficulty); - + for (int i = 0; i < LEVEL_NUMBER; i++) { + printf("%d. Level %d\n", i + 1, i + 1); + } } int main(){ From 56f81ee41ad3a3681d345b4072045f6a1d27a8ad Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:10:18 +0100 Subject: [PATCH 179/647] Commit 4 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 4ea2db4..dac8629 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -17,7 +17,7 @@ int selected_level; void startSudoku(); //is instead of main void availableLevelsFunction(int difficulty); - +void selectLevel(int grid[SIZE][SIZE]); void startSudoku() { int grid[SIZE][SIZE]; @@ -39,6 +39,7 @@ void startSudoku() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { availableLevelsFunction(difficulty); + selectLevel(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -53,6 +54,22 @@ void availableLevelsFunction(int difficulty) { } } + + +void selectLevel(int grid[SIZE][SIZE]) { + int level = 0; + printf("\nSelect a level:\n"); + + + +} + + + + + + + int main(){ startSudoku(); return 0; From 7dc3d6e0f94095f26fa0f86419c621263b9e2f68 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:11:20 +0100 Subject: [PATCH 180/647] Commit 5 code --- src/main/c/sudoku.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index dac8629..4329efc 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,6 +1,3 @@ - - - #include #include #include @@ -59,7 +56,21 @@ void availableLevelsFunction(int difficulty) { void selectLevel(int grid[SIZE][SIZE]) { int level = 0; printf("\nSelect a level:\n"); - + while (true){ + char level_select[10]; + scanf("%s", level_select); + + + level = level_select[0] - '0'; // Convert the first character to an integer + + if ((level >= 1 && level <= 3) && level_select[1] == '\0') { + printf("Input is correct"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 3.\n"); + + } + } } From 6534e2e59690fc0b5a09c1ca9f5626e75c61c8d1 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:12:27 +0100 Subject: [PATCH 181/647] Commit 6 code --- src/main/c/sudoku.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 4329efc..87089c0 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -15,6 +15,9 @@ int selected_level; void startSudoku(); //is instead of main void availableLevelsFunction(int difficulty); void selectLevel(int grid[SIZE][SIZE]); +void initializeGrid(int grid[SIZE][SIZE]); +void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); + void startSudoku() { int grid[SIZE][SIZE]; @@ -64,17 +67,39 @@ void selectLevel(int grid[SIZE][SIZE]) { level = level_select[0] - '0'; // Convert the first character to an integer if ((level >= 1 && level <= 3) && level_select[1] == '\0') { - printf("Input is correct"); + selected_level = level; + + level--; // Adjust to 0-based index + + generateSudoku(grid, difficulty, selected_level); break; } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); - + } } } +void initializeGrid(int grid[SIZE][SIZE]) { + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = EMPTY; + } + } +} + +void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { + initializeGrid(grid); + printf("Level is getting initialized"); + + +} + + + + From 4f1c6d2516f2c770dfd716e6a023692803b098b2 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:03 +0100 Subject: [PATCH 182/647] Commit 7 code --- src/main/c/sudoku.c | 102 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 87089c0..dcdfb7b 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,3 +1,6 @@ + + + #include #include #include @@ -19,6 +22,104 @@ void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); +int availableLevels[3][3][SIZE][SIZE] = { + { //easy + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 1}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 2}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0},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0, 0}} + }, + + {//hard + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}} + } +}; + + void startSudoku() { int grid[SIZE][SIZE]; selected_level = 0; @@ -93,6 +194,7 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); printf("Level is getting initialized"); + } From 818253186debf50ed4395abc36130751baa305f0 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:17 +0100 Subject: [PATCH 183/647] Commit 8 code --- src/main/c/sudoku.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index dcdfb7b..f877f62 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,6 +1,5 @@ - #include #include #include @@ -32,7 +31,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 1}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -42,7 +41,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 2}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -52,7 +51,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 3}}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}}, {//medium {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -194,7 +193,11 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); printf("Level is getting initialized"); - + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; + } + } } From 1742cbf7f16893f7225547b92e5b199b4fa111cb Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:43 +0100 Subject: [PATCH 184/647] Commit 9 code --- src/main/c/sudoku.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index f877f62..3ee5b72 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,5 +1,9 @@ + + + + #include #include #include @@ -198,6 +202,12 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; } } + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + printf("%d", grid[i][j]); + } + printf("\n"); + } } From 33dbddd780357f4a286be557123ad3c314eb3808 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:59 +0100 Subject: [PATCH 185/647] Commit 10 code --- src/main/c/sudoku.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 3ee5b72..41f512f 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -23,6 +23,7 @@ void availableLevelsFunction(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); +void turnFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -144,6 +145,7 @@ void startSudoku() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { availableLevelsFunction(difficulty); selectLevel(grid); + turnFunction(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -196,7 +198,6 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); - printf("Level is getting initialized"); for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; @@ -212,7 +213,9 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { } - +void turnFunction(int grid[SIZE][SIZE]) { + printf("\nTurn function - Choose an action:\n"); +} From ee80c6e1ccab100317a22bd9b4f36ca8e25d6e2f Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:15 +0100 Subject: [PATCH 186/647] Commit 11 code --- src/main/c/sudoku.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 41f512f..2c82cfd 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -215,6 +215,21 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); + + int action; + + while (true){ + char action_str[10]; + scanf("%s", action_str); + + action = action_str[0] - '0'; // Convert the first character to an integer + + if ((action >= 1 && action <= 6) && action_str[1] == '\0') { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 6.\n"); + } + } } From 00504715f1d26ecb630884ac49d7dc93f9208a27 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:27 +0100 Subject: [PATCH 187/647] Commit 12 code --- src/main/c/sudoku.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 2c82cfd..8d0de5c 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -230,6 +230,29 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 6.\n"); } } + + switch (action) { + case 1: + printf("Case 1.\n"); + break; + case 2: + printf("Case 2.\n"); + break; + case 3: + printf("Case 3.\n"); + break; + case 4: + printf("Case 4.\n"); + break; + case 5: + printf("Case 5.\n"); + break; + case 6: + printf("Case 6.\n"); + break; + default: + printf("Invalid input. Please enter a number between 1 and 6.\n"); + } } From 8bd82443fc0fcf84888c8186a510933a103d23bb Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:43 +0100 Subject: [PATCH 188/647] Commit 13 code --- src/main/c/sudoku.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 8d0de5c..7d3d57d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -24,6 +24,7 @@ void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); +void tipFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -256,7 +257,9 @@ void turnFunction(int grid[SIZE][SIZE]) { } - +void tipFunction(int grid[SIZE][SIZE]) { + printf("\nTip function - Choose an option:\n"); +} From 087ace082ea2c6fa13165fdb9865749629f85d78 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:57 +0100 Subject: [PATCH 189/647] Commit 14 code --- src/main/c/sudoku.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 7d3d57d..8f5f0b0 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -216,6 +216,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); + printf("1. Tip function\n"); int action; @@ -234,7 +235,7 @@ void turnFunction(int grid[SIZE][SIZE]) { switch (action) { case 1: - printf("Case 1.\n"); + tipFunction(grid); break; case 2: printf("Case 2.\n"); From 95e096b756294ba49e793686dc453ad9103ff86e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:15:00 +0100 Subject: [PATCH 190/647] 17 neuneter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index fd80b53..53292e3 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -136,6 +136,22 @@ void test_TicTacToe_Winner_O_diagonal_2(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_mid_Round(void) +{ + /* arrange */ + int expected = 9; + int actual; + char board[3][3] = { + {'X', 'X', 'O'}, + {'_', 'O', 'X'}, + {'_', '_', 'O'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 6f35efdf81ebcfcc7ddaca03e90212d9e1a3b59d Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:12 +0100 Subject: [PATCH 191/647] Commit 15 code --- src/main/c/sudoku.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 8f5f0b0..5b76aca 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -260,6 +260,22 @@ void turnFunction(int grid[SIZE][SIZE]) { void tipFunction(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); + + int option = 0; + + while (true){ + char tip_str[10]; + scanf("%s", tip_str); + + + option = tip_str[0] - '0'; // Convert the first character to an integer + + if ((option >= 1 && option <= 3) && tip_str[1] == '\0') { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 3.\n"); + } + } } From c4b2846039bb1a8be76e414c420f363ba78e5344 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:36 +0100 Subject: [PATCH 192/647] Commit 16 code --- src/main/c/sudoku.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 5b76aca..93ec660 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -260,6 +260,10 @@ void turnFunction(int grid[SIZE][SIZE]) { void tipFunction(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); + printf("1. Set the user-specified cell to the right value\n"); + printf("2. Set the user-specified 3x3 field to the right values\n"); + printf("3. Solve the entire puzzle for the current level\n"); + int option = 0; @@ -276,6 +280,22 @@ void tipFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 3.\n"); } } + + switch (option) { + case 1: + printf("Case 1\n"); + break; + + case 2: + printf("Case 2\n"); + break; + + case 3: + printf("Case 3\n"); + break; + default: + printf("Invalid option. Please enter a number between 1 and 3.\n"); + } } From e0170a538f0cbe812765af73c37a9bfc15f68e7b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:49 +0100 Subject: [PATCH 193/647] Commit 17 code --- src/main/c/sudoku.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 93ec660..560e174 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -124,6 +124,104 @@ int availableLevels[3][3][SIZE][SIZE] = { } }; +int solutionLevels[3][3][SIZE][SIZE] = { + + { //easy + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 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, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}} + } +}; + void startSudoku() { int grid[SIZE][SIZE]; From 567bb758eb4a09b3d902dda269db5530f040d532 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:16:14 +0100 Subject: [PATCH 194/647] Commit 18 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 560e174..792f227 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -381,7 +381,24 @@ void tipFunction(int grid[SIZE][SIZE]) { switch (option) { case 1: - printf("Case 1\n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row, col; + + while (true){ + char row_str[10]; + char col_str[10]; + scanf("%s %s", row_str, col_str); + + + row = row_str[0] - '0'; // Convert the first character to an integer + col = col_str[0] - '0'; // Convert the first character to an integer + + if (((row >= 1 && row <= 9) && row_str[1] == '\0') && ((col >= 1 && col <= 9) && col_str[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 2: From f9c88ccc940acd3ed5eef5eb6e029a1545c7bc16 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:16:21 +0100 Subject: [PATCH 195/647] 18 win condition Tie --- src/main/c/TicTacToe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 72f52ae..29ac1fe 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -61,5 +61,7 @@ int Winner(char Feld[3][3]) { } } } - + //Bestätige Unendschieden + printf("Es ist ein Unendschieden\n"); + return 0; } \ No newline at end of file From 779dd7ecceb127e9ecefd61d80c8db57bb4fb20d Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:16:26 +0100 Subject: [PATCH 196/647] Commit 19 code --- src/main/c/sudoku.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 792f227..353c70b 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -399,6 +399,8 @@ void tipFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 9.\n"); } } + grid[row - 1][col - 1] = solutionLevels[difficulty - 1][selected_level - 1][row - 1][col - 1]; + printf("Value set successfully.\n"); break; case 2: From 7d583c0f215422d3d82dbf2c6729b0e9168c5445 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:16:37 +0100 Subject: [PATCH 197/647] Commit 20 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 353c70b..23ee743 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -404,7 +404,24 @@ void tipFunction(int grid[SIZE][SIZE]) { break; case 2: - printf("Case 2\n"); + printf("Enter the coordinates (top-left cell of the 3x3 field) separated by space:\n"); + int startRow, startCol; + + while (true){ + char row_squ[10]; + char col_squ[10]; + scanf("%s %s", row_squ, col_squ); + + + startRow = row_squ[0] - '0'; // Convert the first character to an integer + startCol = col_squ[0] - '0'; // Convert the first character to an integer + + if (((startRow >= 1 && startRow <= 9) && row_squ[1] == '\0') && ((startCol >= 1 && startCol <= 9) && col_squ[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 3: From 32a05ff7eb3c9393b5a77eb0bde1a83bdcd5721c Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:17:22 +0100 Subject: [PATCH 198/647] 19 letzter Test --- src/test/c/test_TicTacToe.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index 53292e3..a6e0cf9 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -62,18 +62,18 @@ void test_TicTacToe_Winner_X_line_3(void) void test_TicTacToe_Winner_O_col_1(void) { /* arrange */ - int expected = 2; - int actual; - char board[3][3] = { - {'O', 'X', 'X'}, - {'O', 'O', '_'}, - {'O', '_', '_'} - }; + int expected = 2; + int actual; + char board[3][3] = { + {'O', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; /* act */ - actual = Winner(board); + actual = Winner(board); /* assert */ - TEST_ASSERT_EQUAL_INT(expected, actual); + TEST_ASSERT_EQUAL_INT(expected, actual); } void test_TicTacToe_Winner_X_col_2(void) { @@ -154,4 +154,20 @@ void test_TicTacToe_mid_Round(void) /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); -} \ No newline at end of file +} +void test_TicTacToe_Tie(void) +{ + /* arrange */ + int expected = 0; + int actual; + char board[3][3] = { + {'X', 'X', 'O'}, + {'O', 'O', 'X'}, + {'X', 'X', 'O'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} From 50c89e2a4485d8b574a5cb7132385af3ea28a8d9 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:18:15 +0100 Subject: [PATCH 199/647] Commit 21 code --- src/main/c/sudoku.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 23ee743..9b6b0f5 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -422,6 +422,13 @@ void tipFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 9.\n"); } } + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + grid[startRow - 1 + i][startCol - 1 + j] = + solutionLevels[difficulty - 1][selected_level - 1][startRow - 1 + i][startCol - 1 + j]; + } + } + printf("3x3 field set successfully.\n"); break; case 3: From 92d7f78edd282162fb1926839722b1e26a7ea17c Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:18:26 +0100 Subject: [PATCH 200/647] Commit 22 code --- src/main/c/sudoku.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 9b6b0f5..65e0e50 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -432,7 +432,12 @@ void tipFunction(int grid[SIZE][SIZE]) { break; case 3: - printf("Case 3\n"); + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = solutionLevels[difficulty - 1][selected_level - 1][i][j]; + } + } + printf("Puzzle solved. \n"); break; default: printf("Invalid option. Please enter a number between 1 and 3.\n"); From d8f815a58d068fd49b69b2066c40a12f9a02439d Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:18:48 +0100 Subject: [PATCH 201/647] Commit 23 code --- src/main/c/sudoku.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 65e0e50..77122dc 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -25,6 +25,7 @@ void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); +void inputFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -315,6 +316,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); + printf("2. Input function\n"); int action; @@ -336,7 +338,7 @@ void turnFunction(int grid[SIZE][SIZE]) { tipFunction(grid); break; case 2: - printf("Case 2.\n"); + inputFunction(grid); break; case 3: printf("Case 3.\n"); @@ -444,7 +446,11 @@ void tipFunction(int grid[SIZE][SIZE]) { } } +void inputFunction(int grid[SIZE][SIZE]) { + printf("\nInput function - Choose an action:\n"); + +} From ec2928b40a4a5a0fa6f7b0205f3152071e112a3f Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:19:02 +0100 Subject: [PATCH 202/647] Commit 24 code --- src/main/c/sudoku.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 77122dc..705e694 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -448,8 +448,35 @@ void tipFunction(int grid[SIZE][SIZE]) { void inputFunction(int grid[SIZE][SIZE]) { printf("\nInput function - Choose an action:\n"); + printf("1. Insert value in an empty field\n"); + printf("2. Clear an already filled field\n"); - + int action; + + while (true){ + char in_str[10]; + scanf("%s", in_str); + + action = in_str[0] - '0'; // Convert the first character to an integer + + if ((action >= 1 && action <= 2) && in_str[1] == '\0') { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 2.\n"); + } + } + + switch (action) { + case 1: + printf("Case 1 \n"); + break; + + case 2: + printf("Case 2 \n"); + break; + default: + printf("Invalid input. Please enter 1 or 2.\n"); + } } From 2318c9e395241f1a55c68a428170931f5b9f1cd2 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:19:14 +0100 Subject: [PATCH 203/647] Commit 25 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 705e694..51551e1 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -468,7 +468,24 @@ void inputFunction(int grid[SIZE][SIZE]) { switch (action) { case 1: - printf("Case 1 \n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row_e, col_e, num; + + + while (true){ + char rowe_str[10]; + char cole_str[10]; + scanf("%s %s", rowe_str, cole_str); + + row_e = rowe_str[0] - '0'; // Convert the first character to an integer + col_e = cole_str[0] - '0'; // Convert the first character to an integer + + if (((row_e >= 1 && row_e <= 9) && rowe_str[1] == '\0') && ((col_e >= 1 && col_e <= 9) && cole_str[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 2: From 35fa2b71ffe3a19040104ba1a1e96d7a0eefce73 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:20:01 +0100 Subject: [PATCH 204/647] 20 move O --- src/main/c/TicTacToe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 29ac1fe..024f326 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -3,6 +3,7 @@ #include #include +int Zaehler = 1; // Funktion, um das Spielfeld zu initialisieren void Brett(char Feld[3][3]) { for (int i = 0; i < 3; i++) { @@ -64,4 +65,11 @@ int Winner(char Feld[3][3]) { //Bestätige Unendschieden printf("Es ist ein Unendschieden\n"); return 0; +} +void Zuege(char Feld[3][3], int row, int col) { + if (Zaehler % 2 == 0) { + if (Feld[row][col] == '_') { + Feld[row][col] = 'O'; + } + } } \ No newline at end of file From 63f52c7292e4785a2af28e1acecb33add2d9e401 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:19 +0100 Subject: [PATCH 205/647] Commit 26 code --- src/main/c/sudoku.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 51551e1..74e1c47 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -485,6 +485,25 @@ void inputFunction(int grid[SIZE][SIZE]) { } else { printf("Invalid input. Please enter a number between 1 and 9.\n"); } + } + printf("Enter the value to insert (1-9):\n"); + + + + + while (true){ + char nume_str[10]; + scanf("%s", nume_str); + + num = nume_str[0] - '0'; // Convert the first character to an integer + + if ((num >= 1 && num <= 9) && nume_str[1] == '\0') { + grid[row_e - 1][col_e - 1] = num; + printf("Value inserted successfully.\n"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } } break; From 89a79037c483c3151741e6906844630256d93b4d Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:33 +0100 Subject: [PATCH 206/647] Commit 27 code --- src/main/c/sudoku.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 74e1c47..fd4b62d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -508,11 +508,31 @@ void inputFunction(int grid[SIZE][SIZE]) { break; case 2: - printf("Case 2 \n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row_d, col_d; + + + while (true){ + char rowd_str[10]; + char cold_str[10]; + scanf("%s %s", rowd_str, cold_str); + + row_d = rowd_str[0] - '0'; // Convert the first character to an integer + col_d = cold_str[0] - '0'; // Convert the first character to an integer + + if (((row_d >= 1 && row_d <= 9) && rowd_str[1] == '\0') && ((col_d >= 1 && col_d <= 9) && cold_str[1] == '\0')) { + grid[row_d - 1][col_d - 1] = 0; + printf("Cell cleared successfully.\n"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; default: printf("Invalid input. Please enter 1 or 2.\n"); } + } From 334825f98783cd8bdf6c839b0f2bfad2be0d2a09 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:20:41 +0100 Subject: [PATCH 207/647] 21 move X --- src/main/c/TicTacToe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 024f326..d46d3b3 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -69,7 +69,12 @@ int Winner(char Feld[3][3]) { void Zuege(char Feld[3][3], int row, int col) { if (Zaehler % 2 == 0) { if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; + Feld[row][col] = 'O'; + } + } + else { + if (Feld[row][col] == '_') { + Feld[row][col] = 'X'; } } } \ No newline at end of file From 3c7511ddfa46bd5d56f194e011c5a351b7870671 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:52 +0100 Subject: [PATCH 208/647] Commit 28 code --- src/main/c/sudoku.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index fd4b62d..a9e5590 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -26,6 +26,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); +void printGrid(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -317,6 +318,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); printf("2. Input function\n"); + printf("3. Print Sudoku grid\n"); int action; @@ -341,7 +343,7 @@ void turnFunction(int grid[SIZE][SIZE]) { inputFunction(grid); break; case 3: - printf("Case 3.\n"); + printGrid(grid); break; case 4: printf("Case 4.\n"); @@ -536,6 +538,16 @@ void inputFunction(int grid[SIZE][SIZE]) { } +void printGrid(int grid[SIZE][SIZE]) { + printf("\nSudoku Grid:\n"); + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + printf("%d ", grid[i][j]); + } + printf("\n"); + } +} + int main(){ startSudoku(); From 62fdbbc74a29d1ed04b4d57b4239ab8c6f6148e1 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:21:05 +0100 Subject: [PATCH 209/647] Commit 29 code --- src/main/c/sudoku.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index a9e5590..ddff311 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -514,7 +514,7 @@ void inputFunction(int grid[SIZE][SIZE]) { int row_d, col_d; - while (true){ + while (true){ char rowd_str[10]; char cold_str[10]; scanf("%s %s", rowd_str, cold_str); @@ -534,7 +534,7 @@ void inputFunction(int grid[SIZE][SIZE]) { default: printf("Invalid input. Please enter 1 or 2.\n"); } - + printGrid(grid); } From ed81534dea235eee339c461b0febab0aecdc7c99 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:21:22 +0100 Subject: [PATCH 210/647] Commit 30 code --- src/main/c/sudoku.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index ddff311..cc5739c 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -315,6 +315,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { } void turnFunction(int grid[SIZE][SIZE]) { + while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); printf("2. Input function\n"); @@ -357,9 +358,11 @@ void turnFunction(int grid[SIZE][SIZE]) { default: printf("Invalid input. Please enter a number between 1 and 6.\n"); } + } } + void tipFunction(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); From cee1f107fe2adcbaa2908c84fee7b2ca8cace614 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:21:42 +0100 Subject: [PATCH 211/647] Commit 31 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index cc5739c..ef28e84 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -27,6 +27,7 @@ void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); +void doneFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -320,6 +321,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("1. Tip function\n"); printf("2. Input function\n"); printf("3. Print Sudoku grid\n"); + printf("4. Done function\n"); int action; @@ -347,7 +349,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printGrid(grid); break; case 4: - printf("Case 4.\n"); + doneFunction(grid); break; case 5: printf("Case 5.\n"); @@ -551,6 +553,21 @@ void printGrid(int grid[SIZE][SIZE]) { } } +void doneFunction(int grid[SIZE][SIZE]) { + printf("\nDone function - Checking if the solution is correct...\n"); + + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + if (grid[i][j] != solutionLevels[difficulty - 1][selected_level - 1][i][j]) { + printf("Incorrect solution. Keep trying!\n"); + return; + } + } + } + + printf("Congratulations! Sudoku is solved correctly.\n"); +} + int main(){ startSudoku(); From 36cc949e9f0e3684aa2b2efeef5c9abeed2e3bac Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:22:16 +0100 Subject: [PATCH 212/647] Commit 32 code --- src/main/c/sudoku.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index ef28e84..4f8b1ce 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -30,6 +30,7 @@ void printGrid(int grid[SIZE][SIZE]); void doneFunction(int grid[SIZE][SIZE]); + int availableLevels[3][3][SIZE][SIZE] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -50,7 +51,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 0}}, + {5, 0, 0, 7, 0, 3, 2, 0, 2}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -322,6 +323,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("2. Input function\n"); printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); + printf("5. Select level\n"); int action; @@ -352,7 +354,7 @@ void turnFunction(int grid[SIZE][SIZE]) { doneFunction(grid); break; case 5: - printf("Case 5.\n"); + selectLevel(grid); break; case 6: printf("Case 6.\n"); From 1e3ebab6949aa66754f42f06481e68ff810b0d5d Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:22:16 +0100 Subject: [PATCH 213/647] 22 belegtes Feld O --- src/main/c/TicTacToe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index d46d3b3..17f75bb 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -71,6 +71,14 @@ void Zuege(char Feld[3][3], int row, int col) { if (Feld[row][col] == '_') { Feld[row][col] = 'O'; } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } else { if (Feld[row][col] == '_') { From 4a2a0afae351b73636fae67f4f723ee7f996b0e5 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:22:46 +0100 Subject: [PATCH 214/647] Commit 33 code --- src/main/c/sudoku.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 4f8b1ce..6ea434e 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -9,6 +9,7 @@ #include #include + #define SIZE 9 #define EMPTY 0 #define LEVEL_NUMBER 3 @@ -324,6 +325,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); printf("5. Select level\n"); + printf("6. Quit\n"); int action; @@ -357,8 +359,8 @@ void turnFunction(int grid[SIZE][SIZE]) { selectLevel(grid); break; case 6: - printf("Case 6.\n"); - break; + printf("Exiting Sudoku program.\n"); + exit(0); default: printf("Invalid input. Please enter a number between 1 and 6.\n"); } From 6052ef0c2db46e057aa3d43dfa7098c44ae6b851 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:22:56 +0100 Subject: [PATCH 215/647] 23 belegtes Feld X --- src/main/c/TicTacToe.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 17f75bb..c4de506 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -25,7 +25,8 @@ void Bild(char Feld[3][3]) { printf("\n"); } } -int Winner(char Feld[3][3]) { +int Winner +(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { @@ -69,7 +70,7 @@ int Winner(char Feld[3][3]) { void Zuege(char Feld[3][3], int row, int col) { if (Zaehler % 2 == 0) { if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; + Feld[row][col] = 'O'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); @@ -84,5 +85,13 @@ void Zuege(char Feld[3][3], int row, int col) { if (Feld[row][col] == '_') { Feld[row][col] = 'X'; } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } } \ No newline at end of file From 6f0245fd3b47f6a558700093d84b9d850f165af9 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:24:23 +0100 Subject: [PATCH 216/647] 24 start Hauptfunktion --- src/main/c/TicTacToe.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index c4de506..ed21c57 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -25,8 +25,7 @@ void Bild(char Feld[3][3]) { printf("\n"); } } -int Winner -(char Feld[3][3]) { +int Winner(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { @@ -94,4 +93,21 @@ void Zuege(char Feld[3][3], int row, int col) { Zuege(Feld, row, col); } } +} +// Hauptfunktion zum Spielen des Tic Tac Toe-Spiels +int mainx() { + int row; + int col; + char Feld[3][3]; + Brett(Feld); + Bild(Feld); + if (Zaehler % 2 != 0) { + printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + } + else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); } \ No newline at end of file From 0eb3a3f1a62b7d3dbc85f6bf000c2fa128851960 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:25:26 +0100 Subject: [PATCH 217/647] 25 Nachfrage optimiert --- src/main/c/TicTacToe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index ed21c57..8f3df43 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -105,8 +105,10 @@ int mainx() { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); row -= 1; col -= 1; Zuege(Feld, row, col); From b918a40c3bb57463aed6e43edc9c5467aeb3a17b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:32:07 +0100 Subject: [PATCH 218/647] refactoring: 1 --- src/main/c/sudoku.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 6ea434e..1b0827d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -9,7 +9,6 @@ #include #include - #define SIZE 9 #define EMPTY 0 #define LEVEL_NUMBER 3 @@ -20,7 +19,7 @@ int selected_level; void startSudoku(); //is instead of main -void availableLevelsFunction(int difficulty); +void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); @@ -247,7 +246,7 @@ void startSudoku() { difficulty = input[0] - '0'; // Convert the first character to an integer if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { - availableLevelsFunction(difficulty); + Level_Pool(difficulty); selectLevel(grid); turnFunction(grid); } else { @@ -257,7 +256,7 @@ void startSudoku() { } } -void availableLevelsFunction(int difficulty) { +void Level_Pool(int difficulty) { printf("\nAvailable Levels for Difficulty %d:\n", difficulty); for (int i = 0; i < LEVEL_NUMBER; i++) { printf("%d. Level %d\n", i + 1, i + 1); From cef6f153b9cffe17bd1a3901d8abd561a9bfe0b7 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:32:47 +0100 Subject: [PATCH 219/647] refactoring: 2 --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 1b0827d..ee41b13 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -18,7 +18,7 @@ int difficulty; int selected_level; -void startSudoku(); //is instead of main +void Game_loop(); //is instead of main void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); @@ -227,7 +227,7 @@ int solutionLevels[3][3][SIZE][SIZE] = { }; -void startSudoku() { +void Game_loop() { int grid[SIZE][SIZE]; selected_level = 0; @@ -573,6 +573,6 @@ void doneFunction(int grid[SIZE][SIZE]) { int main(){ - startSudoku(); + Game_loop(); return 0; } \ No newline at end of file From 1b26c155545ba2c8f13dd04d4c8362f06caa8742 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:33:05 +0100 Subject: [PATCH 220/647] refactoring: 3 --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index ee41b13..d7f0b73 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -22,7 +22,7 @@ void Game_loop(); //is instead of main void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); -void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); +void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); @@ -280,7 +280,7 @@ void selectLevel(int grid[SIZE][SIZE]) { level--; // Adjust to 0-based index - generateSudoku(grid, difficulty, selected_level); + create_playing_field(grid, difficulty, selected_level); break; } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); @@ -299,7 +299,7 @@ void initializeGrid(int grid[SIZE][SIZE]) { } } -void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { +void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { From 61fcead70dd2b029baba6a4bfc2b64f91899878a Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:33:18 +0100 Subject: [PATCH 221/647] refactoring: 4 --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index d7f0b73..81849ef 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -23,7 +23,7 @@ void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); -void turnFunction(int grid[SIZE][SIZE]); +void Player_actions_for_playing(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); @@ -248,7 +248,7 @@ void Game_loop() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { Level_Pool(difficulty); selectLevel(grid); - turnFunction(grid); + Player_actions_for_playing(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -316,7 +316,7 @@ void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { } -void turnFunction(int grid[SIZE][SIZE]) { +void Player_actions_for_playing(int grid[SIZE][SIZE]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); From 49c76d644c522b85fdeffe4030039b479e95b844 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:33:33 +0100 Subject: [PATCH 222/647] refactoring: 5 --- src/main/c/sudoku.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 81849ef..969ecdd 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -24,7 +24,7 @@ void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); void Player_actions_for_playing(int grid[SIZE][SIZE]); -void tipFunction(int grid[SIZE][SIZE]); +void giving_hints_to_player(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); void doneFunction(int grid[SIZE][SIZE]); @@ -319,7 +319,7 @@ void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { void Player_actions_for_playing(int grid[SIZE][SIZE]) { while (1) { printf("\nTurn function - Choose an action:\n"); - printf("1. Tip function\n"); + printf("1. Hints\n"); printf("2. Input function\n"); printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); @@ -343,7 +343,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { switch (action) { case 1: - tipFunction(grid); + giving_hints_to_player(grid); break; case 2: inputFunction(grid); @@ -368,7 +368,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { -void tipFunction(int grid[SIZE][SIZE]) { +void giving_hints_to_player(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); printf("2. Set the user-specified 3x3 field to the right values\n"); From d90a870e07c57a086bcaea5fc49afcf517dd6c43 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:01 +0100 Subject: [PATCH 223/647] refactoring: 6 --- src/main/c/sudoku.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 969ecdd..81226e5 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -25,7 +25,7 @@ void initializeGrid(int grid[SIZE][SIZE]); void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); void Player_actions_for_playing(int grid[SIZE][SIZE]); void giving_hints_to_player(int grid[SIZE][SIZE]); -void inputFunction(int grid[SIZE][SIZE]); +void write_userinput_into_Sudoku(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); void doneFunction(int grid[SIZE][SIZE]); @@ -320,7 +320,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Hints\n"); - printf("2. Input function\n"); + printf("2. Insert Number into Game\n"); printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); printf("5. Select level\n"); @@ -346,7 +346,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { giving_hints_to_player(grid); break; case 2: - inputFunction(grid); + write_userinput_into_Sudoku(grid); break; case 3: printGrid(grid); @@ -456,7 +456,7 @@ void giving_hints_to_player(int grid[SIZE][SIZE]) { } } -void inputFunction(int grid[SIZE][SIZE]) { +void write_userinput_into_Sudoku(int grid[SIZE][SIZE]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); From a3994e08f70b7c99cf7f674a7d0547a7f2c1ddc5 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:15 +0100 Subject: [PATCH 224/647] refactoring: 7 --- src/main/c/sudoku.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 81226e5..5d06bbe 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -27,7 +27,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]); void giving_hints_to_player(int grid[SIZE][SIZE]); void write_userinput_into_Sudoku(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); -void doneFunction(int grid[SIZE][SIZE]); +void check_if_Sudoku_solved(int grid[SIZE][SIZE]); @@ -322,7 +322,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { printf("1. Hints\n"); printf("2. Insert Number into Game\n"); printf("3. Print Sudoku grid\n"); - printf("4. Done function\n"); + printf("4. Check if your Solution is correct\n"); printf("5. Select level\n"); printf("6. Quit\n"); @@ -352,7 +352,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { printGrid(grid); break; case 4: - doneFunction(grid); + check_if_Sudoku_solved(grid); break; case 5: selectLevel(grid); @@ -556,7 +556,7 @@ void printGrid(int grid[SIZE][SIZE]) { } } -void doneFunction(int grid[SIZE][SIZE]) { +void check_if_Sudoku_solved(int grid[SIZE][SIZE]) { printf("\nDone function - Checking if the solution is correct...\n"); for (int i = 0; i < SIZE; i++) { From 47f98ef25ecded93b43fdef321ef34fac3b04408 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:39 +0100 Subject: [PATCH 225/647] refactoring: 8 --- src/main/c/sudoku.c | 71 +++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 5d06bbe..21fba11 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,15 +1,10 @@ - - - - - - #include #include #include #include -#define SIZE 9 +#define SIZE_OF_GAMEBORD_AXIS_X 9 +#define SIZE_OF_GAMEBORD_AXIS_Y 9 #define EMPTY 0 #define LEVEL_NUMBER 3 @@ -20,18 +15,18 @@ int selected_level; void Game_loop(); //is instead of main void Level_Pool(int difficulty); -void selectLevel(int grid[SIZE][SIZE]); -void initializeGrid(int grid[SIZE][SIZE]); -void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); -void Player_actions_for_playing(int grid[SIZE][SIZE]); -void giving_hints_to_player(int grid[SIZE][SIZE]); -void write_userinput_into_Sudoku(int grid[SIZE][SIZE]); -void printGrid(int grid[SIZE][SIZE]); -void check_if_Sudoku_solved(int grid[SIZE][SIZE]); +void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level); +void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -int availableLevels[3][3][SIZE][SIZE] = { +int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -128,7 +123,7 @@ int availableLevels[3][3][SIZE][SIZE] = { } }; -int solutionLevels[3][3][SIZE][SIZE] = { +int solutionLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{4, 7, 3, 6, 2, 1, 8, 5, 9}, @@ -228,7 +223,7 @@ int solutionLevels[3][3][SIZE][SIZE] = { void Game_loop() { - int grid[SIZE][SIZE]; + int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; selected_level = 0; while (1) { @@ -265,7 +260,7 @@ void Level_Pool(int difficulty) { -void selectLevel(int grid[SIZE][SIZE]) { +void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { int level = 0; printf("\nSelect a level:\n"); while (true){ @@ -291,23 +286,23 @@ void selectLevel(int grid[SIZE][SIZE]) { } -void initializeGrid(int grid[SIZE][SIZE]) { - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { +void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { grid[i][j] = EMPTY; } } } -void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { +void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level) { initializeGrid(grid); - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; } } - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { printf("%d", grid[i][j]); } printf("\n"); @@ -316,7 +311,7 @@ void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { } -void Player_actions_for_playing(int grid[SIZE][SIZE]) { +void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Hints\n"); @@ -368,7 +363,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { -void giving_hints_to_player(int grid[SIZE][SIZE]) { +void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); printf("2. Set the user-specified 3x3 field to the right values\n"); @@ -444,8 +439,8 @@ void giving_hints_to_player(int grid[SIZE][SIZE]) { break; case 3: - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { grid[i][j] = solutionLevels[difficulty - 1][selected_level - 1][i][j]; } } @@ -456,7 +451,7 @@ void giving_hints_to_player(int grid[SIZE][SIZE]) { } } -void write_userinput_into_Sudoku(int grid[SIZE][SIZE]) { +void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); @@ -546,21 +541,21 @@ void write_userinput_into_Sudoku(int grid[SIZE][SIZE]) { } -void printGrid(int grid[SIZE][SIZE]) { +void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nSudoku Grid:\n"); - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { printf("%d ", grid[i][j]); } printf("\n"); } } -void check_if_Sudoku_solved(int grid[SIZE][SIZE]) { +void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nDone function - Checking if the solution is correct...\n"); - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { if (grid[i][j] != solutionLevels[difficulty - 1][selected_level - 1][i][j]) { printf("Incorrect solution. Keep trying!\n"); return; From 0fb4fe3a04784ec811cc959e150f28c7a0551a49 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:53 +0100 Subject: [PATCH 226/647] refactoring: 9 --- src/main/c/sudoku.c | 256 ++++++++++++++++++++++---------------------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 21fba11..1b134a1 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -38,88 +38,88 @@ int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { {0, 4, 8, 2, 0, 9, 5, 0, 0}, {5, 0, 0, 7, 0, 3, 2, 0, 0}}, - {{0, 0, 3, 0, 2, 1, 8, 0, 0}, - {6, 0, 0, 0, 7, 0, 1, 3, 2}, - {9, 2, 1, 5, 0, 0, 7, 6, 4}, - {7, 6, 0, 3, 0, 0, 4, 0, 0}, - {8, 5, 4, 1, 9, 7, 0, 0, 0}, - {1, 0, 0, 4, 0, 6, 0, 0, 0}, - {2, 9, 0, 8, 1, 5, 0, 0, 6}, - {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 2}}, - - {{0, 0, 3, 0, 2, 1, 8, 0, 0}, - {6, 0, 0, 0, 7, 0, 1, 3, 2}, - {9, 2, 1, 5, 0, 0, 7, 6, 4}, - {7, 6, 0, 3, 0, 0, 4, 0, 0}, - {8, 5, 4, 1, 9, 7, 0, 0, 0}, - {1, 0, 0, 4, 0, 6, 0, 0, 0}, - {2, 9, 0, 8, 1, 5, 0, 0, 6}, - {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 0}}}, + {{7, 0, 2, 0, 0, 0, 9, 5, 0}, + {0, 8, 0, 7, 5, 0, 2, 1, 6}, + {0, 0, 5, 5, 2, 8, 7, 0, 3}, + {5, 1, 8, 4, 3, 0, 6, 0, 0}, + {0, 0, 6, 1, 0, 0, 5, 3, 0}, + {0, 0, 0, 0, 6, 2, 0, 8, 1}, + {0, 9, 0, 2, 0, 4, 0, 0, 5}, + {0, 2, 0, 0, 9, 5, 0, 7, 4}, + {0, 5, 1, 0, 0, 0, 0, 9, 2}}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 4, 1, 3, 2}, - {9, 2, 1, 5, 3, 8, 7, 6, 4}, - {7, 6, 9, 3, 5, 2, 4, 8, 1}, - {8, 5, 4, 1, 9, 7, 6, 2, 3}, - {1, 3, 2, 4, 8, 6, 9, 7, 5}, - {2, 9, 7, 8, 1, 5, 3, 4, 6}, - {3, 4, 8, 2, 6, 9, 5, 1, 7}, - {5, 1, 6, 7, 4, 3, 2, 9, 8}} + {{7, 3, 2, 6, 4, 1, 9, 5, 8}, + {9, 8, 4, 7, 5, 3, 2, 1, 6}, + {1, 6, 5, 9, 2, 8, 7, 4, 3}, + {5, 1, 8, 4, 3, 7, 6, 2, 9}, + {2, 4, 6, 1, 8, 9, 5, 3, 7}, + {3, 7, 9, 5, 6, 2, 4, 8, 1}, + {8, 9, 7, 2, 1, 4, 3, 6, 5}, + {6, 2, 3, 8, 9, 5, 1, 7, 4}, + {4, 5, 1, 3, 7, 6, 8, 9, 2}}, + + {{4, 2, 5, 6, 9, 7, 1, 3, 8}, + {8, 7, 9, 1, 5, 3, 4, 2, 6}, + {3, 6, 1, 4, 8, 2, 7, 5, 9}, + {1, 5, 2, 7, 3, 9, 8, 6, 4}, + {7, 4, 8, 5, 2, 6, 9, 1, 3}, + {9, 3, 6, 8, 4, 1, 5, 7, 2}, + {2, 8, 7, 9, 6, 5, 3, 4, 1}, + {6, 1, 4, 3, 7, 8, 2, 9, 5}, + {5, 9, 3, 2, 1, 4, 6, 8, 7}} } }; From 590a568535d57886cf2e0e19c3e78165d1c9c0b5 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:35:18 +0100 Subject: [PATCH 227/647] refactoring: 10 --- src/main/c/sudoku.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 1b134a1..975a080 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -3,6 +3,7 @@ #include #include + #define SIZE_OF_GAMEBORD_AXIS_X 9 #define SIZE_OF_GAMEBORD_AXIS_Y 9 #define EMPTY 0 @@ -15,7 +16,7 @@ int selected_level; void Game_loop(); //is instead of main void Level_Pool(int difficulty); -void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level); void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); @@ -242,7 +243,7 @@ void Game_loop() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { Level_Pool(difficulty); - selectLevel(grid); + Level_Selection(grid); Player_actions_for_playing(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); @@ -260,7 +261,7 @@ void Level_Pool(int difficulty) { -void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { int level = 0; printf("\nSelect a level:\n"); while (true){ @@ -350,7 +351,7 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO check_if_Sudoku_solved(grid); break; case 5: - selectLevel(grid); + Level_Selection(grid); break; case 6: printf("Exiting Sudoku program.\n"); From 4e7375160bf9ffbf07e76a7bc0985cb430d72ad6 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:35:36 +0100 Subject: [PATCH 228/647] refactoring: 11 --- src/main/c/sudoku.c | 96 +++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 975a080..f18284d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -6,28 +6,30 @@ #define SIZE_OF_GAMEBORD_AXIS_X 9 #define SIZE_OF_GAMEBORD_AXIS_Y 9 +#define AVAILABLE_DIFFICULTIES 3 +#define AVAILABLE_LEVELS 3 #define EMPTY 0 #define LEVEL_NUMBER 3 -int difficulty; +int selected_difficulty; int selected_level; void Game_loop(); //is instead of main -void Level_Pool(int difficulty); -void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level); -void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void Level_Pool(int selected_difficulty); +void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level); +void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void printGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { +int availableLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -124,7 +126,7 @@ int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { } }; -int solutionLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { +int solutionLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{4, 7, 3, 6, 2, 1, 8, 5, 9}, @@ -224,7 +226,7 @@ int solutionLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { void Game_loop() { - int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; selected_level = 0; while (1) { @@ -239,12 +241,12 @@ void Game_loop() { break; } - difficulty = input[0] - '0'; // Convert the first character to an integer + selected_difficulty = input[0] - '0'; // Convert the first character to an integer - if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { - Level_Pool(difficulty); - Level_Selection(grid); - Player_actions_for_playing(grid); + if ((selected_difficulty >= 1 && selected_difficulty <= 3) && input[1] == '\0') { + Level_Pool(selected_difficulty); + Level_Selection(Sudoku_grid); + Player_actions_for_playing(Sudoku_grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -252,8 +254,8 @@ void Game_loop() { } } -void Level_Pool(int difficulty) { - printf("\nAvailable Levels for Difficulty %d:\n", difficulty); +void Level_Pool(int selected_difficulty) { + printf("\nAvailable Levels for Difficulty %d:\n", selected_difficulty); for (int i = 0; i < LEVEL_NUMBER; i++) { printf("%d. Level %d\n", i + 1, i + 1); } @@ -261,7 +263,7 @@ void Level_Pool(int difficulty) { -void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { int level = 0; printf("\nSelect a level:\n"); while (true){ @@ -276,7 +278,7 @@ void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) level--; // Adjust to 0-based index - create_playing_field(grid, difficulty, selected_level); + create_playing_field(Sudoku_grid, selected_difficulty, selected_level); break; } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); @@ -287,24 +289,24 @@ void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) } -void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - grid[i][j] = EMPTY; + Sudoku_grid[i][j] = EMPTY; } } } -void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level) { - initializeGrid(grid); +void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level) { + initializeGrid(Sudoku_grid); for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; + Sudoku_grid[i][j] = availableLevels[selected_difficulty - 1][level - 1][i][j]; } } for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - printf("%d", grid[i][j]); + printf("%d", Sudoku_grid[i][j]); } printf("\n"); } @@ -312,7 +314,7 @@ void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXI } -void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Hints\n"); @@ -339,19 +341,19 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO switch (action) { case 1: - giving_hints_to_player(grid); + giving_hints_to_player(Sudoku_grid); break; case 2: - write_userinput_into_Sudoku(grid); + write_userinput_into_Sudoku(Sudoku_grid); break; case 3: - printGrid(grid); + printGrid(Sudoku_grid); break; case 4: - check_if_Sudoku_solved(grid); + check_if_Sudoku_solved(Sudoku_grid); break; case 5: - Level_Selection(grid); + Level_Selection(Sudoku_grid); break; case 6: printf("Exiting Sudoku program.\n"); @@ -364,7 +366,7 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO -void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); printf("2. Set the user-specified 3x3 field to the right values\n"); @@ -407,7 +409,7 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A printf("Invalid input. Please enter a number between 1 and 9.\n"); } } - grid[row - 1][col - 1] = solutionLevels[difficulty - 1][selected_level - 1][row - 1][col - 1]; + Sudoku_grid[row - 1][col - 1] = solutionLevels[selected_difficulty - 1][selected_level - 1][row - 1][col - 1]; printf("Value set successfully.\n"); break; @@ -432,8 +434,8 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - grid[startRow - 1 + i][startCol - 1 + j] = - solutionLevels[difficulty - 1][selected_level - 1][startRow - 1 + i][startCol - 1 + j]; + Sudoku_grid[startRow - 1 + i][startCol - 1 + j] = + solutionLevels[selected_difficulty - 1][selected_level - 1][startRow - 1 + i][startCol - 1 + j]; } } printf("3x3 field set successfully.\n"); @@ -442,7 +444,7 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A case 3: for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - grid[i][j] = solutionLevels[difficulty - 1][selected_level - 1][i][j]; + Sudoku_grid[i][j] = solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]; } } printf("Puzzle solved. \n"); @@ -452,7 +454,7 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A } } -void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); @@ -504,7 +506,7 @@ void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEB num = nume_str[0] - '0'; // Convert the first character to an integer if ((num >= 1 && num <= 9) && nume_str[1] == '\0') { - grid[row_e - 1][col_e - 1] = num; + Sudoku_grid[row_e - 1][col_e - 1] = num; printf("Value inserted successfully.\n"); break; } else { @@ -527,7 +529,7 @@ void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEB col_d = cold_str[0] - '0'; // Convert the first character to an integer if (((row_d >= 1 && row_d <= 9) && rowd_str[1] == '\0') && ((col_d >= 1 && col_d <= 9) && cold_str[1] == '\0')) { - grid[row_d - 1][col_d - 1] = 0; + Sudoku_grid[row_d - 1][col_d - 1] = 0; printf("Cell cleared successfully.\n"); break; } else { @@ -538,26 +540,26 @@ void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEB default: printf("Invalid input. Please enter 1 or 2.\n"); } - printGrid(grid); + printGrid(Sudoku_grid); } -void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void printGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nSudoku Grid:\n"); for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - printf("%d ", grid[i][j]); + printf("%d ", Sudoku_grid[i][j]); } printf("\n"); } } -void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nDone function - Checking if the solution is correct...\n"); for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - if (grid[i][j] != solutionLevels[difficulty - 1][selected_level - 1][i][j]) { + if (Sudoku_grid[i][j] != solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]) { printf("Incorrect solution. Keep trying!\n"); return; } From 879c81a656b73bcf6f6c1d07e831642c9515a098 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:39:34 +0100 Subject: [PATCH 229/647] adding sudoku.h, changing the game to include the header --- src/main/c/sudoku.c | 71 +++++++++++++++++++++++++++++++++++++-------- src/main/c/sudoku.h | 41 ++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 src/main/c/sudoku.h diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index f18284d..accd026 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -2,7 +2,7 @@ #include #include #include - +#include "sudoku.h" #define SIZE_OF_GAMEBORD_AXIS_X 9 #define SIZE_OF_GAMEBORD_AXIS_Y 9 @@ -14,6 +14,11 @@ int selected_difficulty; int selected_level; +bool check_solved; +bool test_help = false; +int test_row_e; +int test_col_e; +int test_num; void Game_loop(); //is instead of main @@ -29,6 +34,7 @@ void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM + int availableLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -234,6 +240,7 @@ void Game_loop() { printf("1. Easy\n2. Medium\n3. Hard\n"); printf("Enter the corresponding number or type 'quit' to exit: "); + if(!test_help){ char input[10]; scanf("%s", input); @@ -242,6 +249,7 @@ void Game_loop() { } selected_difficulty = input[0] - '0'; // Convert the first character to an integer + if ((selected_difficulty >= 1 && selected_difficulty <= 3) && input[1] == '\0') { Level_Pool(selected_difficulty); @@ -250,7 +258,11 @@ void Game_loop() { } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } - + } + if(test_help){ + Level_Pool(selected_difficulty); + break; + } } } @@ -267,7 +279,8 @@ void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A int level = 0; printf("\nSelect a level:\n"); while (true){ - char level_select[10]; + if(!test_help){ + char level_select[10]; scanf("%s", level_select); @@ -284,6 +297,13 @@ void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A printf("Invalid input. Please enter a number between 1 and 3.\n"); } + } + if(test_help){ + selected_level = level; + level--; + create_playing_field(Sudoku_grid, selected_difficulty, selected_level); + break; + } } @@ -299,11 +319,13 @@ void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AX void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level) { initializeGrid(Sudoku_grid); + if(!test_help){ for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { Sudoku_grid[i][j] = availableLevels[selected_difficulty - 1][level - 1][i][j]; } } + } for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { printf("%d", Sudoku_grid[i][j]); @@ -324,8 +346,14 @@ void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF printf("5. Select level\n"); printf("6. Quit\n"); - int action; - + + int action; + if(test_help){ + printGrid(Sudoku_grid); + check_if_Sudoku_solved(Sudoku_grid); + break; + } + if(!test_help){ while (true){ char action_str[10]; scanf("%s", action_str); @@ -338,7 +366,7 @@ void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF printf("Invalid input. Please enter a number between 1 and 6.\n"); } } - + switch (action) { case 1: giving_hints_to_player(Sudoku_grid); @@ -361,6 +389,7 @@ void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF default: printf("Invalid input. Please enter a number between 1 and 6.\n"); } + } } } @@ -372,9 +401,18 @@ void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM printf("2. Set the user-specified 3x3 field to the right values\n"); printf("3. Solve the entire puzzle for the current level\n"); - + if(test_help){ + initializeGrid(Sudoku_grid); + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { + Sudoku_grid[i][j] = solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]; + } + } + printf("Puzzle solved. \n"); + + } int option = 0; - + if(!test_help){ while (true){ char tip_str[10]; scanf("%s", tip_str); @@ -388,7 +426,7 @@ void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM printf("Invalid input. Please enter a number between 1 and 3.\n"); } } - + switch (option) { case 1: printf("Enter the coordinates (row and column) separated by space:\n"); @@ -452,15 +490,22 @@ void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM default: printf("Invalid option. Please enter a number between 1 and 3.\n"); } + } } void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); + + if(test_help){ + initializeGrid(Sudoku_grid); + Sudoku_grid[test_row_e -1][test_col_e -1] = test_num; + printGrid(Sudoku_grid); + } int action; - + if(!test_help){ while (true){ char in_str[10]; scanf("%s", in_str); @@ -541,6 +586,7 @@ void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_O printf("Invalid input. Please enter 1 or 2.\n"); } printGrid(Sudoku_grid); + } } @@ -561,16 +607,17 @@ void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { if (Sudoku_grid[i][j] != solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]) { printf("Incorrect solution. Keep trying!\n"); + check_solved = false; return; } } } - + check_solved = true; printf("Congratulations! Sudoku is solved correctly.\n"); } -int main(){ +int mainn(){ Game_loop(); return 0; } \ No newline at end of file diff --git a/src/main/c/sudoku.h b/src/main/c/sudoku.h new file mode 100644 index 0000000..63914c1 --- /dev/null +++ b/src/main/c/sudoku.h @@ -0,0 +1,41 @@ +#ifndef SUDOKU_H +#define SUDOKU_H + +#include +//constants +#define SIZE_OF_GAMEBORD_AXIS_X 9 +#define SIZE_OF_GAMEBORD_AXIS_Y 9 +#define AVAILABLE_DIFFICULTIES 3 +#define AVAILABLE_LEVELS 3 +#define EMPTY 0 +#define LEVEL_NUMBER 3 + + +extern int selected_difficulty; +extern int selected_level; +extern int solutionLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; +extern int availableLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; +extern bool check_solved; +extern bool test_help; +extern int test_row_e; +extern int test_col_e; +extern int test_num; + + + +//functions +void Game_loop(); //is instead of main +void Level_Pool(int selected_difficulty); +void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level); +void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void printGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +int mainn(); + + + +#endif // SUDOKU_H From e9350c906910448c684a71697e59ea863faec6e6 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:42:58 +0100 Subject: [PATCH 230/647] test 1 --- src/test/c/test_sudoku.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/c/test_sudoku.c diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c new file mode 100644 index 0000000..59be98f --- /dev/null +++ b/src/test/c/test_sudoku.c @@ -0,0 +1,22 @@ +#ifdef TEST + +#include "unity.h" +#include "sudoku.h" +#include +#include +#include +#include +#include + + + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + + +#endif // TEST From c9fa4676eb03b894eb1132cb123b4644c03a6f0c Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:13 +0100 Subject: [PATCH 231/647] test 2 --- src/test/c/test_sudoku.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 59be98f..e58d373 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -18,5 +18,32 @@ void tearDown(void) { } +//1 + +// Unit test for Level_Pool() function +// Call the Level_Pool() function, prints 3 fixed lines and "Available levels for Difficulty " +void test_Level_Pool_0() { + selected_difficulty = 0; + Level_Pool(selected_difficulty); + //TEST_PASS(); + printf("Unit test for Level_Pool_0() executed.\n"); +} + +void test_Level_Pool_5() { + selected_difficulty = 5; + Level_Pool(selected_difficulty); + //TEST_PASS(); + printf("Unit test for Level_Pool_5() executed.\n"); +} + +void test_Level_Pool_neg_1() { + selected_difficulty = -1; + Level_Pool(selected_difficulty); + //TEST_PASS(); + printf("Unit test for Level_Pool_-1() executed.\n\n"); +} + + + #endif // TEST From 3530bf8035af32b5db254f10438404b48b7ef46f Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:35 +0100 Subject: [PATCH 232/647] test 3 --- src/test/c/test_sudoku.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index e58d373..674cf9b 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -43,6 +43,27 @@ void test_Level_Pool_neg_1() { printf("Unit test for Level_Pool_-1() executed.\n\n"); } +//2 + +void test_initializeGrid() { + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + + + initializeGrid(Sudoku_grid); + int expected = EMPTY; + + + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected, Sudoku_grid[i][j], "Checking if every space is 0"); + } + } + + + printf("Unit test for initializeGrid() executed.\n\n"); +} + + From 319f79a4f3f6b246b7c48854eb70893f7d8e707f Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:54 +0100 Subject: [PATCH 233/647] test 4 --- src/test/c/test_sudoku.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 674cf9b..92a9053 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -64,6 +64,33 @@ void test_initializeGrid() { } +//3 + +void test_create_playing_field_level_medium_two() { + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + selected_difficulty = 2; + selected_level = 2; + int expected_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = {{7, 0, 2, 0, 0, 0, 9, 5, 0}, + {0, 0, 0, 7, 5, 0, 2, 0, 6}, + {0, 0, 5, 0, 2, 8, 7, 0, 3}, + {5, 1, 8, 0, 3, 0, 6, 0, 0}, + {0, 0, 6, 1, 0, 0, 0, 3, 0}, + {0, 0, 0, 0, 6, 2, 0, 8, 1}, + {0, 9, 0, 2, 0, 4, 0, 0, 5}, + {0, 0, 0, 0, 9, 0, 0, 0, 4}, + {0, 5, 1, 0, 0, 0, 0, 9, 2}}; + + create_playing_field(Sudoku_grid, selected_difficulty, selected_level); + + // Check if the generated Sudoku grid is valid + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected_grid[i][j], Sudoku_grid[i][j], "Checking if every space is correct"); + }} + + printf("Unit test for create_playing_field() executed.\n\n"); +} + From 8e9e7fa7bce677a4c5eff3ba67c0471115fad0fc Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:45:30 +0100 Subject: [PATCH 234/647] test 5 --- src/test/c/test_sudoku.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 92a9053..973b108 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -91,6 +91,29 @@ void test_create_playing_field_level_medium_two() { printf("Unit test for create_playing_field() executed.\n\n"); } +//4 + +// Unit test for printGrid() function +void test_printGrid() { + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {5, 3, 0, 0, 7, 0, 0, 0, 0}, + {6, 0, 0, 1, 9, 5, 0, 0, 0}, + {0, 9, 8, 0, 0, 0, 0, 6, 0}, + {8, 0, 0, 0, 6, 0, 0, 0, 3}, + {4, 0, 0, 8, 0, 3, 0, 0, 1}, + {7, 0, 0, 0, 2, 0, 0, 0, 6}, + {0, 6, 0, 0, 0, 0, 2, 8, 0}, + {0, 0, 0, 4, 1, 9, 0, 0, 5}, + {0, 0, 0, 0, 8, 0, 0, 7, 9} + }; + + printf("Sudoku Grid:\n"); + printGrid(Sudoku_grid); + //TEST_PASS(); + printf("Unit test for printGrid() executed.\n\n"); +} + + From 71c7290397890582388e822fff2adcc2a2a79c6c Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:45:52 +0100 Subject: [PATCH 235/647] test 6 --- src/test/c/test_sudoku.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 973b108..19f424b 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -114,6 +114,52 @@ void test_printGrid() { } +//5 + +// Unit test for check_if_Sudoku_solved() function +void test_check_if_Sudoku_solved_everything_correct() { + selected_difficulty = 1; + selected_level = 1; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}; + + + check_if_Sudoku_solved(Sudoku_grid); + TEST_ASSERT_TRUE(check_solved); + + + printf("Unit test for check_if_Sudoku_solved() executed.\n"); +} + +void test_check_if_Sudoku_solved_mistake_on_purpose() { + selected_difficulty = 1; + selected_level = 1; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 3}}; + + + check_if_Sudoku_solved(Sudoku_grid); + TEST_ASSERT_FALSE(check_solved); + + + printf("Unit test for check_if_Sudoku_solved() executed.\n\n"); +} From 368b942bce5c9006a16144b3fad6311b8354282b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:46:11 +0100 Subject: [PATCH 236/647] test 7 --- src/test/c/test_sudoku.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 19f424b..f3ff12d 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -162,5 +162,15 @@ void test_check_if_Sudoku_solved_mistake_on_purpose() { } +//6 + +void test_Game_loop_1(){ + test_help = true; + selected_difficulty = 1; + Game_loop(); + printf("Unit test for Game_loop() executed.\n\n"); +} + + #endif // TEST From 62d2090c48983eac5dc934f52dd779c7c23322f5 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:46:29 +0100 Subject: [PATCH 237/647] test 8 --- src/test/c/test_sudoku.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index f3ff12d..0dfa07e 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -171,6 +171,27 @@ void test_Game_loop_1(){ printf("Unit test for Game_loop() executed.\n\n"); } +//7 + +void test_Level_Selection_2_2(){ + test_help = true; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + selected_difficulty = 1; + selected_level = 1; + + Level_Selection(Sudoku_grid); + + int expected = EMPTY; + + + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected, Sudoku_grid[i][j], "Checking if level gets initialized correctly"); + } + } + + printf("Unit test for Level_Selection() executed.\n\n"); +} #endif // TEST From 28b904b9ebce0b3a5bd52ba8fe3433e31904ff3e Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:46:47 +0100 Subject: [PATCH 238/647] test 9 --- src/test/c/test_sudoku.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 0dfa07e..4cbee9c 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -193,5 +193,30 @@ void test_Level_Selection_2_2(){ printf("Unit test for Level_Selection() executed.\n\n"); } +//8 + +void test_Player_actions_for_playing_print_and_solve(){ + test_help = true; + selected_difficulty = 1; + selected_level = 1; + + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}; + + Player_actions_for_playing(Sudoku_grid); + TEST_ASSERT_TRUE(check_solved); + printf("Unit test for Player_actions_for_playing() executed.\n\n"); +} + + + #endif // TEST From ed058162096cc600b5d65177caec12a3654f2734 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:47:05 +0100 Subject: [PATCH 239/647] test 10 --- src/test/c/test_sudoku.c | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 4cbee9c..c5abf7f 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -218,5 +218,48 @@ void test_Player_actions_for_playing_print_and_solve(){ +//9 + +void test_giving_hints_to_player(){ + test_help = true; + int selected_difficulty = 1; + int selected_level = 1; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = + { + {5, 3, 0, 0, 7, 0, 0, 0, 0}, + {6, 0, 0, 1, 9, 5, 0, 0, 0}, + {0, 9, 8, 0, 0, 0, 0, 6, 0}, + {8, 0, 0, 0, 6, 0, 0, 0, 3}, + {4, 0, 0, 8, 0, 3, 0, 0, 1}, + {7, 0, 0, 0, 2, 0, 0, 0, 6}, + {0, 6, 0, 0, 0, 0, 2, 8, 0}, + {0, 0, 0, 4, 1, 9, 0, 0, 5}, + {0, 0, 0, 0, 8, 0, 0, 7, 9} + }; + int expected_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}; + + giving_hints_to_player(Sudoku_grid); + + // Check if the generated Sudoku grid is valid + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected_grid[i][j], Sudoku_grid[i][j], "Checking if every space is correct"); + }} + + + printf("Unit test for giving_hints_to_player() executed.\n\n"); +} + + + #endif // TEST From 3f9a597d6aa37796e42e9f1e05d12175140abf55 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:47:22 +0100 Subject: [PATCH 240/647] test 11 --- src/test/c/test_sudoku.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index c5abf7f..557f85d 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -260,6 +260,27 @@ void test_giving_hints_to_player(){ } +// 10 + +void test_write_userinput_into_Sudoku_9_into_empty(){ + test_help = true; + test_row_e = 1; + test_col_e = 1; + test_num = 9; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + + + write_userinput_into_Sudoku(Sudoku_grid); + + TEST_ASSERT_EQUAL_INT_MESSAGE(test_num, Sudoku_grid[test_row_e -1][test_col_e -1], "Checking if number input is correct"); + + + + printf("Unit test for write_userinput_into_Sudoku() executed.\n\n"); +} + + + #endif // TEST From e24ce5f87f651fe51971bf00f021a4ac7dcf4d33 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:58:01 +0100 Subject: [PATCH 241/647] =?UTF-8?q?26=20Runde=20Z=C3=A4hlen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 8f3df43..0622484 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -112,4 +112,5 @@ int mainx() { row -= 1; col -= 1; Zuege(Feld, row, col); + Zaehler++; } \ No newline at end of file From 67c2f31ce4307dbf745e871398494e726c50f314 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:58:55 +0100 Subject: [PATCH 242/647] =?UTF-8?q?27=20mehr=20Z=C3=BCge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 0622484..37879ef 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -101,16 +101,19 @@ int mainx() { char Feld[3][3]; Brett(Feld); Bild(Feld); - if (Zaehler % 2 != 0) { - printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + while (Winner(Feld) == 9) { + Bild(Feld); + if (Zaehler % 2 != 0) { + printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + } + else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + Zaehler++; } - else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); - printf("Reihe:"); - scanf("%d", &row); - printf("Spalte:"); - scanf("%d", &col); - row -= 1; - col -= 1; - Zuege(Feld, row, col); - Zaehler++; -} \ No newline at end of file +} From 08c90fe18d2ab44f37424493108a6cb59dd4d836 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:59:47 +0100 Subject: [PATCH 243/647] 28 Sieger bestimmen --- src/main/c/TicTacToe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 37879ef..c8a72fb 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -116,4 +116,6 @@ int mainx() { Zuege(Feld, row, col); Zaehler++; } + Bild(Feld); + Winner(Feld); } From ce7048da4332ab1099d52d39b37eabafc870c02b Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:01:14 +0100 Subject: [PATCH 244/647] 29 Feldrand --- src/main/c/TicTacToe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index c8a72fb..67733fd 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -113,6 +113,12 @@ int mainx() { scanf("%d", &col); row -= 1; col -= 1; + if (row > 3 || col > 3) { + printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); + scanf("%d %d", &row, &col); + row -= 1; //Für Index eins kleiner + col -= 1; + } Zuege(Feld, row, col); Zaehler++; } From 563b1a9860719d1afda45ccfbaba01d237be31a9 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:03:32 +0100 Subject: [PATCH 245/647] 30 mehr Spiele --- src/main/c/TicTacToe.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 67733fd..aa06372 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -99,29 +99,36 @@ int mainx() { int row; int col; char Feld[3][3]; - Brett(Feld); - Bild(Feld); - while (Winner(Feld) == 9) { - Bild(Feld); - if (Zaehler % 2 != 0) { - printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); - } - else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); - printf("Reihe:"); - scanf("%d", &row); - printf("Spalte:"); - scanf("%d", &col); - row -= 1; - col -= 1; - if (row > 3 || col > 3) { - printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); - scanf("%d %d", &row, &col); - row -= 1; //Für Index eins kleiner + char Nochmal[50] = { "Weiter" }; + + while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { + Zaehler = 1; + Brett(Feld); + while (Winner(Feld) == 9) { + + Bild(Feld); + if (Zaehler % 2 != 0) { + printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + } + else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); + row -= 1; col -= 1; + if (row > 3 || col > 3) { + printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); + scanf("%d %d", &row, &col); + row -= 1; //Für Index eins kleiner + col -= 1; + } + Zuege(Feld, row, col); + Zaehler++; } - Zuege(Feld, row, col); - Zaehler++; + Bild(Feld); + Winner(Feld); + printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); + scanf("%s", Nochmal); } - Bild(Feld); - Winner(Feld); -} +} \ No newline at end of file From 5b25802ccc428833e062aeac35826a134c93ed3a Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:05:57 +0100 Subject: [PATCH 246/647] =?UTF-8?q?31=20Z=C3=BCge=20O=20optimiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 49 +++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index aa06372..983e125 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -67,30 +67,34 @@ int Winner(char Feld[3][3]) { return 0; } void Zuege(char Feld[3][3], int row, int col) { - if (Zaehler % 2 == 0) { - if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; - } - else { - printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); - row -= 1; - col -= 1; - Zuege(Feld, row, col); - } - } - else { - if (Feld[row][col] == '_') { - Feld[row][col] = 'X'; + if (Zaehler < 10) { + if (Zaehler % 2 == 0) { + if (Feld[row][col] == '_') { + Feld[row][col] = 'O'; + } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } else { - printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); - row -= 1; - col -= 1; - Zuege(Feld, row, col); + if (Feld[row][col] == '_') { + Feld[row][col] = 'X'; + } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } } } @@ -131,4 +135,5 @@ int mainx() { printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } + return 0; } \ No newline at end of file From 51683ecbbc9b6cf27861b4addf5175cc446ef6d2 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:07:06 +0100 Subject: [PATCH 247/647] =?UTF-8?q?32=20Z=C3=BCge=20X=20optimiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 983e125..beda977 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -89,8 +89,10 @@ void Zuege(char Feld[3][3], int row, int col) { } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); row -= 1; col -= 1; Zuege(Feld, row, col); From fc06f65bf6c9a89fb905966e52af3859e0950b3a Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:08:55 +0100 Subject: [PATCH 248/647] 33 Spieler Name --- src/main/c/TicTacToe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index beda977..a544052 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -105,8 +105,10 @@ int mainx() { int row; int col; char Feld[3][3]; + char Spieler1[50], Spieler2[50]; char Nochmal[50] = { "Weiter" }; - + printf("Name der Spieler\[Spieler 1 Spieler2]\n"); + scanf("%s %s", Spieler1, Spieler2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); From 90ace1c085933fd0d9f2f5903ee1b3888bdafa17 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:11:32 +0100 Subject: [PATCH 249/647] =?UTF-8?q?34=20Begr=C3=BC=C3=9Fung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index a544052..e5b7a7f 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -112,6 +112,7 @@ int mainx() { while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); + printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(Feld) == 9) { Bild(Feld); From b68205c26bf6a7307196cfc13995ed511d45ff49 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:12:59 +0100 Subject: [PATCH 250/647] 35 Sieger ausgabe --- src/main/c/TicTacToe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index e5b7a7f..0b8c6a1 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -136,7 +136,9 @@ int mainx() { Zaehler++; } Bild(Feld); - Winner(Feld); + if (Winner(Feld) == 1) { + printf("Der Sieger ist %s", Spieler1); + } printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } From 4fb35bfa936378f6766a912b18b57af6a9522c79 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:14:19 +0100 Subject: [PATCH 251/647] 36 Sieger ausgabe 2 --- src/main/c/TicTacToe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 0b8c6a1..a67fb06 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -139,6 +139,9 @@ int mainx() { if (Winner(Feld) == 1) { printf("Der Sieger ist %s", Spieler1); } + else if (Winner(Feld) == 2) { + printf("Der Sieger ist %s", Spieler2); + } printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } From 97ba4fb289d694223db75790acb506f8165a0bb2 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:17:19 +0100 Subject: [PATCH 252/647] 37 Punktestand --- src/main/c/TicTacToe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index a67fb06..4b50623 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -106,9 +106,12 @@ int mainx() { int col; char Feld[3][3]; char Spieler1[50], Spieler2[50]; + int Punkte1 = 0, Punkte2 = 0; char Nochmal[50] = { "Weiter" }; - printf("Name der Spieler\[Spieler 1 Spieler2]\n"); - scanf("%s %s", Spieler1, Spieler2); + printf("Name Spieler 1:"); + scanf("%s", Spieler1); + printf("Name Spieler 2:"); + scanf("%s", Spieler2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); @@ -138,10 +141,13 @@ int mainx() { Bild(Feld); if (Winner(Feld) == 1) { printf("Der Sieger ist %s", Spieler1); + Punkte1++; } else if (Winner(Feld) == 2) { printf("Der Sieger ist %s", Spieler2); + Punkte2++; } + printf("%s - %d, %s - %d\n", Spieler1, Punkte1, Spieler2, Punkte2); printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } From 49644b1093d32be9be29fd5ce8dd7ec92f412b34 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:18:07 +0100 Subject: [PATCH 253/647] 38 Entscheidung Zeichen --- src/main/c/TicTacToe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 4b50623..7c7075a 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -107,14 +107,19 @@ int mainx() { char Feld[3][3]; char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; + char Name1[50], Name2[50]; char Nochmal[50] = { "Weiter" }; printf("Name Spieler 1:"); - scanf("%s", Spieler1); + scanf("%s", Name1); printf("Name Spieler 2:"); - scanf("%s", Spieler2); + scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); + printf("%s, Was willst du sein, X oder O: ", Name1); + scanf("%s", Spieler1); + strcpy(Spieler2, (Spieler1[0] == 'X') ? Name2 : Name1); + strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(Feld) == 9) { From 4e9e07b59d0809f57ff7a5a7860f3373bd171868 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:19:33 +0100 Subject: [PATCH 254/647] 39 Auswahl begrenzt --- src/main/c/TicTacToe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 7c7075a..d92fbbf 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -118,6 +118,10 @@ int mainx() { Brett(Feld); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); + if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { + printf("Ungültige Auswahl. Das Spiel wird beendet.\n"); + break; + } strcpy(Spieler2, (Spieler1[0] == 'X') ? Name2 : Name1); strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); From 9c15212cd2f38063e909734b1fadf068680669c6 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:20:34 +0100 Subject: [PATCH 255/647] 40 Farbe definieren --- src/main/c/TicTacToe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index d92fbbf..a01df1b 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -3,6 +3,11 @@ #include #include +#define ANSI_COLOR_BRIGHT_RED "\x1b[91m" +#define ANSI_COLOR_BRIGHT_CYAN "\x1b[96m" +#define ANSI_COLOR_BRIGHT_YELLOW "\x1b[93m" +#define ANSI_COLOR_RESET "\x1b[0m" + int Zaehler = 1; // Funktion, um das Spielfeld zu initialisieren void Brett(char Feld[3][3]) { From e9c0a6ec86c96daae68477edb92e3b629dd85803 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:21:29 +0100 Subject: [PATCH 256/647] =?UTF-8?q?41=20Text=20einf=C3=A4rben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index a01df1b..c1f9a33 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -25,7 +25,15 @@ void Bild(char Feld[3][3]) { #endif for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - printf("%c ", Feld[i][j]); + if (Feld[i][j] == '_') { + printf(ANSI_COLOR_BRIGHT_YELLOW"%c "ANSI_COLOR_RESET, Feld[i][j]); + } + else if (Feld[i][j] == 'X') { + printf(ANSI_COLOR_BRIGHT_CYAN"%c "ANSI_COLOR_RESET, Feld[i][j]); + } + else { + printf(ANSI_COLOR_BRIGHT_RED"%c "ANSI_COLOR_RESET, Feld[i][j]); + } } printf("\n"); } From c202ab47be1bd9a9783104e164c592c4dd64122e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:24:04 +0100 Subject: [PATCH 257/647] refactoring: Zaehler -> Runde --- src/main/c/TicTacToe.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index c1f9a33..8bbd2da 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -8,7 +8,7 @@ #define ANSI_COLOR_BRIGHT_YELLOW "\x1b[93m" #define ANSI_COLOR_RESET "\x1b[0m" -int Zaehler = 1; +int Runde = 1; // Funktion, um das Spielfeld zu initialisieren void Brett(char Feld[3][3]) { for (int i = 0; i < 3; i++) { @@ -80,8 +80,8 @@ int Winner(char Feld[3][3]) { return 0; } void Zuege(char Feld[3][3], int row, int col) { - if (Zaehler < 10) { - if (Zaehler % 2 == 0) { + if (Runde < 10) { + if (Runde % 2 == 0) { if (Feld[row][col] == '_') { Feld[row][col] = 'O'; } @@ -127,7 +127,7 @@ int mainx() { printf("Name Spieler 2:"); scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { - Zaehler = 1; + Runde = 1; Brett(Feld); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); @@ -139,9 +139,8 @@ int mainx() { strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(Feld) == 9) { - Bild(Feld); - if (Zaehler % 2 != 0) { + if (Runde % 2 != 0) { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); @@ -158,7 +157,7 @@ int mainx() { col -= 1; } Zuege(Feld, row, col); - Zaehler++; + Runde++; } Bild(Feld); if (Winner(Feld) == 1) { From 5eb24ac8e0f8ea27c31fd8e6edd2c0f0ad17a365 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:26:21 +0100 Subject: [PATCH 258/647] refactoring: Brett -> initializeBoard --- src/main/c/TicTacToe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 8bbd2da..517be63 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -10,7 +10,7 @@ int Runde = 1; // Funktion, um das Spielfeld zu initialisieren -void Brett(char Feld[3][3]) { +void initializeBoard(char Feld[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Feld[i][j] = '_'; @@ -38,6 +38,7 @@ void Bild(char Feld[3][3]) { printf("\n"); } } + int Winner(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen @@ -128,7 +129,7 @@ int mainx() { scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Runde = 1; - Brett(Feld); + initializeBoard(Feld); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { From b6a62a29618d4acb06aa7d95cb6daf55f35abafd Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:27:07 +0100 Subject: [PATCH 259/647] refactoring: Feld -> board --- src/main/c/TicTacToe.c | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 517be63..2c87b2a 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -9,15 +9,15 @@ #define ANSI_COLOR_RESET "\x1b[0m" int Runde = 1; -// Funktion, um das Spielfeld zu initialisieren -void initializeBoard(char Feld[3][3]) { +// Funktion, um das Spielboard zu initialisieren +void initializeBoard(char board[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - Feld[i][j] = '_'; + board[i][j] = '_'; } } } -void Bild(char Feld[3][3]) { +void Bild(char board[3][3]) { #ifdef _WIN32 system("cls"); #else @@ -25,26 +25,26 @@ void Bild(char Feld[3][3]) { #endif for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - if (Feld[i][j] == '_') { - printf(ANSI_COLOR_BRIGHT_YELLOW"%c "ANSI_COLOR_RESET, Feld[i][j]); + if (board[i][j] == '_') { + printf(ANSI_COLOR_BRIGHT_YELLOW"%c "ANSI_COLOR_RESET, board[i][j]); } - else if (Feld[i][j] == 'X') { - printf(ANSI_COLOR_BRIGHT_CYAN"%c "ANSI_COLOR_RESET, Feld[i][j]); + else if (board[i][j] == 'X') { + printf(ANSI_COLOR_BRIGHT_CYAN"%c "ANSI_COLOR_RESET, board[i][j]); } else { - printf(ANSI_COLOR_BRIGHT_RED"%c "ANSI_COLOR_RESET, Feld[i][j]); + printf(ANSI_COLOR_BRIGHT_RED"%c "ANSI_COLOR_RESET, board[i][j]); } } printf("\n"); } } -int Winner(char Feld[3][3]) { +int Winner(char board[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { - if (Feld[i][0] == Feld[i][1] && Feld[i][1] == Feld[i][2] && Feld[i][0] != '_') { - if (Feld[i][0] == 'X') { + if (board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != '_') { + if (board[i][0] == 'X') { return 1; } else return 2; @@ -52,17 +52,17 @@ int Winner(char Feld[3][3]) { } // Überprüfen Spalten for (int j = 0; j < 3; j++) { - if (Feld[0][j] == Feld[1][j] && Feld[1][j] == Feld[2][j] && Feld[0][j] != '_') { - if (Feld[0][j] == 'X') { + if (board[0][j] == board[1][j] && board[1][j] == board[2][j] && board[0][j] != '_') { + if (board[0][j] == 'X') { return 1; } else return 2; } } // Überprüfen Diagonalen - if ((Feld[0][0] == Feld[1][1] && Feld[1][1] == Feld[2][2]) || (Feld[0][2] == Feld[1][1] && Feld[1][1] == Feld[2][0])) { - if (Feld[1][1] != '_') { - if (Feld[1][1] == 'X') { + if ((board[0][0] == board[1][1] && board[1][1] == board[2][2]) || (board[0][2] == board[1][1] && board[1][1] == board[2][0])) { + if (board[1][1] != '_') { + if (board[1][1] == 'X') { return 1; } else return 2; @@ -71,7 +71,7 @@ int Winner(char Feld[3][3]) { //Überprüfe Runde for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { - if (Feld[k][l] == '_') { + if (board[k][l] == '_') { return 9; } } @@ -80,11 +80,11 @@ int Winner(char Feld[3][3]) { printf("Es ist ein Unendschieden\n"); return 0; } -void Zuege(char Feld[3][3], int row, int col) { +void Zuege(char board[3][3], int row, int col) { if (Runde < 10) { if (Runde % 2 == 0) { - if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; + if (board[row][col] == '_') { + board[row][col] = 'O'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); @@ -94,12 +94,12 @@ void Zuege(char Feld[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(Feld, row, col); + Zuege(board, row, col); } } else { - if (Feld[row][col] == '_') { - Feld[row][col] = 'X'; + if (board[row][col] == '_') { + board[row][col] = 'X'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); @@ -109,7 +109,7 @@ void Zuege(char Feld[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(Feld, row, col); + Zuege(board, row, col); } } } @@ -118,7 +118,7 @@ void Zuege(char Feld[3][3], int row, int col) { int mainx() { int row; int col; - char Feld[3][3]; + char board[3][3]; char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; char Name1[50], Name2[50]; @@ -129,7 +129,7 @@ int mainx() { scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Runde = 1; - initializeBoard(Feld); + initializeBoard(board); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { @@ -139,8 +139,8 @@ int mainx() { strcpy(Spieler2, (Spieler1[0] == 'X') ? Name2 : Name1); strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); - while (Winner(Feld) == 9) { - Bild(Feld); + while (Winner(board) == 9) { + Bild(board); if (Runde % 2 != 0) { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } @@ -157,15 +157,15 @@ int mainx() { row -= 1; //Für Index eins kleiner col -= 1; } - Zuege(Feld, row, col); + Zuege(board, row, col); Runde++; } - Bild(Feld); - if (Winner(Feld) == 1) { + Bild(board); + if (Winner(board) == 1) { printf("Der Sieger ist %s", Spieler1); Punkte1++; } - else if (Winner(Feld) == 2) { + else if (Winner(board) == 2) { printf("Der Sieger ist %s", Spieler2); Punkte2++; } From 36e4e5f55d28f202296a93d89f09e88a1e46ac2e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:27:50 +0100 Subject: [PATCH 260/647] refactoring: Bild -> displayBoard --- src/main/c/TicTacToe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 2c87b2a..422b99b 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -17,7 +17,7 @@ void initializeBoard(char board[3][3]) { } } } -void Bild(char board[3][3]) { +void displayBoard(char board[3][3]) { #ifdef _WIN32 system("cls"); #else @@ -140,7 +140,7 @@ int mainx() { strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(board) == 9) { - Bild(board); + displayBoard(board); if (Runde % 2 != 0) { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } @@ -160,7 +160,7 @@ int mainx() { Zuege(board, row, col); Runde++; } - Bild(board); + displayBoard(board); if (Winner(board) == 1) { printf("Der Sieger ist %s", Spieler1); Punkte1++; From 4d2a421e44f2f6e8236b605607884591d453543c Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:28:41 +0100 Subject: [PATCH 261/647] refactoring: Zuege -> makeMove --- src/main/c/TicTacToe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 422b99b..01f704b 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -80,7 +80,7 @@ int Winner(char board[3][3]) { printf("Es ist ein Unendschieden\n"); return 0; } -void Zuege(char board[3][3], int row, int col) { +void makeMove(char board[3][3], int row, int col) { if (Runde < 10) { if (Runde % 2 == 0) { if (board[row][col] == '_') { @@ -94,7 +94,7 @@ void Zuege(char board[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(board, row, col); + makeMove(board, row, col); } } else { @@ -109,7 +109,7 @@ void Zuege(char board[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(board, row, col); + makeMove(board, row, col); } } } @@ -157,7 +157,7 @@ int mainx() { row -= 1; //Für Index eins kleiner col -= 1; } - Zuege(board, row, col); + makeMove(board, row, col); Runde++; } displayBoard(board); From d08e371c2e6d83f74db85752db6c9a84da6632a8 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:30:17 +0100 Subject: [PATCH 262/647] refactoring: Nochmal -> Ende --- src/main/c/TicTacToe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 01f704b..6ee5c0e 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -122,12 +122,12 @@ int mainx() { char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; char Name1[50], Name2[50]; - char Nochmal[50] = { "Weiter" }; + char Ende[50] = { "Weiter" }; printf("Name Spieler 1:"); scanf("%s", Name1); printf("Name Spieler 2:"); scanf("%s", Name2); - while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { + while (Ende[0] == 'W' || Ende[0] == 'w') { Runde = 1; initializeBoard(board); printf("%s, Was willst du sein, X oder O: ", Name1); @@ -171,7 +171,7 @@ int mainx() { } printf("%s - %d, %s - %d\n", Spieler1, Punkte1, Spieler2, Punkte2); printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); - scanf("%s", Nochmal); + scanf("%s", Ende); } return 0; } \ No newline at end of file From f246f8284abd6ae3a487f4b2f56202c8b6b3ea62 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:31:44 +0100 Subject: [PATCH 263/647] refactoring: Main Name --- src/main/c/TicTacToe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 6ee5c0e..bdcfcc4 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -115,7 +115,7 @@ void makeMove(char board[3][3], int row, int col) { } } // Hauptfunktion zum Spielen des Tic Tac Toe-Spiels -int mainx() { +int TicTacToe_ausfuehren() { int row; int col; char board[3][3]; From e481b36abdf214c629d05904bc1f8654b3d4f94b Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:32:23 +0100 Subject: [PATCH 264/647] refactoring: col -> column --- src/main/c/TicTacToe.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index bdcfcc4..baf3643 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -80,36 +80,36 @@ int Winner(char board[3][3]) { printf("Es ist ein Unendschieden\n"); return 0; } -void makeMove(char board[3][3], int row, int col) { +void makeMove(char board[3][3], int row, int column) { if (Runde < 10) { if (Runde % 2 == 0) { - if (board[row][col] == '_') { - board[row][col] = 'O'; + if (board[row][column] == '_') { + board[row][column] = 'O'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); printf("Reihe:"); scanf("%d", &row); printf("Spalte:"); - scanf("%d", &col); + scanf("%d", &column); row -= 1; - col -= 1; - makeMove(board, row, col); + column -= 1; + makeMove(board, row, column); } } else { - if (board[row][col] == '_') { - board[row][col] = 'X'; + if (board[row][column] == '_') { + board[row][column] = 'X'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); printf("Reihe:"); scanf("%d", &row); printf("Spalte:"); - scanf("%d", &col); + scanf("%d", &column); row -= 1; - col -= 1; - makeMove(board, row, col); + column -= 1; + makeMove(board, row, column); } } } @@ -117,7 +117,7 @@ void makeMove(char board[3][3], int row, int col) { // Hauptfunktion zum Spielen des Tic Tac Toe-Spiels int TicTacToe_ausfuehren() { int row; - int col; + int column; char board[3][3]; char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; @@ -148,16 +148,16 @@ int TicTacToe_ausfuehren() { printf("Reihe:"); scanf("%d", &row); printf("Spalte:"); - scanf("%d", &col); + scanf("%d", &column); row -= 1; - col -= 1; - if (row > 3 || col > 3) { + column -= 1; + if (row > 3 || column > 3) { printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); - scanf("%d %d", &row, &col); + scanf("%d %d", &row, &column); row -= 1; //Für Index eins kleiner - col -= 1; + column -= 1; } - makeMove(board, row, col); + makeMove(board, row, column); Runde++; } displayBoard(board); From 8c61a7db7dfd73675f3496d496a025d5ebc830e5 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:34:18 +0100 Subject: [PATCH 265/647] refactoring: print rename --- src/main/c/TicTacToe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index baf3643..8ce9661 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -130,7 +130,7 @@ int TicTacToe_ausfuehren() { while (Ende[0] == 'W' || Ende[0] == 'w') { Runde = 1; initializeBoard(board); - printf("%s, Was willst du sein, X oder O: ", Name1); + printf("%s, Was willst du sein?\n[X/O]\n", Name1); scanf("%s", Spieler1); if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { printf("Ungültige Auswahl. Das Spiel wird beendet.\n"); From 9adde5c98e58b9a196fc4fbc98a45d26c2fe97a4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:35:57 +0100 Subject: [PATCH 266/647] Header aktualisiert --- src/main/c/TicTacToe.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/TicTacToe.h b/src/main/c/TicTacToe.h index 1e04a7d..645d5c3 100644 --- a/src/main/c/TicTacToe.h +++ b/src/main/c/TicTacToe.h @@ -1,7 +1,11 @@ #ifndef TICTACTOE_H #define TICTACTOE_H +void initializeBoard(char board[3][3]); +void displayBoard(char board[3][3]); int Winner(char board[3][3]); +void makeMove(char board[3][3], int row, int col); +int TicTacToe_ausfuehren(); #endif From 8aea03cf9826bf6db11a2dcfd9dbe91656befc02 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 17:48:21 +0000 Subject: [PATCH 267/647] 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 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TBr!!hg^ua;tZ&uOstyS>vu$~>fe(pAE)N72t#y_xT zek%1g z;~!f_k3Q!__I}1A_ZeLH+ZaE8zrpqSCbGR6H<1L-bj}IO zdY_0pshkSOpGjq(8B^hr)OeVGB9;_v*Az#i*-^ut1L8W#D2Z||lY}NWP4`MF?2OvS z-RPKOkH*0%C53yYQ{d998Qg;4Cd-bxZuA)i`^x#_CNIoIS2RWUa=jJvT^IHq==3b!abn~S%s6Dy~xT6SjDe^26haWZX`TkKxisJ(+M^bBB^M z=0vEa7J8NK@D^?R(BS?@584MG>$7cQYiIj${rC9b!NZRoe!|{AIJp1IsI_fh@eslq>aW`b2bfcLJj4WL##BG%h!dw(Y-rq>)TSlZn&L zfppZ3o4ZI)wsb8ynm&0r^)xu+hf|sH+?S$m3U_TPk?l<<$H!8K#*;~v1yi~BsFTe` zM;wLSO6KtdwiycdZm|7^h{G_Q)bH`)Hy1Vh233oe(~u zt*E0tx0GeyE!09iC28Mp|9;f{r$=7C8-&VwEbWW^S}9(Cfrsj(efcgCdRiEn`u$J) zF|tYI<-1Gh5X<@77yr?|jpPq7pL}--eaR!g4SBI&A^Cu00sr{ZzLDA& z`O^0kPn-#s6C(RfDgP}pgvt2GcY*w!kDuRf|92rvF)s4*{V>n%-%kEVklo~wFMVh5 z7WQ`Xv>&CuOZ&2)l)rD1zhk2LLrLrxy*~v;{u6omJC9jD2(VD+O(HMY&yn%U>x*)# z>{f7j*b_m|&?EVUoO<4qzz=LL}`UP?l7r&o%7UBRyiA1oZ@ s`9wtvkF+oI?_Yt5?Z}qWdEP(XEFmT%?Fu}P%u4bTyl=F9^T#j$-$UwV$N&HU From b121d09f06379868eb8efc490e4f86fe8217f50e Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Wed, 7 Feb 2024 18:39:52 +0000 Subject: [PATCH 268/647] Update team.md --- team.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/team.md b/team.md index 76bf093..59c808e 100644 --- a/team.md +++ b/team.md @@ -1,7 +1,8 @@ -Joe Lukas Kalb, fdai7715 -Peter Wiebe, fdai7773 -Simon Hildebrandt, fdai7864 -Lucas Heil, fdai7356 -Celine Khazarian, fdai7781 -Ahmad Thaljeh, fdai7726 -Yasin Al Satouf, fdai7731 +- COMMITTER-NAME, FD-NUMMER +- Joe Lukas Kalb, fdai7715 +- Peter Wiebe, fdai7773 +- Simon Hildebrandt, fdai7864 +- Lucas Heil, fdai7356 +- Celine Khazarian, fdai7781 +- Ahmad Thaljeh, fdai7726 +- Yasin Al Satouf, fdai7731 From 76197e3e7bdb296c38db8591a380c1b076afa670 Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Wed, 7 Feb 2024 19:09:21 +0000 Subject: [PATCH 269/647] Update team.md --- team.md | 1 - 1 file changed, 1 deletion(-) diff --git a/team.md b/team.md index 59c808e..50032ed 100644 --- a/team.md +++ b/team.md @@ -1,4 +1,3 @@ -- COMMITTER-NAME, FD-NUMMER - Joe Lukas Kalb, fdai7715 - Peter Wiebe, fdai7773 - Simon Hildebrandt, fdai7864 From 8768138e851992fda1bb4fb5b67a4a0e1319121e Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 21:58:24 +0100 Subject: [PATCH 270/647] include libs --- src/main/c/Mathe.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/c/Mathe.c diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c new file mode 100644 index 0000000..1537b88 --- /dev/null +++ b/src/main/c/Mathe.c @@ -0,0 +1,6 @@ +//1 +#include +#include +#include +#include "Mathe.h" + From 3735e233034b38da89b07db07a44188ddb76304a Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 21:59:48 +0100 Subject: [PATCH 271/647] Declaration for initialisiereZufallsgenerator --- src/main/c/Mathe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 1537b88..37502a0 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -4,3 +4,5 @@ #include #include "Mathe.h" +//2 +void initialisiereZufallsgenerator(); From dcbe8d73f17ec90d28319fc582031c02a15e10ed Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:02:25 +0100 Subject: [PATCH 272/647] file --- src/test/c/test_test.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c index 4f61ea7..e69de29 100644 --- a/src/test/c/test_test.c +++ b/src/test/c/test_test.c @@ -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 73c9173b9d3834112ab8d39ca06549d02e41c6a6 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:15:27 +0100 Subject: [PATCH 273/647] Declaration for generiereZufallszahl --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 37502a0..6311b10 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -6,3 +6,7 @@ //2 void initialisiereZufallsgenerator(); + + +//3 +int generiereZufallszahl(int min, int max); From cf8f161d22bdc476e13be2b5f537348fd5a8afa3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:23:50 +0100 Subject: [PATCH 274/647] Declaration for generiereZufallsOperator --- src/main/c/Mathe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 6311b10..7398f81 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -10,3 +10,8 @@ void initialisiereZufallsgenerator(); //3 int generiereZufallszahl(int min, int max); + + +//4 +char generiereZufallsOperator(); + From 567963a30f304d3ce10136d731fc332a7d6187e4 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:33:43 +0100 Subject: [PATCH 275/647] Declaration for Addition --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 7398f81..ea130eb 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -15,3 +15,7 @@ int generiereZufallszahl(int min, int max); //4 char generiereZufallsOperator(); + +//5 +int addiere(int zahl1, int zahl2); + From 91905cc90ca1aa267c2d50a7c47446408379d385 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:36:10 +0100 Subject: [PATCH 276/647] Declaration for Subtraction --- src/main/c/Mathe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index ea130eb..8014a84 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -19,3 +19,6 @@ char generiereZufallsOperator(); //5 int addiere(int zahl1, int zahl2); + +//6 +int subtrahiere(int zahl1, int zahl2); From 25fde79b96e74e1f322cd70247a44b9ad248ae13 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:38:06 +0100 Subject: [PATCH 277/647] Declaration for Multiplication --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 8014a84..3a5ec31 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -22,3 +22,7 @@ int addiere(int zahl1, int zahl2); //6 int subtrahiere(int zahl1, int zahl2); + + +//7 +int multipliziere(int zahl1, int zahl2); From 67d1ac5802313f178af862604c1acc81f7b9db5b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:41:04 +0100 Subject: [PATCH 278/647] Declaration for Division --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 3a5ec31..5b0d84d 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -26,3 +26,7 @@ int subtrahiere(int zahl1, int zahl2); //7 int multipliziere(int zahl1, int zahl2); + + +//8 +int dividiere(int zahl1, int zahl2); From ba12721bc7c784d40bc75ed45f18c16ebf269190 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:43:25 +0100 Subject: [PATCH 279/647] Declaration for Result --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 5b0d84d..19052e1 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -30,3 +30,7 @@ int multipliziere(int zahl1, int zahl2); //8 int dividiere(int zahl1, int zahl2); + + +//9 +int berechneErgebnis(int zahl1, int zahl2, char operator); From 041cb0980fc31e06e6a8c0fd18d2677edf30f385 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:50:04 +0100 Subject: [PATCH 280/647] Declaration for Game Round --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 19052e1..45f8c08 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -34,3 +34,7 @@ int dividiere(int zahl1, int zahl2); //9 int berechneErgebnis(int zahl1, int zahl2, char operator); + + +//10 +void spieleRunde(int schwierigkeitsgrad); From 55d258356b73654da187dc4768838ceff995a816 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:51:48 +0100 Subject: [PATCH 281/647] Declaration for Instruction --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 45f8c08..3fc875b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -38,3 +38,7 @@ int berechneErgebnis(int zahl1, int zahl2, char operator); //10 void spieleRunde(int schwierigkeitsgrad); + + +//11 +void zeigeAnleitung(); From b7f9bf9aed32f8b3cd4761bb8c54d9de1d0e2c97 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:54:16 +0100 Subject: [PATCH 282/647] Declaration for Highscore --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 3fc875b..c083d69 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -42,3 +42,7 @@ void spieleRunde(int schwierigkeitsgrad); //11 void zeigeAnleitung(); + + +//12 +void zeigeHighscore(int punkte); From 6ad890f00c5de6088adbc94acf33fa3990d20783 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 22:56:57 +0100 Subject: [PATCH 283/647] Declaration for Players Answer --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index c083d69..3d9422f 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -46,3 +46,7 @@ void zeigeAnleitung(); //12 void zeigeHighscore(int punkte); + + +//13 +int holeSpielerAntwort(); From 0251f96307d46e696073bc38c11922e60f0b15a3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:02:22 +0100 Subject: [PATCH 284/647] Declaration for Players Answer rating --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 3d9422f..26c08a0 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -50,3 +50,7 @@ void zeigeHighscore(int punkte); //13 int holeSpielerAntwort(); + + +//14 +void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); From 7b2a7d2a3a2aac4b6ec78cee3a524c6f36eb7040 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:04:04 +0100 Subject: [PATCH 285/647] Declaration for Round-End --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 26c08a0..db12a5f 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -54,3 +54,7 @@ int holeSpielerAntwort(); //14 void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); + + +//15 +void zeigeRundenEnde(int punkte); From 87d895b239fa62a6637426215ceaf10384855a55 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:05:23 +0100 Subject: [PATCH 286/647] Declaration for Selection --- src/main/c/Mathe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index db12a5f..a1ab708 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -58,3 +58,7 @@ void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); //15 void zeigeRundenEnde(int punkte); + + +//16 +void zeigeAuswahl(const char* text); From 7cb7d7f32d42af612ef15f65cd6691038546f68b Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Wed, 7 Feb 2024 22:08:01 +0000 Subject: [PATCH 287/647] Update team.md --- team.md | 1 + 1 file changed, 1 insertion(+) diff --git a/team.md b/team.md index 50032ed..59c808e 100644 --- a/team.md +++ b/team.md @@ -1,3 +1,4 @@ +- COMMITTER-NAME, FD-NUMMER - Joe Lukas Kalb, fdai7715 - Peter Wiebe, fdai7773 - Simon Hildebrandt, fdai7864 From 27547d0f2ca7b79e2546530a2cd377c2c0ba8090 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:09:56 +0100 Subject: [PATCH 288/647] Declaration for Random Generator --- src/main/c/Mathe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index a1ab708..ced2432 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -62,3 +62,8 @@ void zeigeRundenEnde(int punkte); //16 void zeigeAuswahl(const char* text); + + +//17 +void initialisiereZufallsgenerator() { + srand(time(NULL)); From bec040861b23dbcad99244b1afd60774873d3b2d Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:12:34 +0100 Subject: [PATCH 289/647] Declaration for Random Number --- src/main/c/Mathe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index ced2432..683434b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -67,3 +67,8 @@ void zeigeAuswahl(const char* text); //17 void initialisiereZufallsgenerator() { srand(time(NULL)); + + +//18 +int generiereZufallszahl(int min, int max) { + return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); From 7294f511d55806f640a80bb001eeb1b92bc03d36 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:14:36 +0100 Subject: [PATCH 290/647] Declaration for Random Operator --- src/main/c/Mathe.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 683434b..592c02c 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -71,4 +71,14 @@ void initialisiereZufallsgenerator() { //18 int generiereZufallszahl(int min, int max) { - return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); + return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); + + +//19 +char generiereZufallsOperator() { + char operatoren[] = {'+', '-', '*', '/'}; + int index = rand() % 4; + return operatoren[index]; + + + From fc2cbcdee9252e04cb708e297065c65c8e124f78 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:18:58 +0100 Subject: [PATCH 291/647] Calculation Funktion --- src/main/c/Mathe.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 592c02c..d191db4 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -81,4 +81,18 @@ char generiereZufallsOperator() { return operatoren[index]; - +//20 +int berechneErgebnis(int zahl1, int zahl2, char operator) { + switch (operator) { + case '+': + return addiere(zahl1, zahl2); + case '-': + return subtrahiere(zahl1, zahl2); + case '*': + return multipliziere(zahl1, zahl2); + case '/': + return dividiere(zahl1, zahl2); + default: + return 0; + } +} From d3ff13badaaf47fccd9699eb64ec0e15ac61aa8b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:22:47 +0100 Subject: [PATCH 292/647] Play round of random math tasks --- src/main/c/Mathe.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index d191db4..536d54f 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -96,3 +96,27 @@ int berechneErgebnis(int zahl1, int zahl2, char operator) { return 0; } } + + + +//21 +void spieleRunde(int schwierigkeitsgrad) { + int punkte = 0; + int anzahlAufgaben = 5; + zeigeAuswahl("Berechne die folgenden Aufgaben:"); + + for (int i = 0; i < anzahlAufgaben; i++) { + int zahl1 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + int zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + char operator = generiereZufallsOperator(); + if (operator == '/' && zahl2 == 0) { + zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + } + int ergebnis = berechneErgebnis(zahl1, zahl2, operator); + printf("Aufgabe %d: %d %c %d\n", i + 1, zahl1, operator, zahl2); + int spielerAntwort = holeSpielerAntwort(); + bewerteAntwort(spielerAntwort, ergebnis, &punkte); + } + + zeigeRundenEnde(punkte); +} From bf9b2d803a3ff71a7f2903906b82c0803e14b740 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:24:04 +0100 Subject: [PATCH 293/647] Instruction --- src/main/c/Mathe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 536d54f..717be7b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -120,3 +120,12 @@ void spieleRunde(int schwierigkeitsgrad) { zeigeRundenEnde(punkte); } + + + +//22 +void zeigeAnleitung() { + printf("\n=== Anleitung ===\n"); + printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); + printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); + printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); From c7c886fdb23740e19ff0ca7984d6ad20b78963b2 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:25:17 +0100 Subject: [PATCH 294/647] Highscore Function --- src/main/c/Mathe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 717be7b..c9b2016 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -129,3 +129,10 @@ void zeigeAnleitung() { printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); + + + +//23 +void zeigeHighscore(int punkte) { + printf("\n=== Highscore ===\n"); + printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); From a115ec575622066ad54692a64ee487720f9ebec2 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:27:46 +0100 Subject: [PATCH 295/647] Query the player's response --- src/main/c/Mathe.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index c9b2016..dce8acf 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -135,4 +135,13 @@ void zeigeAnleitung() { //23 void zeigeHighscore(int punkte) { printf("\n=== Highscore ===\n"); - printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); + printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); + + + +//24 +int holeSpielerAntwort() { + int spielerAntwort; + zeigeAuswahl("Deine Antwort: "); + scanf("%d", &spielerAntwort); + return spielerAntwort; From b3b5a9eb107acf241e9ad0891b0b1732027a1ed7 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:31:17 +0100 Subject: [PATCH 296/647] End of Round Output --- src/main/c/Mathe.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index dce8acf..8e72b08 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -145,3 +145,21 @@ int holeSpielerAntwort() { zeigeAuswahl("Deine Antwort: "); scanf("%d", &spielerAntwort); return spielerAntwort; + + + +//25 +void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { + if (spielerAntwort == ergebnis) { + printf("Richtig! Du erhältst einen Punkt.\n"); + (*punkte)++; + } else { + printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); + } +} + + + +//26 +void zeigeRundenEnde(int punkte) { + printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); From 32bf94880336921d2ca499d09002662f717605d8 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:38:51 +0100 Subject: [PATCH 297/647] Addition Function --- src/main/c/Mathe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 8e72b08..0d03179 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -163,3 +163,9 @@ void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { //26 void zeigeRundenEnde(int punkte) { printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); + + + +//27 +int addiere(int zahl1, int zahl2) { + return zahl1 + zahl2; From 47e24f0d84a3e01e8b2f8a7d265bd0dcbac39dda Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:40:27 +0100 Subject: [PATCH 298/647] Subtraction Function --- src/main/c/Mathe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 0d03179..6d0868d 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -168,4 +168,10 @@ void zeigeRundenEnde(int punkte) { //27 int addiere(int zahl1, int zahl2) { - return zahl1 + zahl2; + return zahl1 + zahl2; + + + +//28 +int subtrahiere(int zahl1, int zahl2) { + return zahl1 - zahl2; From 44e0729f3b37d433996803e1059256af5723e3f3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:42:21 +0100 Subject: [PATCH 299/647] Multiplication function --- src/main/c/Mathe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 6d0868d..a46bc5a 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -174,4 +174,10 @@ int addiere(int zahl1, int zahl2) { //28 int subtrahiere(int zahl1, int zahl2) { - return zahl1 - zahl2; + return zahl1 - zahl2; + + + +//29 +int multipliziere(int zahl1, int zahl2) { + return zahl1 * zahl2; From 4169683d7da973ce12d5ff60dfe32e53dc0859bc Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:44:13 +0100 Subject: [PATCH 300/647] Division Function --- src/main/c/Mathe.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index a46bc5a..91fcf56 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -180,4 +180,16 @@ int subtrahiere(int zahl1, int zahl2) { //29 int multipliziere(int zahl1, int zahl2) { - return zahl1 * zahl2; + return zahl1 * zahl2; + + + +//30 +int dividiere(int zahl1, int zahl2) { + if (zahl2 != 0) { + return zahl1 / zahl2; + } else { + printf("Fehler: Division durch Null vermieden.\n"); + return 0; + } +} From 5c622dbae9d151a0b4bbe6d6f9e81aba35b175ee Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:46:36 +0100 Subject: [PATCH 301/647] Function call to display selection text --- src/main/c/Mathe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 91fcf56..d172f55 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -192,4 +192,12 @@ int dividiere(int zahl1, int zahl2) { printf("Fehler: Division durch Null vermieden.\n"); return 0; } -} +} + + + +//31 +void zeigeAuswahl(const char* text) { + printf("%s\n", text); +} + From a1a0c680d5d6ba5c987d6cd3196908b2a6bdff7b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 01:53:49 +0100 Subject: [PATCH 302/647] include lib --- src/main/c/Mathe.c | 10 ++++++++++ src/main/c/Mathe.h | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/main/c/Mathe.c create mode 100644 src/main/c/Mathe.h diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c new file mode 100644 index 0000000..2a36dd9 --- /dev/null +++ b/src/main/c/Mathe.c @@ -0,0 +1,10 @@ +//1 +#include +#include +#include +#include "Mathe.h" + + + + + diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h new file mode 100644 index 0000000..f5bb425 --- /dev/null +++ b/src/main/c/Mathe.h @@ -0,0 +1,10 @@ +#ifndef TEST_H +#define TEST_H +int berechneErgebnis(int zahl1, int zahl2, char operator); +int generiereZufallszahl(int min, int max); +int multipliziere(int zahl1, int zahl2); +int dividiere(int zahl1, int zahl2); +int addiere(int zahl1, int zahl2); +int subtrahiere(int zahl1, int zahl2); +int multipliziere(int zahl1, int zahl2); +#endif // MATHEMATIKSPIEL_H \ No newline at end of file From 0b849b59927e1ac3b5d2243e8244c72baf729386 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 01:56:35 +0100 Subject: [PATCH 303/647] function initialisiereZufallsgenerator --- src/main/c/Mathe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 2a36dd9..7b791ac 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -4,6 +4,8 @@ #include #include "Mathe.h" +//2 +void initialisiereZufallsgenerator(); From c1a2f710643077c6a31311dbc69f4b39d55d7a4e Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 01:57:35 +0100 Subject: [PATCH 304/647] function generiereZufallszahl --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 7b791ac..8097ed2 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -7,6 +7,7 @@ //2 void initialisiereZufallsgenerator(); - +//3 +int generiereZufallszahl(int min, int max); From 1387c0d87fd6c8ee7036cdcc9bcabd3e97c460b1 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 01:59:42 +0100 Subject: [PATCH 305/647] function generiereZufallsOperator --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 8097ed2..8ede420 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -10,4 +10,5 @@ void initialisiereZufallsgenerator(); //3 int generiereZufallszahl(int min, int max); - +//4 +char generiereZufallsOperator(); From bd14a2118aa920b5cebc483c3a41fd02eba7bf54 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:00:35 +0100 Subject: [PATCH 306/647] function addiere --- src/main/c/Mathe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 8ede420..80a2fe2 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -12,3 +12,6 @@ int generiereZufallszahl(int min, int max); //4 char generiereZufallsOperator(); + +//5 +int addiere(int zahl1, int zahl2); \ No newline at end of file From 6ad0a5f95e3d9937cf9457252890dd1f2c56dc88 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:01:34 +0100 Subject: [PATCH 307/647] function subtrahiere --- src/main/c/Mathe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 80a2fe2..bfe372b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -14,4 +14,7 @@ int generiereZufallszahl(int min, int max); char generiereZufallsOperator(); //5 -int addiere(int zahl1, int zahl2); \ No newline at end of file +int addiere(int zahl1, int zahl2); + +//6 +int subtrahiere(int zahl1, int zahl2); \ No newline at end of file From ba5b08cfe000ca44d7f90e2c438a5a7035a62e37 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:02:25 +0100 Subject: [PATCH 308/647] function multipliziere --- src/main/c/Mathe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index bfe372b..c4d3bbf 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -17,4 +17,7 @@ char generiereZufallsOperator(); int addiere(int zahl1, int zahl2); //6 -int subtrahiere(int zahl1, int zahl2); \ No newline at end of file +int subtrahiere(int zahl1, int zahl2); + +//7 +int multipliziere(int zahl1, int zahl2); \ No newline at end of file From d23695b49cb56efc44344fd9608b5c5cf29cf8b2 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:03:30 +0100 Subject: [PATCH 309/647] function dividiere --- src/main/c/Mathe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index c4d3bbf..bf1fda0 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -20,4 +20,6 @@ int addiere(int zahl1, int zahl2); int subtrahiere(int zahl1, int zahl2); //7 -int multipliziere(int zahl1, int zahl2); \ No newline at end of file +int multipliziere(int zahl1, int zahl2); +//8 +int dividiere(int zahl1, int zahl2); From b150d4757a369bfb32b5b80228df75a78669877d Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:04:16 +0100 Subject: [PATCH 310/647] function berechneErgebnis --- src/main/c/Mathe.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index bf1fda0..69ac38c 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -23,3 +23,17 @@ int subtrahiere(int zahl1, int zahl2); int multipliziere(int zahl1, int zahl2); //8 int dividiere(int zahl1, int zahl2); +//9 +int berechneErgebnis(int zahl1, int zahl2, char operator); + + + + + + + + + + + + From 05665e3f9deab25c0043a171742b3983312ce46b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:04:42 +0100 Subject: [PATCH 311/647] function spieleRunde --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 69ac38c..3e5730d 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -25,7 +25,8 @@ int multipliziere(int zahl1, int zahl2); int dividiere(int zahl1, int zahl2); //9 int berechneErgebnis(int zahl1, int zahl2, char operator); - +//10 +void spieleRunde(int schwierigkeitsgrad); From 14d75ff49cf9702b173ae07bff768bf63e8a5cc4 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:05:07 +0100 Subject: [PATCH 312/647] function zeigeAnleitung --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 3e5730d..853aadf 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -27,7 +27,8 @@ int dividiere(int zahl1, int zahl2); int berechneErgebnis(int zahl1, int zahl2, char operator); //10 void spieleRunde(int schwierigkeitsgrad); - +//11 +void zeigeAnleitung(); From 48e86b7f7137f5c6f9d94966fc2c59bc081cef0f Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:05:43 +0100 Subject: [PATCH 313/647] function zeigeHighscore --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 853aadf..3d107fa 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -29,7 +29,8 @@ int berechneErgebnis(int zahl1, int zahl2, char operator); void spieleRunde(int schwierigkeitsgrad); //11 void zeigeAnleitung(); - +//12 +void zeigeHighscore(int punkte); From 1de1f58a4ac8d11c2432053de030f40344469b78 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:06:05 +0100 Subject: [PATCH 314/647] function holeSpielerAntwort --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 3d107fa..528fa0b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -31,7 +31,8 @@ void spieleRunde(int schwierigkeitsgrad); void zeigeAnleitung(); //12 void zeigeHighscore(int punkte); - +//13 +int holeSpielerAntwort(); From a081a77739e874c9969de43934d331d367030c1b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:07:03 +0100 Subject: [PATCH 315/647] function bewerteAntwort --- src/main/c/Mathe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 528fa0b..cfd7e1e 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -34,6 +34,11 @@ void zeigeHighscore(int punkte); //13 int holeSpielerAntwort(); +//14 +void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); + + + From 6e942a9523da373ea4be6e32b184df32a017e259 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:07:36 +0100 Subject: [PATCH 316/647] function zeigeRundenEnde --- src/main/c/Mathe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index cfd7e1e..8077347 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -38,7 +38,8 @@ int holeSpielerAntwort(); void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); - +//15 +void zeigeRundenEnde(int punkte); From 6aa206c95664cf9396c9a2af740b7c6f08ec52a8 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:08:06 +0100 Subject: [PATCH 317/647] function zeigeAuswahl --- src/main/c/Mathe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 8077347..1fd9c3b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -42,6 +42,14 @@ void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); void zeigeRundenEnde(int punkte); +//16 +void zeigeAuswahl(const char* text); + + + + + + From 523c2edf4189716e13a7ecc1359463a47dc8d5a5 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:09:09 +0100 Subject: [PATCH 318/647] function initialisiereZufallsgenerator --- src/main/c/Mathe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 1fd9c3b..2acfa1b 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -45,7 +45,10 @@ void zeigeRundenEnde(int punkte); //16 void zeigeAuswahl(const char* text); - +//17 +void initialisiereZufallsgenerator() { + srand(time(NULL)); +} From d52d75edb0e0a36a10df47fa2edd932292f0c413 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:09:43 +0100 Subject: [PATCH 319/647] function generiereZufallszahl --- src/main/c/Mathe.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 2acfa1b..6b752d1 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -49,6 +49,23 @@ void zeigeAuswahl(const char* text); void initialisiereZufallsgenerator() { srand(time(NULL)); } +//18 +int generiereZufallszahl(int min, int max) { + return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); +} + + + + + + + + + + + + + From 14af5f6e8e228d0b50853aabd61776ba6a9e0fb6 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:10:20 +0100 Subject: [PATCH 320/647] function generiereZufallszahl --- src/main/c/Mathe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 6b752d1..64c1513 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -56,7 +56,12 @@ int generiereZufallszahl(int min, int max) { - +//19 +char generiereZufallsOperator() { + char operatoren[] = {'+', '-', '*', '/'}; + int index = rand() % 4; + return operatoren[index]; +} From ef2de1dd00445f01a6ca120778bb29734233fadc Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:11:20 +0100 Subject: [PATCH 321/647] function berechneErgebnis --- src/main/c/Mathe.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 64c1513..0e060c4 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -63,6 +63,34 @@ char generiereZufallsOperator() { return operatoren[index]; } +//20 +int berechneErgebnis(int zahl1, int zahl2, char operator) { + switch (operator) { + case '+': + return addiere(zahl1, zahl2); + case '-': + return subtrahiere(zahl1, zahl2); + case '*': + return multipliziere(zahl1, zahl2); + case '/': + return dividiere(zahl1, zahl2); + default: + return 0; + } +} + + + + + + + + + + + + + From 792d4c09b17876ee0538284ec64c84b75a54eda3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:13:11 +0100 Subject: [PATCH 322/647] function spieleRunde --- src/main/c/Mathe.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 0e060c4..74c0c34 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -63,23 +63,28 @@ char generiereZufallsOperator() { return operatoren[index]; } -//20 -int berechneErgebnis(int zahl1, int zahl2, char operator) { - switch (operator) { - case '+': - return addiere(zahl1, zahl2); - case '-': - return subtrahiere(zahl1, zahl2); - case '*': - return multipliziere(zahl1, zahl2); - case '/': - return dividiere(zahl1, zahl2); - default: - return 0; - } -} +//21 +void spieleRunde(int schwierigkeitsgrad) { + int punkte = 0; + int anzahlAufgaben = 5; + zeigeAuswahl("Berechne die folgenden Aufgaben:"); + + for (int i = 0; i < anzahlAufgaben; i++) { + int zahl1 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + int zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + char operator = generiereZufallsOperator(); + if (operator == '/' && zahl2 == 0) { + zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + } + int ergebnis = berechneErgebnis(zahl1, zahl2, operator); + printf("Aufgabe %d: %d %c %d\n", i + 1, zahl1, operator, zahl2); + int spielerAntwort = holeSpielerAntwort(); + bewerteAntwort(spielerAntwort, ergebnis, &punkte); + } + zeigeRundenEnde(punkte); +} From 41565af9ce8718de88777a4df81b05ef64a05bb8 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:15:14 +0100 Subject: [PATCH 323/647] function zeigeAnleitung --- src/main/c/Mathe.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 74c0c34..56caed4 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -64,26 +64,12 @@ char generiereZufallsOperator() { } -//21 -void spieleRunde(int schwierigkeitsgrad) { - int punkte = 0; - int anzahlAufgaben = 5; - zeigeAuswahl("Berechne die folgenden Aufgaben:"); - - for (int i = 0; i < anzahlAufgaben; i++) { - int zahl1 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); - int zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); - char operator = generiereZufallsOperator(); - if (operator == '/' && zahl2 == 0) { - zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); - } - int ergebnis = berechneErgebnis(zahl1, zahl2, operator); - printf("Aufgabe %d: %d %c %d\n", i + 1, zahl1, operator, zahl2); - int spielerAntwort = holeSpielerAntwort(); - bewerteAntwort(spielerAntwort, ergebnis, &punkte); - } - - zeigeRundenEnde(punkte); +//22 +void zeigeAnleitung() { + printf("\n=== Anleitung ===\n"); + printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); + printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); + printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); } @@ -104,6 +90,17 @@ void spieleRunde(int schwierigkeitsgrad) { + + + + + + + + + + + From 4730c3cba11ebaded0c64697363a386efc349a27 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:15:46 +0100 Subject: [PATCH 324/647] function zeigeHighscore --- src/main/c/Mathe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 56caed4..dbb1c10 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -74,6 +74,11 @@ void zeigeAnleitung() { +//23 +void zeigeHighscore(int punkte) { + printf("\n=== Highscore ===\n"); + printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); +} From a2727822d668b77dacebbf521845a802df36743b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:16:11 +0100 Subject: [PATCH 325/647] function holeSpielerAntwort --- src/main/c/Mathe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index dbb1c10..aec59eb 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -80,6 +80,13 @@ void zeigeHighscore(int punkte) { printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); } +//24 +int holeSpielerAntwort() { + int spielerAntwort; + zeigeAuswahl("Deine Antwort: "); + scanf("%d", &spielerAntwort); + return spielerAntwort; +} From e874db38735abd7bbc3a62c679ac5e622539845b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:16:44 +0100 Subject: [PATCH 326/647] function bewerteAntwort --- src/main/c/Mathe.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index aec59eb..32df048 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -87,7 +87,16 @@ int holeSpielerAntwort() { scanf("%d", &spielerAntwort); return spielerAntwort; } - +//25 + +void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { + if (spielerAntwort == ergebnis) { + printf("Richtig! Du erhältst einen Punkt.\n"); + (*punkte)++; + } else { + printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); + } +} From 5d7f8ca1e1334057f18daf04a3bef5969412a491 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:23:31 +0100 Subject: [PATCH 327/647] function zeigeRundenEnde --- src/main/c/Mathe.c | 56 ---------------------------------------------- src/main/c/Mathe.h | 2 +- 2 files changed, 1 insertion(+), 57 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 32df048..ee49eac 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -37,66 +37,10 @@ int holeSpielerAntwort(); //14 void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); - //15 void zeigeRundenEnde(int punkte); -//16 -void zeigeAuswahl(const char* text); - -//17 -void initialisiereZufallsgenerator() { - srand(time(NULL)); -} -//18 -int generiereZufallszahl(int min, int max) { - return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); -} - - - -//19 -char generiereZufallsOperator() { - char operatoren[] = {'+', '-', '*', '/'}; - int index = rand() % 4; - return operatoren[index]; -} - - -//22 -void zeigeAnleitung() { - printf("\n=== Anleitung ===\n"); - printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); - printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); - printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); -} - - - -//23 -void zeigeHighscore(int punkte) { - printf("\n=== Highscore ===\n"); - printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); -} - -//24 -int holeSpielerAntwort() { - int spielerAntwort; - zeigeAuswahl("Deine Antwort: "); - scanf("%d", &spielerAntwort); - return spielerAntwort; -} -//25 - -void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { - if (spielerAntwort == ergebnis) { - printf("Richtig! Du erhältst einen Punkt.\n"); - (*punkte)++; - } else { - printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); - } -} diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h index f5bb425..9c04579 100644 --- a/src/main/c/Mathe.h +++ b/src/main/c/Mathe.h @@ -7,4 +7,4 @@ int dividiere(int zahl1, int zahl2); int addiere(int zahl1, int zahl2); int subtrahiere(int zahl1, int zahl2); int multipliziere(int zahl1, int zahl2); -#endif // MATHEMATIKSPIEL_H \ No newline at end of file +#endif // MATHEMATIKSPIE \ No newline at end of file From 379ce3049a0f22c73923da331a451e5fdb55783b Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:25:25 +0100 Subject: [PATCH 328/647] function zeigeAuswahl --- src/main/c/Mathe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index ee49eac..468ec88 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -44,6 +44,8 @@ void zeigeRundenEnde(int punkte); +//16 +void zeigeAuswahl(const char* text); From e0a0a7f4d1f0add8c973acb0c7fba7d2efd884dc Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:25:52 +0100 Subject: [PATCH 329/647] function initialisiereZufallsgenerator --- src/main/c/Mathe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 468ec88..0c0da1d 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -47,7 +47,10 @@ void zeigeRundenEnde(int punkte); //16 void zeigeAuswahl(const char* text); - +//17 +void initialisiereZufallsgenerator() { + srand(time(NULL)); +} From be4069db1fff36dacff38ad94aea47e40971dca4 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:26:24 +0100 Subject: [PATCH 330/647] function generiereZufallszahl --- src/main/c/Mathe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 0c0da1d..9ac095a 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -53,6 +53,14 @@ void initialisiereZufallsgenerator() { } +//18 +int generiereZufallszahl(int min, int max) { + return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); +} + + + + From 6e7fafed15d6db33113dfd0f8330f89300ea4015 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:26:44 +0100 Subject: [PATCH 331/647] function generiereZufallsOperator --- src/main/c/Mathe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 9ac095a..199374c 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -57,7 +57,12 @@ void initialisiereZufallsgenerator() { int generiereZufallszahl(int min, int max) { return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); } - +//19 +char generiereZufallsOperator() { + char operatoren[] = {'+', '-', '*', '/'}; + int index = rand() % 4; + return operatoren[index]; +} From 201e9fba79bb2c34c07e6bc83dee8d9ea248639f Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:29:18 +0100 Subject: [PATCH 332/647] function zeigeAnleitung --- src/main/c/Mathe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 199374c..35983d6 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -63,7 +63,13 @@ char generiereZufallsOperator() { int index = rand() % 4; return operatoren[index]; } - +//22 +void zeigeAnleitung() { + printf("\n=== Anleitung ===\n"); + printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); + printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); + printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); +} From 9ba4263149818dba74eb658acbb178b512f5d93c Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:29:45 +0100 Subject: [PATCH 333/647] function zeigeHighscore --- src/main/c/Mathe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 35983d6..731d5ff 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -71,6 +71,11 @@ void zeigeAnleitung() { printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); } +//23 +void zeigeHighscore(int punkte) { + printf("\n=== Highscore ===\n"); + printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); +} From d012f42b919e73f6551515237954dbf6de0ce9f3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:30:27 +0100 Subject: [PATCH 334/647] function holeSpielerAntwort --- src/main/c/Mathe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 731d5ff..1fb20f5 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -78,6 +78,13 @@ void zeigeHighscore(int punkte) { } +//24 +int holeSpielerAntwort() { + int spielerAntwort; + zeigeAuswahl("Deine Antwort: "); + scanf("%d", &spielerAntwort); + return spielerAntwort; +} From 7ad83170c841a255ff5d8f78c2c64991fa2aaa18 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:31:08 +0100 Subject: [PATCH 335/647] function bewerteAntwort --- src/main/c/Mathe.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 1fb20f5..5869ab1 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -87,6 +87,21 @@ int holeSpielerAntwort() { } +//25 +void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { + if (spielerAntwort == ergebnis) { + printf("Richtig! Du erhältst einen Punkt.\n"); + (*punkte)++; + } else { + printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); + } +} + + + + + + From 04d06a914892f715b1951417a19e473be029fce2 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:35:03 +0100 Subject: [PATCH 336/647] function zeigeRundenEnde --- src/main/c/Mathe.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 5869ab1..a8570cd 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -77,16 +77,6 @@ void zeigeHighscore(int punkte) { printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); } - -//24 -int holeSpielerAntwort() { - int spielerAntwort; - zeigeAuswahl("Deine Antwort: "); - scanf("%d", &spielerAntwort); - return spielerAntwort; -} - - //25 void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { if (spielerAntwort == ergebnis) { @@ -96,7 +86,7 @@ void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); } } - +int main(){} From 69056dbba16f6728b265da569e222798e1b0c8d4 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:35:33 +0100 Subject: [PATCH 337/647] function addiere --- src/main/c/Mathe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index a8570cd..ab99883 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -86,9 +86,15 @@ void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); } } -int main(){} - +//26 +void zeigeRundenEnde(int punkte) { + printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); +} +//27 +int addiere(int zahl1, int zahl2) { + return zahl1 + zahl2; +} From 1fbad8e9e87ccdbc143bd36d23f5ebb2d2cf3332 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:35:59 +0100 Subject: [PATCH 338/647] function subtrahiere --- src/main/c/Mathe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index ab99883..3bff6b5 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -95,7 +95,10 @@ void zeigeRundenEnde(int punkte) { int addiere(int zahl1, int zahl2) { return zahl1 + zahl2; } - +//28 +int subtrahiere(int zahl1, int zahl2) { + return zahl1 - zahl2; +} From fbb83c2958209ce7511e5eb0ec94aa36d0e84b6f Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:37:11 +0100 Subject: [PATCH 339/647] function multipliziere --- src/main/c/Mathe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 3bff6b5..8497adc 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -101,6 +101,9 @@ int subtrahiere(int zahl1, int zahl2) { } +int main(){} + + From 31807329bea7510403ea03613db39eab72c8f44f Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:37:43 +0100 Subject: [PATCH 340/647] function dividiere --- src/main/c/Mathe.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 8497adc..f16a15f 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -99,10 +99,21 @@ int addiere(int zahl1, int zahl2) { int subtrahiere(int zahl1, int zahl2) { return zahl1 - zahl2; } +//29 +int multipliziere(int zahl1, int zahl2) { + return zahl1 * zahl2; +} +//30 +int dividiere(int zahl1, int zahl2) { + if (zahl2 != 0) { + return zahl1 / zahl2; + } else { + printf("Fehler: Division durch Null vermieden.\n"); + return 0; + } +} -int main(){} - From 19a0b4a0343024b5a53c2d38e5f9025074ca9ef3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:38:18 +0100 Subject: [PATCH 341/647] function zeigeAuswahl --- src/main/c/Mathe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index f16a15f..c5a5832 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -114,6 +114,13 @@ int dividiere(int zahl1, int zahl2) { } +//31 +void zeigeAuswahl(const char* text) { + printf("%s\n", text); +} + + + From 778b8219ddc9d994a45cd306bcf5a3f5a4472556 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:39:50 +0100 Subject: [PATCH 342/647] function holeSpielerAntwort --- src/main/c/Mathe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index c5a5832..f1f4e22 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -118,7 +118,13 @@ int dividiere(int zahl1, int zahl2) { void zeigeAuswahl(const char* text) { printf("%s\n", text); } - +//24 +int holeSpielerAntwort() { + int spielerAntwort; + zeigeAuswahl("Deine Antwort: "); + scanf("%d", &spielerAntwort); + return spielerAntwort; +} From 7a4c56ceccd0b4b4ab4bffc99e16b9254cd9b635 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:45:30 +0100 Subject: [PATCH 343/647] function berechneErgebnis --- src/main/c/Mathe.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index f1f4e22..e2f7931 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -125,30 +125,18 @@ int holeSpielerAntwort() { scanf("%d", &spielerAntwort); return spielerAntwort; } - - - - - - - - - - - - - - - - - - - - - - - - - - +int berechneErgebnis(int zahl1, int zahl2, char operator) { + switch (operator) { + case '+': + return addiere(zahl1, zahl2); + case '-': + return subtrahiere(zahl1, zahl2); + case '*': + return multipliziere(zahl1, zahl2); + case '/': + return dividiere(zahl1, zahl2); + default: + return 0; + } +} From fb37c340ff5ab2348f7336158ad1ef2973312a56 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:46:18 +0100 Subject: [PATCH 344/647] function spieleRunde --- src/main/c/Mathe.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index e2f7931..ffb6cad 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -140,3 +140,31 @@ int berechneErgebnis(int zahl1, int zahl2, char operator) { } } + + +//21 +void spieleRunde(int schwierigkeitsgrad) { + int punkte = 0; + int anzahlAufgaben = 5; + zeigeAuswahl("Berechne die folgenden Aufgaben:"); + + for (int i = 0; i < anzahlAufgaben; i++) { + int zahl1 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + int zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + char operator = generiereZufallsOperator(); + if (operator == '/' && zahl2 == 0) { + zahl2 = generiereZufallszahl(1 * schwierigkeitsgrad, 10 * schwierigkeitsgrad); + } + int ergebnis = berechneErgebnis(zahl1, zahl2, operator); + printf("Aufgabe %d: %d %c %d\n", i + 1, zahl1, operator, zahl2); + int spielerAntwort = holeSpielerAntwort(); + bewerteAntwort(spielerAntwort, ergebnis, &punkte); + } + + zeigeRundenEnde(punkte); +} + + + + + From 20cf04df894460b9c5643976043d0953c4e0a189 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:56:02 +0100 Subject: [PATCH 345/647] add main --- src/main/c/Mathe.c | 22 ++++++++++++++++++++++ src/main/c/a.exe | Bin 0 -> 44266 bytes 2 files changed, 22 insertions(+) create mode 100644 src/main/c/a.exe diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index ffb6cad..d4bb7dc 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -166,5 +166,27 @@ void spieleRunde(int schwierigkeitsgrad) { +int mainx() { + srand(time(NULL)); + + int weiterSpielen = 1; + int gesamtPunkte = 0; + + zeigeAnleitung(); + + while (weiterSpielen) { + int schwierigkeitsgrad; + printf("\nWähle einen Schwierigkeitsgrad (1 für einfach, 2 für mittel, 3 für schwer): "); + scanf("%d", &schwierigkeitsgrad); + + spieleRunde(schwierigkeitsgrad); + zeigeHighscore(gesamtPunkte); + + printf("\nMöchtest du eine weitere Runde spielen? (1 für Ja, 0 für Nein): "); + scanf("%d", &weiterSpielen); + } + printf("Vielen Dank fürs Spielen! Auf Wiedersehen.\n"); + return 0; +} \ No newline at end of file diff --git a/src/main/c/a.exe b/src/main/c/a.exe new file mode 100644 index 0000000000000000000000000000000000000000..0e3a6cc9f6e52305bec9d18fba73a5a938d82f21 GIT binary patch literal 44266 zcmeIb4R}=5wKu-c%!CXic-wWj^>&aLC7mq)a}XoB>3U z&`B)QX?nT0_SW9gdqr$7x39OgEjQ9iX&{(@QVo<=6zWB#Ix%RYA_lO|`&)aTGiOdF zvG=*peg6OV?b`!q&faUUwf0(Tuf6s@`<$~=bl(nUW{g>IhQo~Q!<7y@|NY{hHWVk_ z_{$`=cl>Xr?~@9DGrgj|q1D#nZC>ZCYP8iua(#G}&@W%59C!weIwZ z6DOpptV^AY6-pD?>IH}0Y%^mQCC1LOcqu_LO=I(bREpCC*j2bDO&x_Wa~oslM}cdgbj7_%LFU|C z{E$HNaFQ}n$68jpHodk=sRC>o!RaeqU-RWL|_)HuMN^z1-i=vQ_v@^SX zu1edU0Ki(Di8wQHMjha1Pp@umB~VM`CkjDLwo$zeqF!#pHWXNK=Bo(mh0B*+RzX>A zs~t#?9wcYf!SNIiuh&NKCvg&98P2GK@aAR+MHUnMS)7E&Yao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XGFm}1HY#eRVv3sHx z6tumO5$9>E5wv-|yQ(F+$wjvjOMGgDVi`kpA#HPJwFu_HCeYee)a3cG5DX;b547)( z+NDKnMYbd+n&@q?sW(Q5j1D4hU)0L^A{r0K*l(%1)!>6%4fS1K6+N;kvx}7GjiPlw z-chQsDH81kC+x0n5={dl-w#}DPSfbd2R`us!l=!&$t84Mgl;2)RslZF)HI1y9`O}a zKX%ihHVi)MX3(lChG-UvG|UyXGdXuu&3pJ}(Q07T#4v2d&BHR^#hlYce}IHOh@Ew4 zGix*oB+)nE7XGL4qcsLYfE6otT1(bM^cVAjTKA?%E7MLwnrj$7enL-)j%l~XjxHr%p~A=6G{fS2)a4({Vq*X7rixw@|tcj;i_PD5jY2q-(pBL4}&;~N7A$HM5T=XYOu@j{jpLsRfzV7%u5Is$u zf1*F~z3NqysJE8X=jzwDD(msxF(lRk&U&}E$?d^*G*tjbcdRI%R3EEpQB`l@=mDO~ z6ZyLb+?!xq1mRd+IBH}g`bf(e Date: Thu, 8 Feb 2024 03:05:43 +0100 Subject: [PATCH 346/647] test_test_Mathe_plus --- src/main/c/Mathe.c | 2 +- src/main/c/Mathe.h | 2 +- src/main/c/a.exe | Bin 44266 -> 0 bytes src/test/c/test_Mathe.c | 20 ++++++++++++++++++++ src/test/c/test_test.c | 28 ---------------------------- 5 files changed, 22 insertions(+), 30 deletions(-) delete mode 100644 src/main/c/a.exe create mode 100644 src/test/c/test_Mathe.c delete mode 100644 src/test/c/test_test.c diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index d4bb7dc..858a96f 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -189,4 +189,4 @@ int mainx() { printf("Vielen Dank fürs Spielen! Auf Wiedersehen.\n"); return 0; -} \ No newline at end of file +} diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h index 9c04579..d0e1b2c 100644 --- a/src/main/c/Mathe.h +++ b/src/main/c/Mathe.h @@ -7,4 +7,4 @@ int dividiere(int zahl1, int zahl2); int addiere(int zahl1, int zahl2); int subtrahiere(int zahl1, int zahl2); int multipliziere(int zahl1, int zahl2); -#endif // MATHEMATIKSPIE \ No newline at end of file +#endif // MATHEMATIKSPIE diff --git a/src/main/c/a.exe b/src/main/c/a.exe deleted file mode 100644 index 0e3a6cc9f6e52305bec9d18fba73a5a938d82f21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 44266 zcmeIb4R}=5wKu-c%!CXic-wWj^>&aLC7mq)a}XoB>3U z&`B)QX?nT0_SW9gdqr$7x39OgEjQ9iX&{(@QVo<=6zWB#Ix%RYA_lO|`&)aTGiOdF zvG=*peg6OV?b`!q&faUUwf0(Tuf6s@`<$~=bl(nUW{g>IhQo~Q!<7y@|NY{hHWVk_ z_{$`=cl>Xr?~@9DGrgj|q1D#nZC>ZCYP8iua(#G}&@W%59C!weIwZ z6DOpptV^AY6-pD?>IH}0Y%^mQCC1LOcqu_LO=I(bREpCC*j2bDO&x_Wa~oslM}cdgbj7_%LFU|C z{E$HNaFQ}n$68jpHodk=sRC>o!RaeqU-RWL|_)HuMN^z1-i=vQ_v@^SX zu1edU0Ki(Di8wQHMjha1Pp@umB~VM`CkjDLwo$zeqF!#pHWXNK=Bo(mh0B*+RzX>A zs~t#?9wcYf!SNIiuh&NKCvg&98P2GK@aAR+MHUnMS)7E&YaoC)pl{aP`Ac{vOa|=6 zc>~VnIHL|bOU|0RAcI5ZO1PZGN&FO?Q3uCcxR67R5Z(|@!rQ<>kspq?=*v9ML|BKN7e005Fz*3rXLr zQB28YLZ|1bO#dCZj&7w3wNXL1e_t5K;GWJd<*y9Pc`9w-5+gT`|6gzJTl}=!6m(^}(0ZUq_9Fm3p8Bt=Ft%bA73SPf& zo1N`WBm@{Un4L^`KZhI~MZo3}>|czqQi25m3;h^B!O5IMa_B=D)t(y)H9()xPAVb3 z)?Ezs5wl$uN`SNht`_JCH2@_rEiH73u3CHf&u4b#q|N4S1$3xHRLBAeXgO)gyDSjc ze^x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j%l~XjxHr%p~A=6G{fS2)a4({Vq*X7rixw@|tcj;i_PD5jY2q-(pBL4}&;~N7A$HM5T=XYOu@j{jpLsRfzV7%u5Is$u zf1*F~z3NqysJE8X=jzwDD(msxF(lRk&U&}E$?d^*G*tjbcdRI%R3EEpQB`l@=mDO~ z6ZyLb+?!xq1mRd+IBH}g`bf(e Date: Thu, 8 Feb 2024 03:08:02 +0100 Subject: [PATCH 347/647] test_Mathe_minus --- src/test/c/test_Mathe.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index 3fce345..ee30654 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -17,4 +17,18 @@ void test_Mathe_plus(void) TEST_ASSERT_EQUAL_INT(a,3); } + +void test_Mathe_minus(void) +{ + + int a=berechneErgebnis(1,2,'-'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,-1); +} + + + + + + #endif From 2fd811a54978f161ba12cb25c3d50acb040bf459 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Thu, 8 Feb 2024 16:23:57 +0100 Subject: [PATCH 348/647] something --- src/test/c/test_sudoku.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 557f85d..1fbe4e9 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -21,7 +21,6 @@ void tearDown(void) //1 // Unit test for Level_Pool() function -// Call the Level_Pool() function, prints 3 fixed lines and "Available levels for Difficulty " void test_Level_Pool_0() { selected_difficulty = 0; Level_Pool(selected_difficulty); From af29b81f51b12bcffbf46fc18b5971910a7fc0c1 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Thu, 8 Feb 2024 15:40:04 +0000 Subject: [PATCH 349/647] Update team.md --- team.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/team.md b/team.md index 59c808e..8a54816 100644 --- a/team.md +++ b/team.md @@ -4,5 +4,5 @@ - Simon Hildebrandt, fdai7864 - Lucas Heil, fdai7356 - Celine Khazarian, fdai7781 -- Ahmad Thaljeh, fdai7726 +- fdai7726, fdai7726 - Yasin Al Satouf, fdai7731 From 77b6c9715a682de12b917c2c5372e676acb3ec30 Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Thu, 8 Feb 2024 16:12:36 +0000 Subject: [PATCH 350/647] Add new directory --- src/test/c/support/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/test/c/support/.gitkeep diff --git a/src/test/c/support/.gitkeep b/src/test/c/support/.gitkeep new file mode 100644 index 0000000..e69de29 From 0215a5f00da452840444c6ec0bd1c36ea6c310b3 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:38:56 +0100 Subject: [PATCH 351/647] test_Mathe_multi --- src/test/c/test_Mathe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index ee30654..7d8ec5d 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -27,6 +27,15 @@ void test_Mathe_minus(void) } +void test_Mathe_multi(void) +{ + + int a=berechneErgebnis(1,2,'*'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,2); +} + + From 97f387552808a35201c7144f0659418ac9c9ca1c Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:42:34 +0100 Subject: [PATCH 352/647] test_Mathe_divided --- src/test/c/test_Mathe.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index 7d8ec5d..9f243e2 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -37,6 +37,17 @@ void test_Mathe_multi(void) +void test_Mathe_divided(void) +{ + + int a=berechneErgebnis(2,2,'/'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,1); +} + + + + From aa200f63bb5196e4cdd702a9d2f5e32bc0ad21c2 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:45:49 +0100 Subject: [PATCH 353/647] test_Zufallszahl --- src/test/c/test_Mathe.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index 9f243e2..c9e77f4 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -47,6 +47,17 @@ void test_Mathe_divided(void) +void test_Zufallszahl(void) +{ + + int a= generiereZufallszahl(1, 10); + + /* assert */ +TEST_ASSERT_INT_WITHIN (10, 1, a); + +} + + From 9e572e3ca2fa628f695b020ba880305dd8ab3842 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:48:57 +0100 Subject: [PATCH 354/647] testGeneriereZufallsOperator --- src/test/c/test_Mathe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index c9e77f4..3cd0107 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -58,6 +58,12 @@ TEST_ASSERT_INT_WITHIN (10, 1, a); } +void testGeneriereZufallsOperator() { + // Since the function always returns one of {'+', '-', '*', '/'}, no specific range check is needed. + char result = generiereZufallsOperator(); + TEST_ASSERT_TRUE(result == '+' || result == '-' || result == '*' || result == '/'); +} + From 72c03a59cec41d871c5ee9dfd1e779ffa18ff79f Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:50:50 +0100 Subject: [PATCH 355/647] test_multi --- src/test/c/test_Mathe.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index 3cd0107..84fe7a9 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -66,6 +66,21 @@ void testGeneriereZufallsOperator() { +void test_multi() +{ + + +int a=multipliziere(4, 3); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,12); + + + +} + + + + #endif From 1d7ce0e67ae28f3a962781e378713c28a95122ac Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:52:26 +0100 Subject: [PATCH 356/647] test_dev --- src/test/c/test_Mathe.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index 84fe7a9..e32f775 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -81,6 +81,23 @@ int a=multipliziere(4, 3); +void test_dev() +{ + +int a=dividiere(10, 5); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,2); + + + + +} + + + + + + #endif From d991bdf2a13a37752636afde4c211e82198be590 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:53:55 +0100 Subject: [PATCH 357/647] test_plus --- src/test/c/test_Mathe.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index e32f775..b7f5554 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -97,6 +97,20 @@ int a=dividiere(10, 5); +void test_plus() +{ + +int a=addiere(10, 5); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,15); + + + + +} + + + From 576e1c2431f9e43531633d793422cddaae166aae Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 17:55:28 +0100 Subject: [PATCH 358/647] test_minus() --- src/test/c/test_Mathe.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c index b7f5554..ebddf8d 100644 --- a/src/test/c/test_Mathe.c +++ b/src/test/c/test_Mathe.c @@ -111,6 +111,19 @@ int a=addiere(10, 5); +void test_minus() +{ + +int a=subtrahiere(10, 5); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,5); + + + + +} + + From deb85d0f7cf2e281254fec1cd4d637dc3edde09e Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 18:32:58 +0100 Subject: [PATCH 359/647] =?UTF-8?q?refactoring:=20Programmiername=20als=20?= =?UTF-8?q?Kommentar=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 858a96f..2a77221 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -1,4 +1,4 @@ -//1 +// Geschrieben von Yasin Al Satouf #include #include #include From 89ba5bb9bec0f2d1e632d4403743a6efea051de1 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 18:44:05 +0100 Subject: [PATCH 360/647] =?UTF-8?q?refactoring:=20variabelnnamen=C3=A4nder?= =?UTF-8?q?ungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 4 ++-- src/main/c/Mathe.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 2a77221..af3b076 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -92,8 +92,8 @@ void zeigeRundenEnde(int punkte) { printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); } //27 -int addiere(int zahl1, int zahl2) { - return zahl1 + zahl2; +int addiere(int ersteZahl, int zweiteZahl) { + return ersteZahl + zweiteZahl; } //28 int subtrahiere(int zahl1, int zahl2) { diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h index d0e1b2c..26ef11e 100644 --- a/src/main/c/Mathe.h +++ b/src/main/c/Mathe.h @@ -4,7 +4,7 @@ int berechneErgebnis(int zahl1, int zahl2, char operator); int generiereZufallszahl(int min, int max); int multipliziere(int zahl1, int zahl2); int dividiere(int zahl1, int zahl2); -int addiere(int zahl1, int zahl2); +int addiere(int ersteZahl, int zweiteZahl); int subtrahiere(int zahl1, int zahl2); int multipliziere(int zahl1, int zahl2); #endif // MATHEMATIKSPIE From 2fdc5110dcbbd9dba7c777316fd439c219fc51bc Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:12:51 +0100 Subject: [PATCH 361/647] =?UTF-8?q?refactoring:=20L=C3=B6schen=20von=20unn?= =?UTF-8?q?=C3=B6tigen=20Kommentaren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index af3b076..1c75bf5 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -4,47 +4,47 @@ #include #include "Mathe.h" -//2 + void initialisiereZufallsgenerator(); -//3 + int generiereZufallszahl(int min, int max); -//4 + char generiereZufallsOperator(); -//5 + int addiere(int zahl1, int zahl2); -//6 + int subtrahiere(int zahl1, int zahl2); -//7 + int multipliziere(int zahl1, int zahl2); -//8 + int dividiere(int zahl1, int zahl2); -//9 + int berechneErgebnis(int zahl1, int zahl2, char operator); -//10 + void spieleRunde(int schwierigkeitsgrad); -//11 + void zeigeAnleitung(); -//12 + void zeigeHighscore(int punkte); -//13 + int holeSpielerAntwort(); -//14 + void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); -//15 + void zeigeRundenEnde(int punkte); -//16 + void zeigeAuswahl(const char* text); //17 From 16db1ea703ec1e4f667fd0cb449d345ac8df0da7 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:19:47 +0100 Subject: [PATCH 362/647] =?UTF-8?q?refactoring:=20Printf-Ausgaben=C3=A4nde?= =?UTF-8?q?rungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 1c75bf5..d25f353 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -80,10 +80,10 @@ void zeigeHighscore(int punkte) { //25 void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { if (spielerAntwort == ergebnis) { - printf("Richtig! Du erhältst einen Punkt.\n"); + printf("Super, das ist richtig! Du erhältst einen Punkt.\n"); (*punkte)++; } else { - printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); + printf(" Leider Falsch! Die richtige Antwort ist %d\n", ergebnis); } } @@ -176,7 +176,7 @@ int mainx() { while (weiterSpielen) { int schwierigkeitsgrad; - printf("\nWähle einen Schwierigkeitsgrad (1 für einfach, 2 für mittel, 3 für schwer): "); + printf("\n Schwierigkeitsgrad wählen (1 für einfach, 2 für mittel, 3 für schwer): "); scanf("%d", &schwierigkeitsgrad); spieleRunde(schwierigkeitsgrad); From 9fcf777de991171f584fa6294501ba84e3e37406 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:25:02 +0100 Subject: [PATCH 363/647] =?UTF-8?q?refactoring:=20Korigieren=20von=20Outpu?= =?UTF-8?q?t-S=C3=A4tzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index d25f353..f617e62 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -66,9 +66,9 @@ char generiereZufallsOperator() { //22 void zeigeAnleitung() { printf("\n=== Anleitung ===\n"); - printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); - printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); - printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); + printf("Beantworte folgenden mathematischen Aufgaben, um Punkte zu sammeln.\n"); + printf("Du kannst dich zwischen verschiedenen Schwierigkeitsgraden entscheiden.\n"); + printf("Löse so viele Aufgaben wie möglich korrekt, um einen höhen Hichscore zu erhalten!\n"); } //23 From 21c8844c45f4f16d2ef4a3b868d986ecfeaca0cc Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:28:07 +0100 Subject: [PATCH 364/647] =?UTF-8?q?refactoring:=20Code=20von=20unn=C3=B6ti?= =?UTF-8?q?gen=20Kommentaren=20grreinigt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index f617e62..c6d30da 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -47,23 +47,23 @@ void zeigeRundenEnde(int punkte); void zeigeAuswahl(const char* text); -//17 + void initialisiereZufallsgenerator() { srand(time(NULL)); } -//18 + int generiereZufallszahl(int min, int max) { return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); } -//19 + char generiereZufallsOperator() { char operatoren[] = {'+', '-', '*', '/'}; int index = rand() % 4; return operatoren[index]; } -//22 + void zeigeAnleitung() { printf("\n=== Anleitung ===\n"); printf("Beantworte folgenden mathematischen Aufgaben, um Punkte zu sammeln.\n"); @@ -71,13 +71,13 @@ void zeigeAnleitung() { printf("Löse so viele Aufgaben wie möglich korrekt, um einen höhen Hichscore zu erhalten!\n"); } -//23 + void zeigeHighscore(int punkte) { printf("\n=== Highscore ===\n"); printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); } -//25 + void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { if (spielerAntwort == ergebnis) { printf("Super, das ist richtig! Du erhältst einen Punkt.\n"); @@ -87,23 +87,23 @@ void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { } } -//26 + void zeigeRundenEnde(int punkte) { printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); } -//27 + int addiere(int ersteZahl, int zweiteZahl) { return ersteZahl + zweiteZahl; } -//28 + int subtrahiere(int zahl1, int zahl2) { return zahl1 - zahl2; } -//29 + int multipliziere(int zahl1, int zahl2) { return zahl1 * zahl2; } -//30 + int dividiere(int zahl1, int zahl2) { if (zahl2 != 0) { return zahl1 / zahl2; @@ -114,11 +114,11 @@ int dividiere(int zahl1, int zahl2) { } -//31 + void zeigeAuswahl(const char* text) { printf("%s\n", text); } -//24 + int holeSpielerAntwort() { int spielerAntwort; zeigeAuswahl("Deine Antwort: "); @@ -142,7 +142,7 @@ int berechneErgebnis(int zahl1, int zahl2, char operator) { -//21 + void spieleRunde(int schwierigkeitsgrad) { int punkte = 0; int anzahlAufgaben = 5; From 1d3101fa39c17ca426b4e494223fb8191114819f Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:41:27 +0100 Subject: [PATCH 365/647] refactoring: Umformelierung des Parameters min --- src/main/c/Mathe.c | 6 +++--- src/main/c/Mathe.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index c6d30da..9099808 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -8,7 +8,7 @@ void initialisiereZufallsgenerator(); -int generiereZufallszahl(int min, int max); +int generiereZufallszahl(int minimum, int max); char generiereZufallsOperator(); @@ -54,8 +54,8 @@ void initialisiereZufallsgenerator() { -int generiereZufallszahl(int min, int max) { - return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); +int generiereZufallszahl(int minimum, int max) { + return minimum + (int)((double)rand() / (RAND_MAX + 1) * (max - minimum + 1)); } char generiereZufallsOperator() { diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h index 26ef11e..16daed3 100644 --- a/src/main/c/Mathe.h +++ b/src/main/c/Mathe.h @@ -1,7 +1,7 @@ #ifndef TEST_H #define TEST_H int berechneErgebnis(int zahl1, int zahl2, char operator); -int generiereZufallszahl(int min, int max); +int generiereZufallszahl(int minimum, int max); int multipliziere(int zahl1, int zahl2); int dividiere(int zahl1, int zahl2); int addiere(int ersteZahl, int zweiteZahl); From 07b1a04cff0d5b74fe30a2fd68da997a1b3ab8e9 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:46:10 +0100 Subject: [PATCH 366/647] refactoring: max-Parameter-Umschreibung --- src/main/c/Mathe.c | 6 +++--- src/main/c/Mathe.h | 2 +- src/main/c/a.exe | Bin 0 -> 44266 bytes 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 src/main/c/a.exe diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 9099808..351fb29 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -8,7 +8,7 @@ void initialisiereZufallsgenerator(); -int generiereZufallszahl(int minimum, int max); +int generiereZufallszahl(int minimum, int maximum); char generiereZufallsOperator(); @@ -54,8 +54,8 @@ void initialisiereZufallsgenerator() { -int generiereZufallszahl(int minimum, int max) { - return minimum + (int)((double)rand() / (RAND_MAX + 1) * (max - minimum + 1)); +int generiereZufallszahl(int minimum, int maximum) { + return minimum + (int)((double)rand() / (RAND_MAX + 1) * (maximum - minimum + 1)); } char generiereZufallsOperator() { diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h index 16daed3..b95e151 100644 --- a/src/main/c/Mathe.h +++ b/src/main/c/Mathe.h @@ -1,7 +1,7 @@ #ifndef TEST_H #define TEST_H int berechneErgebnis(int zahl1, int zahl2, char operator); -int generiereZufallszahl(int minimum, int max); +int generiereZufallszahl(int minimum, int maximum); int multipliziere(int zahl1, int zahl2); int dividiere(int zahl1, int zahl2); int addiere(int ersteZahl, int zweiteZahl); diff --git a/src/main/c/a.exe b/src/main/c/a.exe new file mode 100644 index 0000000000000000000000000000000000000000..e650f6d7f59149f1a7ba6920982c75fd0cdc4e28 GIT binary patch literal 44266 zcmeIb4R}=5wKu-c%!CXiWD*I2iaOY!pb!WGMGZQWWbz^TG9P>>IOJnOQYIhHoB>3U z&`B(((|EbJ_SW9gdqr$7x39OgEjQ9?Z6KIHr5Y)%DAbEebz;y)MGRn__qX;wXU?2V zV()XG`~3g!+qVZ!&faUUwf0(Tuf6s@`<%0<LdiYm%- zTkS-G^dLE74vr^#dA)XmKaP{|DsaXegf~A+D6*8`Pvay!UIPKd0ey4kFT90kB4ofG zoY&x7fivcCu+*ISi?TRmzJ$wZoWxJY8FO&F#fv%QFyRg3B)p9r6#c{TmVBA#xqRfI zgts}0!V}OV#|ZiVJ{LSYBb1k653vwi_V=*RrqX3yxcJvCgCq6WI*&r6{=5wCnf;aw z@|y61OvZvElC7fzY!A34x_K(D^LjlIJZz36Z zHHImq+WQnU?s1HN*#*`!NT=cB^dk?Ks!|%XfT_~C${D^@Btdt z7JeULOGxp@&qa+YCa>|`xzPD=WblZwj2rnywd~(f)+JxhRQaowKUN0MrtjWd=^!i3 zfD&W}ZWnSfwc^M?@N6=rQynZ^NQ#}cgv%!}w%h7(FvXG)u7qUae@2wpZExeOaza<{ z-|k?0k_iFE4CSU0-p?QhM-i|E1p5~wtejvWz`{SmpU_m!AvOG=4b`3*4mUxc@GdGL zzSi9g^%1k(7D|A$39hE}hMRz*%*Y5|psUti!L!+2c^PwgTLB#^5f!pP0$N^1>TU}J z4xW~fP6q01sw2D@#lb__y*uIGpdq72ralSv!p|D*Day%mYWa7K<&jwfpz7MF**`L? z2l<`R1MRT_4U$T>E(d!HReaV$F7y*HRl(5i#hZA+9^9$6<=*^{obe@JM9U%zo7 zxpRFS$W+oqMhM+{v}WuQi_!RS$<;R%t-v)aM$$sn7M{ zygt`QH}<(co*(`J)pt-CI52YUf$%lb!QflwImm)X7m=Qm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ji{8c{F~Ep2YG9G&ig4X7rOB+A=v!zKI|D%~>OUYNL@NqWHus9!e z`3JL@_@CWWQH-0(qqS7?>Tz>acQ6Eef1p*1_g^^N8mGaUcb;LS52bcT2h~D+~Ait;Jaf;tOcA6 z9$$;ci|uG?0F3QeF+Qn2R@0)Y-omj1JeMc>y9eBxU|R&?cwIPZbR+s`%NgT{p<(KA z>!1$ARih?MoY}bZpD*szV~sJK-{?@T`f*Ii9X~c}!z#vi-MG=YoSRe;(GK&em|GQs ZVS54!1X>SMqv&W$joW*<=;{jp{{{*7T}J=_ literal 0 HcmV?d00001 From 2f567de876751e9b96dd9a325b644442475156c5 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 19:52:40 +0100 Subject: [PATCH 367/647] =?UTF-8?q?refactoring:=20=C3=84nderung=20der=20Sp?= =?UTF-8?q?ielanleitung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 351fb29..380cbdf 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -66,9 +66,9 @@ char generiereZufallsOperator() { void zeigeAnleitung() { printf("\n=== Anleitung ===\n"); - printf("Beantworte folgenden mathematischen Aufgaben, um Punkte zu sammeln.\n"); - printf("Du kannst dich zwischen verschiedenen Schwierigkeitsgraden entscheiden.\n"); - printf("Löse so viele Aufgaben wie möglich korrekt, um einen höhen Hichscore zu erhalten!\n"); + printf("Löse die folgenden mathematischen Aufgaben, um Punkte zu erzielen.\n"); + printf("Sie haben die Möglichkeit, zwischen verschiedenen Schwierigkeitsgraden zu wählen.\n"); + printf("Versuche, so viele Aufgaben wie möglich korrekt zu lösen, um einen höheren Highscore zu erzielen.!\n"); } From d5dd1b92e92895fc2c40d1766ed7f48723c63620 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 20:04:55 +0100 Subject: [PATCH 368/647] refactoring: IndexParameter umgeschrieben --- src/main/c/Mathe.c | 4 ++-- src/main/c/a.exe | Bin 44266 -> 0 bytes 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 src/main/c/a.exe diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 380cbdf..094750a 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -60,8 +60,8 @@ int generiereZufallszahl(int minimum, int maximum) { char generiereZufallsOperator() { char operatoren[] = {'+', '-', '*', '/'}; - int index = rand() % 4; - return operatoren[index]; + int indexnumber = rand() % 4; + return operatoren[indexnumber]; } void zeigeAnleitung() { diff --git a/src/main/c/a.exe b/src/main/c/a.exe deleted file mode 100644 index e650f6d7f59149f1a7ba6920982c75fd0cdc4e28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 44266 zcmeIb4R}=5wKu-c%!CXiWD*I2iaOY!pb!WGMGZQWWbz^TG9P>>IOJnOQYIhHoB>3U z&`B(((|EbJ_SW9gdqr$7x39OgEjQ9?Z6KIHr5Y)%DAbEebz;y)MGRn__qX;wXU?2V zV()XG`~3g!+qVZ!&faUUwf0(Tuf6s@`<%0<LdiYm%- zTkS-G^dLE74vr^#dA)XmKaP{|DsaXegf~A+D6*8`Pvay!UIPKd0ey4kFT90kB4ofG zoY&x7fivcCu+*ISi?TRmzJ$wZoWxJY8FO&F#fv%QFyRg3B)p9r6#c{TmVBA#xqRfI zgts}0!V}OV#|ZiVJ{LSYBb1k653vwi_V=*RrqX3yxcJvCgCq6WI*&r6{=5wCnf;aw z@|y61OvZvElC7fzY!A34x_K(D^LjlIJZz36Z zHHImq+WQnU?s1HN*#*`!NT=cB^dk?Ks!|%XfT_~C${D^@Btdt z7JeULOGxp@&qa+YCa>|`xzPD=WblZwj2rnywd~(f)+JxhRQaowKUN0MrtjWd=^!i3 zfD&W}ZWnSfwc^M?@N6=rQynZ^NQ#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>KUON~)L+v@tTPYih%-v^4K5vMIcm>VZ#}i7-lC1zOV};mvtXHE5wv-ur=~5o$wjvjOMGgD zVi`kpA#HPJwFu_HCeYee)a3c`5DX;b547)(+NDKnMYkj-n%HfysW(Q6j1D4hU)0L^ zA{r0K*l(%TZ}35`hWakAiXPpR*-c9GM$x(-?rr`e%;wqT61pxzx6whX2p?x^nnWv)`Ub+W=8oB!oI9%K zJ$$ohHLz-87`Ec(VVUn@&go)5KtdnH&N{T2H5vty=o@eg|I_%<8iOIgiWNJpCF`R4 zi+Mr4XLGcbX(u7gH4Gm=p{K;gG}??yYfQ1LHkaENdFk>aq4j*A1rL z5<~JaI;04EV|kmliMQKLtsT`UCa96-Fqfvon6YJy(Ji{8c{F~Ep2YG9G&ig4X7rOB+A=v!zKI|D%~>OUYNL@NqWHus9!e z`3JL@_@CWWQH-0(qqS7?>Tz>acQ6Eef1p*1_g^^N8mGaUcb;LS52bcT2h~D+~Ait;Jaf;tOcA6 z9$$;ci|uG?0F3QeF+Qn2R@0)Y-omj1JeMc>y9eBxU|R&?cwIPZbR+s`%NgT{p<(KA z>!1$ARih?MoY}bZpD*szV~sJK-{?@T`f*Ii9X~c}!z#vi-MG=YoSRe;(GK&em|GQs ZVS54!1X>SMqv&W$joW*<=;{jp{{{*7T}J=_ From 59fef5882a10928f0b7db4f528493f85ae639bae Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Thu, 8 Feb 2024 20:48:52 +0100 Subject: [PATCH 369/647] delete critical bib --- src/main/c/hangman.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index e2f3360..9ffe61a 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include \ No newline at end of file From 4098cb4030fc0c32dcd7faf10b302f4303801570 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:03:21 +0100 Subject: [PATCH 370/647] Direction; change_direction N --> E --- src/main/c/global.h | 8 ++++++++ src/main/c/labyrinth.c | 14 ++++++++++++++ src/main/c/labyrinth.h | 8 ++++++++ src/main/c/test.c | 6 ------ src/main/c/test.h | 6 ------ src/test/c/support/.invis | 0 src/test/c/test_labyrinth.c | 27 +++++++++++++++++++++++++++ src/test/c/test_test.c | 28 ---------------------------- 8 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 src/main/c/global.h create mode 100644 src/main/c/labyrinth.c create mode 100644 src/main/c/labyrinth.h delete mode 100644 src/main/c/test.c delete mode 100644 src/main/c/test.h delete mode 100644 src/test/c/support/.invis create mode 100644 src/test/c/test_labyrinth.c delete mode 100644 src/test/c/test_test.c diff --git a/src/main/c/global.h b/src/main/c/global.h new file mode 100644 index 0000000..b6aa8f0 --- /dev/null +++ b/src/main/c/global.h @@ -0,0 +1,8 @@ +#ifndef GLOBAL_H +#define GLOBAL_H + +typedef enum { + N, E, S, W +} Dir; + +#endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c new file mode 100644 index 0000000..8067030 --- /dev/null +++ b/src/main/c/labyrinth.c @@ -0,0 +1,14 @@ +#include "labyrinth.h" + +#include "global.h" + +#include "stdio.h" +#include "stdlib.h" + +void change_direction(Dir *direction){ + switch (*direction) { + case N: + *direction = E; + break; + } +} diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h new file mode 100644 index 0000000..0ab2124 --- /dev/null +++ b/src/main/c/labyrinth.h @@ -0,0 +1,8 @@ +#ifndef TEST_H +#define TEST_H + +#include "global.h" + +void change_direction(Dir *direction); + +#endif // TEST_H diff --git a/src/main/c/test.c b/src/main/c/test.c deleted file mode 100644 index 52489ec..0000000 --- a/src/main/c/test.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "test.h" - -int return_5(){ - return 5; -} - diff --git a/src/main/c/test.h b/src/main/c/test.h deleted file mode 100644 index 4458e13..0000000 --- a/src/main/c/test.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef TEST_H -#define TEST_H - -int return_5(); - -#endif // TEST_H diff --git a/src/test/c/support/.invis b/src/test/c/support/.invis deleted file mode 100644 index e69de29..0000000 diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c new file mode 100644 index 0000000..9426c2c --- /dev/null +++ b/src/test/c/test_labyrinth.c @@ -0,0 +1,27 @@ +#include "unity.h" + +#include "stdlib.h" + +#include "labyrinth.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_change_direction_from_N_expected_E(void) +{ + /* arrange */ + Dir actual = N; + Dir expected = E; + + /* act */ + change_direction(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} + 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 4dff49735e96340a52a2cee536fd998166bb7326 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:12:44 +0100 Subject: [PATCH 371/647] refactoring: change_direction --- src/main/c/global.h | 2 +- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- src/test/c/test_labyrinth.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/c/global.h b/src/main/c/global.h index b6aa8f0..556a1f1 100644 --- a/src/main/c/global.h +++ b/src/main/c/global.h @@ -3,6 +3,6 @@ typedef enum { N, E, S, W -} Dir; +} Direction; #endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 8067030..980b367 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -5,7 +5,7 @@ #include "stdio.h" #include "stdlib.h" -void change_direction(Dir *direction){ +void turn_direction_right(Direction *direction){ switch (*direction) { case N: *direction = E; diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 0ab2124..4c077e9 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -3,6 +3,6 @@ #include "global.h" -void change_direction(Dir *direction); +void turn_direction_right(Direction *direction); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 9426c2c..a31da00 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -15,11 +15,11 @@ void tearDown(void) void test_change_direction_from_N_expected_E(void) { /* arrange */ - Dir actual = N; - Dir expected = E; + Direction actual = N; + Direction expected = E; /* act */ - change_direction(&actual); + turn_direction_right(&actual); /* assert */ TEST_ASSERT_TRUE(expected == actual); From f21465727e9884199d8a72febbf7d38b988576b5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:14:53 +0100 Subject: [PATCH 372/647] change direction right E --> S --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 980b367..adaaab5 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -10,5 +10,8 @@ void turn_direction_right(Direction *direction){ case N: *direction = E; break; + case E: + *direction = S; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index a31da00..563d886 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -25,3 +25,15 @@ void test_change_direction_from_N_expected_E(void) TEST_ASSERT_TRUE(expected == actual); } +void test_turn_direction_right_from_E_expected_S(void) +{ + /* arrange */ + Direction actual = E; + Direction expected = S; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} From 766953d53118614273737222c46a3e80632b247c Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:16:33 +0100 Subject: [PATCH 373/647] change direction right S --> W --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index adaaab5..d53c95b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -13,5 +13,8 @@ void turn_direction_right(Direction *direction){ case E: *direction = S; break; + case S: + *direction = W; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 563d886..555736d 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -37,3 +37,17 @@ void test_turn_direction_right_from_E_expected_S(void) /* assert */ TEST_ASSERT_TRUE(expected == actual); } + +void test_turn_direction_right_from_S_expected_W(void) +{ + /* arrange */ + Direction actual = S; + Direction expected = W; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} + From 4a00a81935017e4d341d21d11bb02eff74e71b52 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:18:08 +0100 Subject: [PATCH 374/647] turn_direction_right W --> N --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index d53c95b..a76a53b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -16,5 +16,8 @@ void turn_direction_right(Direction *direction){ case S: *direction = W; break; + case W: + *direction = N; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 555736d..e257b07 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -51,3 +51,16 @@ void test_turn_direction_right_from_S_expected_W(void) TEST_ASSERT_TRUE(expected == actual); } +void test_turn_direction_right_from_W_expected_N(void) +{ + /* arrange */ + Direction actual = W; + Direction expected = N; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} + From f0714574269afae276ade2110dafe77c8e2427ba Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:20:32 +0100 Subject: [PATCH 375/647] move north set x 0 --- src/main/c/labyrinth.c | 10 ++++++++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index a76a53b..89227c3 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -21,3 +21,13 @@ void turn_direction_right(Direction *direction){ break; } } + +void move(unsigned short *x, unsigned short *y, Direction direction){ + + if (direction == N){ + *x = 0; + return; + } + +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 4c077e9..402e915 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -4,5 +4,6 @@ #include "global.h" void turn_direction_right(Direction *direction); +void move(unsigned short *x, unsigned short *y, Direction direction); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index e257b07..5e63380 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -64,3 +64,20 @@ void test_turn_direction_right_from_W_expected_N(void) TEST_ASSERT_TRUE(expected == actual); } +void test_lab_move_from_1_1_N_expected_0_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = N; + + unsigned short x_expected = 0; + unsigned short y_expected = 1; + + /* act */ + move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From c8af86ef9014dfe8fb40a880d86bd7f4ac9501a2 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:21:43 +0100 Subject: [PATCH 376/647] refactoring: move --> lab_move --- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- src/test/c/test_labyrinth.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 89227c3..d4cec1d 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -22,7 +22,7 @@ void turn_direction_right(Direction *direction){ } } -void move(unsigned short *x, unsigned short *y, Direction direction){ +void lab_move(unsigned short *x, unsigned short *y, Direction direction){ if (direction == N){ *x = 0; diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 402e915..3bd9821 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -4,6 +4,6 @@ #include "global.h" void turn_direction_right(Direction *direction); -void move(unsigned short *x, unsigned short *y, Direction direction); +void lab_move(unsigned short *x, unsigned short *y, Direction direction); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 5e63380..5233c20 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -75,7 +75,7 @@ void test_lab_move_from_1_1_N_expected_0_1(void) unsigned short y_expected = 1; /* act */ - move(&x, &y, direction); + lab_move(&x, &y, direction); /* assert */ TEST_ASSERT_TRUE(x == x_expected && y == y_expected); From 1e37e093fb7006ab58138cf3fe7ade49dcc3befc Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:33:10 +0100 Subject: [PATCH 377/647] lab move N --> x - 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index d4cec1d..5b18703 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -25,7 +25,7 @@ void turn_direction_right(Direction *direction){ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ if (direction == N){ - *x = 0; + *x = *x - 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 5233c20..022c2e8 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -81,3 +81,20 @@ void test_lab_move_from_1_1_N_expected_0_1(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_N_expected_4_5(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = N; + + unsigned short x_expected = 4; + unsigned short y_expected = 5; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 0d6b5b8137bd37fe3d22e3e73e7d436118f40bf7 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:34:30 +0100 Subject: [PATCH 378/647] lab_move direction E --> y = 2 --- src/main/c/labyrinth.c | 4 ++++ src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 5b18703..2575180 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -28,6 +28,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ *x = *x - 1; return; } + if (direction == E){ + *y = 2; + return; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 022c2e8..85ad115 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -98,3 +98,20 @@ void test_lab_move_from_5_5_N_expected_4_5(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_1_1_E_expected_1_2(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = E; + + unsigned short x_expected = 1; + unsigned short y_expected = 2; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 4c7b6e8fa2e4e53f8aabee80634450cde25d5fff Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:35:38 +0100 Subject: [PATCH 379/647] lab_move direction East y --> y + 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 2575180..2ac9193 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -29,7 +29,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ return; } if (direction == E){ - *y = 2; + *y = *y + 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 85ad115..9599c01 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -115,3 +115,20 @@ void test_lab_move_from_1_1_E_expected_1_2(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_E_expected_5_6(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = E; + + unsigned short x_expected = 5; + unsigned short y_expected = 6; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 144b13919feadf0ad7eec730e74359a49c58d18c Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:37:41 +0100 Subject: [PATCH 380/647] lab_move direction S x --> 2 --- src/main/c/labyrinth.c | 4 ++++ src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 2ac9193..ed5b973 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -32,6 +32,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ *y = *y + 1; return; } + if (direction == S){ + *x = 2; + return; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 9599c01..ad8180f 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -132,3 +132,20 @@ void test_lab_move_from_5_5_E_expected_5_6(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_1_1_S_expected_2_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = S; + + unsigned short x_expected = 2; + unsigned short y_expected = 1; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 4e69b698fb61408ed4186cbab82394aad9462075 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:39:17 +0100 Subject: [PATCH 381/647] lab_move direction S x --> x + 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index ed5b973..b3d95b2 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -33,7 +33,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ return; } if (direction == S){ - *x = 2; + *x = *x + 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index ad8180f..bd2c483 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -149,3 +149,20 @@ void test_lab_move_from_1_1_S_expected_2_1(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_S_expected_6_5(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = S; + + unsigned short x_expected = 6; + unsigned short y_expected = 5; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 0e82dd835e75247bd8f031acc2019ad87f9f27b5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:40:55 +0100 Subject: [PATCH 382/647] lab_move direction W y --> 0 --- src/main/c/labyrinth.c | 4 ++++ src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index b3d95b2..59bff17 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -36,6 +36,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ *x = *x + 1; return; } + if (direction == W){ + *y = 0; + return; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index bd2c483..03b1642 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -166,3 +166,20 @@ void test_lab_move_from_5_5_S_expected_6_5(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_1_1_W_expected_1_0(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + Direction direction = W; + + unsigned short x_expected = 1; + unsigned short y_expected = 0; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From 91a941c8f6684fd8a8d47371a374ec61b6e6e425 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:42:11 +0100 Subject: [PATCH 383/647] lab_move direction W y --> y - 1 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 59bff17..ba08944 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -37,7 +37,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ return; } if (direction == W){ - *y = 0; + *y = *y - 1; return; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 03b1642..98d4f2f 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -183,3 +183,20 @@ void test_lab_move_from_1_1_W_expected_1_0(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_lab_move_from_5_5_W_expected_5_4(void) +{ + /* arrange */ + unsigned short x = 5; + unsigned short y = 5; + Direction direction = W; + + unsigned short x_expected = 5; + unsigned short y_expected = 4; + + /* act */ + lab_move(&x, &y, direction); + + /* assert */ + TEST_ASSERT_TRUE(x == x_expected && y == y_expected); +} + From c6e2986865d9ec379865c89e8748c843b09af81e Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:43:15 +0100 Subject: [PATCH 384/647] set_wall at 0 0 --- src/main/c/global.h | 4 ++++ src/main/c/labyrinth.c | 4 ++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/src/main/c/global.h b/src/main/c/global.h index 556a1f1..1dea8db 100644 --- a/src/main/c/global.h +++ b/src/main/c/global.h @@ -5,4 +5,8 @@ typedef enum { N, E, S, W } Direction; +typedef enum { + WAY, WALL, SOLUTION +} State; + #endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index ba08944..7b13e6e 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -43,3 +43,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ } +void set_wall(State** field, unsigned short x, unsigned short y) { + field[0][0] = WALL; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 3bd9821..15cd364 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -5,5 +5,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); +void set_wall(State** field, unsigned short x, unsigned short y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 98d4f2f..f950838 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -200,3 +200,34 @@ void test_lab_move_from_5_5_W_expected_5_4(void) TEST_ASSERT_TRUE(x == x_expected && y == y_expected); } +void test_set_wall_at_0_0_expected_WALL(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + + unsigned short len_x = 1, len_y = 1; + State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WAY; + + State expected = WALL; + + /* act */ + set_wall(field, x, y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 0f2ee4f9a293224bb614a91b4c3777a28eeaf7b6 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:45:26 +0100 Subject: [PATCH 385/647] refactoring: State --> Field_State --- src/main/c/global.h | 2 +- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- src/test/c/test_labyrinth.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/c/global.h b/src/main/c/global.h index 1dea8db..6da861c 100644 --- a/src/main/c/global.h +++ b/src/main/c/global.h @@ -7,6 +7,6 @@ typedef enum { typedef enum { WAY, WALL, SOLUTION -} State; +} Field_State; #endif \ No newline at end of file diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 7b13e6e..71ccb5c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -43,7 +43,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ } -void set_wall(State** field, unsigned short x, unsigned short y) { +void set_wall(Field_State** field, unsigned short x, unsigned short y) { field[0][0] = WALL; } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 15cd364..5b789f4 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -5,6 +5,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); -void set_wall(State** field, unsigned short x, unsigned short y); +void set_wall(Field_State** field, unsigned short x, unsigned short y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index f950838..9ef1074 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -207,7 +207,7 @@ void test_set_wall_at_0_0_expected_WALL(void) unsigned short y = 0; unsigned short len_x = 1, len_y = 1; - State **field; + Field_State **field; field = malloc(len_x * sizeof *field); for (int c_index = 0; c_index < len_x; c_index++){ @@ -216,7 +216,7 @@ void test_set_wall_at_0_0_expected_WALL(void) field[x][y] = WAY; - State expected = WALL; + Field_State expected = WALL; /* act */ set_wall(field, x, y); From 318d572d470810f7a9d21a76e824612055b6ba97 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:47:01 +0100 Subject: [PATCH 386/647] set_wall at any x y --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 71ccb5c..8afa959 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -44,6 +44,6 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){ } void set_wall(Field_State** field, unsigned short x, unsigned short y) { - field[0][0] = WALL; + field[x][y] = WALL; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 9ef1074..b5d9091 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -231,3 +231,34 @@ void test_set_wall_at_0_0_expected_WALL(void) free(field); } +void test_set_wall_at_2_3_expected_WALL(void) +{ + /* arrange */ + unsigned short x = 2; + unsigned short y = 3; + + unsigned short len_x = 5, len_y = 5; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WAY; + + Field_State expected = WALL; + + /* act */ + set_wall(field, x, y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From ab6ef224ab00618584be653c27dafcda434b47ee Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:48:59 +0100 Subject: [PATCH 387/647] init_field with WAY at 0 0 --- src/main/c/labyrinth.c | 4 ++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 8afa959..75c718b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -47,3 +47,7 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { field[x][y] = WALL; } +void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ + field[0][0] = WAY; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 5b789f4..19b1835 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -6,5 +6,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); +void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index b5d9091..3658ce2 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -262,3 +262,33 @@ void test_set_wall_at_2_3_expected_WALL(void) free(field); } +void test_init_field_at_0_0_expected_WAY(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WALL; + + Field_State expected = WAY; + + /* act */ + init_field(field, len_x, len_y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} From 6e7d15b4c1275b3798b7d1e9ee9b3af2f935d23b Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:51:20 +0100 Subject: [PATCH 388/647] init_field with all x --> WAY --- src/main/c/labyrinth.c | 4 +++- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 75c718b..4c10c06 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -48,6 +48,8 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { } void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ - field[0][0] = WAY; + for (int x = 0; x < len_x; x++){ + field[x][0] = WAY; + } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 3658ce2..c8fa6cf 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -292,3 +292,34 @@ void test_init_field_at_0_0_expected_WAY(void) } free(field); } + +void test_init_field_at_2_0_expected_WAY(void) +{ + /* arrange */ + unsigned short x = 2; + unsigned short y = 0; + + unsigned short len_x = 5, len_y = 5; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WALL; + + Field_State expected = WAY; + + /* act */ + init_field(field, len_x, len_y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} From a9872e34a116fcdf93e4c1d2e30576cdb6a014d3 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:52:27 +0100 Subject: [PATCH 389/647] init_field any x y --> WAY --- src/main/c/labyrinth.c | 4 +++- src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 4c10c06..63d9f94 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -49,7 +49,9 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ for (int x = 0; x < len_x; x++){ - field[x][0] = WAY; + for (int y = 0; y < len_y; y++){ + field[x][y] = WAY; + } } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index c8fa6cf..2027c8b 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -323,3 +323,35 @@ void test_init_field_at_2_0_expected_WAY(void) } free(field); } + +void test_init_field_at_2_3_expected_WAY(void) +{ + /* arrange */ + unsigned short x = 2; + unsigned short y = 3; + + unsigned short len_x = 5, len_y = 5; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + field[x][y] = WALL; + + Field_State expected = WAY; + + /* act */ + init_field(field, len_x, len_y); + + /* assert */ + TEST_ASSERT_TRUE(field[x][y] == expected); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 33eba406477d4ca1851eeff0f909b52ef3dc804b Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:56:31 +0100 Subject: [PATCH 390/647] refactoring: init_field --- src/main/c/labyrinth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 63d9f94..9259093 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -48,9 +48,9 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y) { } void init_field(Field_State** field, unsigned short len_x, unsigned short len_y){ - for (int x = 0; x < len_x; x++){ - for (int y = 0; y < len_y; y++){ - field[x][y] = WAY; + for (int c_x = 0; c_x < len_x; c_x++){ + for (int c_y = 0; c_y < len_y; c_y++){ + field[c_x][c_y] = WAY; } } } From 48f9316f89f9f6ee62ecb1d50b8a482146b8e745 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:58:10 +0100 Subject: [PATCH 391/647] lab_can_move North undefined --- src/main/c/labyrinth.c | 10 ++++++++++ src/main/c/labyrinth.h | 1 + src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 9259093..8087c3b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -55,3 +55,13 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) } } +short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y){ + + lab_move(&x, &y, direction); + if (x == 65535){ + return 1; + } + + return 0; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 19b1835..ef19e30 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -7,5 +7,6 @@ void turn_direction_right(Direction *direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); +short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); #endif // TEST_H diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 2027c8b..7192ff4 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -355,3 +355,34 @@ void test_init_field_at_2_3_expected_WAY(void) free(field); } +void test_lab_can_move_at_0_0_direction_N_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = N; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 2a7419d3a55fde77493dfc6bd5ca516b89e8b662 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:00:18 +0100 Subject: [PATCH 392/647] lab_can_move y undefined --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 8087c3b..4686b6c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -61,6 +61,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (x == 65535){ return 1; } + if (y == 1){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 7192ff4..aa50607 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -385,4 +385,35 @@ void test_lab_can_move_at_0_0_direction_N_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_0_0_direction_E_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = E; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 6bf1d1946fd7a4bc3fecf10973be983cbfe293db Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:01:44 +0100 Subject: [PATCH 393/647] lab_can_move x undefined over 0 --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 4686b6c..ea27816 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -58,7 +58,7 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y){ lab_move(&x, &y, direction); - if (x == 65535){ + if (x >= len_x){ return 1; } if (y == 1){ diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index aa50607..83abd75 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -415,5 +415,36 @@ void test_lab_can_move_at_0_0_direction_E_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_0_0_direction_S_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = S; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 92f2f74c3e5085ae7c50dc91bda1d05097d8d14f Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:03:36 +0100 Subject: [PATCH 394/647] lab_can_move y undefined below 0 (overflow) --- src/main/c/labyrinth.c | 2 +- src/test/c/test_labyrinth.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index ea27816..50db9df 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -61,7 +61,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (x >= len_x){ return 1; } - if (y == 1){ + if (y >= len_y){ return 1; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 83abd75..0d8d6bc 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -445,6 +445,37 @@ void test_lab_can_move_at_0_0_direction_S_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_0_0_direction_W_target_undefined_expected_1(void) +{ + /* arrange */ + unsigned short x = 0; + unsigned short y = 0; + Direction direction = W; + short expected = 1; + short actual; + + unsigned short len_x = 1, len_y = 1; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 79f624d98e71d88fb98dd32b7dd49532a7884469 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:04:46 +0100 Subject: [PATCH 395/647] lab_can_move direction N WALL above --- src/main/c/labyrinth.c | 5 ++++- src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 50db9df..688ef35 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -56,7 +56,7 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) } short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y){ - + lab_move(&x, &y, direction); if (x >= len_x){ return 1; @@ -64,6 +64,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (y >= len_y){ return 1; } + if (direction == N && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 0d8d6bc..a392006 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -475,6 +475,40 @@ void test_lab_can_move_at_0_0_direction_W_target_undefined_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_N_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 0; + unsigned short y_target = 1; + Direction direction = N; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 3ac2d274caff8bbb5f1040bb425abddb38fabf87 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:06:22 +0100 Subject: [PATCH 396/647] lab_can_move direction E WALL heading WALL --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 688ef35..004c661 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -67,6 +67,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == N && field[x][y] == WALL){ return 1; } + if (direction == E && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index a392006..3c00353 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -508,6 +508,40 @@ void test_lab_can_move_at_1_1_direction_N_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_E_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 2; + Direction direction = E; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 3a8150ceb7cbeec20716c691bf3f886de926d3e8 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:08:55 +0100 Subject: [PATCH 397/647] lab_can_move direction S heading WALL --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 004c661..7b9a2a8 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -70,6 +70,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == E && field[x][y] == WALL){ return 1; } + if (direction == S && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 3c00353..de5b7c6 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -541,6 +541,40 @@ void test_lab_can_move_at_1_1_direction_E_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_S_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 2; + unsigned short y_target = 1; + Direction direction = S; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 73ebd8f7974fd091c990a5807bdfb2b4508c648a Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:09:56 +0100 Subject: [PATCH 398/647] lab_can_move direction W heading WALL --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 7b9a2a8..c0aa3ed 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -73,6 +73,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == S && field[x][y] == WALL){ return 1; } + if (direction == W && field[x][y] == WALL){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index de5b7c6..4a60303 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -574,6 +574,40 @@ void test_lab_can_move_at_1_1_direction_S_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 0; + Direction direction = W; + short expected = 1; + short actual; + + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = WALL; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + + From 36a7beb0b4cded67571a75b30d32b5fad0a8f5fb Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:11:32 +0100 Subject: [PATCH 399/647] refactoring: lab_can_move --- src/main/c/labyrinth.c | 11 +---------- src/test/c/test_labyrinth.c | 8 -------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index c0aa3ed..6acd557 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -64,16 +64,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (y >= len_y){ return 1; } - if (direction == N && field[x][y] == WALL){ - return 1; - } - if (direction == E && field[x][y] == WALL){ - return 1; - } - if (direction == S && field[x][y] == WALL){ - return 1; - } - if (direction == W && field[x][y] == WALL){ + if (field[x][y] == WALL){ return 1; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 4a60303..5cde2e1 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -607,11 +607,3 @@ void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) free(field); } - - - - - - - - From 315cbf847ca50352a5eb9323825abad9a6f55c24 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:13:03 +0100 Subject: [PATCH 400/647] lab_can_move direction N heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 6acd557..e6f9ed5 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -67,6 +67,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (field[x][y] == WALL){ return 1; } + if (direction == N && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 5cde2e1..27bc07f 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -607,3 +607,35 @@ void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_N_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 0; + unsigned short y_target = 1; + Direction direction = N; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 3e02801042753772971af8bef19b7846dc6bb9d8 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:14:15 +0100 Subject: [PATCH 401/647] lab_can_move direction E heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index e6f9ed5..6e168d9 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -70,6 +70,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == N && field[x][y] == SOLUTION){ return 1; } + if (direction == E && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 27bc07f..99d45be 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -639,3 +639,35 @@ void test_lab_can_move_at_1_1_direction_N_target_SOLUTION_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_E_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 2; + Direction direction = E; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From c5266bf0822f67633d585736a23bee494d533c6e Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:15:22 +0100 Subject: [PATCH 402/647] lab_can_move direction S heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 6e168d9..42b180c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -73,6 +73,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == E && field[x][y] == SOLUTION){ return 1; } + if (direction == S && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 99d45be..4f30f4b 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -671,3 +671,35 @@ void test_lab_can_move_at_1_1_direction_E_target_SOLUTION_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_S_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 2; + unsigned short y_target = 1; + Direction direction = S; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From b5b972bcad4c7b31d4506b956dc75902226ed0f4 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:17:08 +0100 Subject: [PATCH 403/647] lab_can_move direction W heading SOLUTION --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 42b180c..53bf12d 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -76,6 +76,9 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == S && field[x][y] == SOLUTION){ return 1; } + if (direction == W && field[x][y] == SOLUTION){ + return 1; + } return 0; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 4f30f4b..4f52132 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -703,3 +703,35 @@ void test_lab_can_move_at_1_1_direction_S_target_SOLUTION_expected_1(void) free(field); } +void test_lab_can_move_at_1_1_direction_W_target_SOLUTION_expected_1(void) +{ + /* arrange */ + unsigned short x = 1; + unsigned short y = 1; + unsigned short x_target = 1; + unsigned short y_target = 0; + Direction direction = W; + short expected = 1; + short actual; + unsigned short len_x = 3, len_y = 3; + Field_State **field; + + field = malloc(len_x * sizeof *field); + for (int c_index = 0; c_index < len_x; c_index++){ + field[c_index] = malloc(len_y * sizeof field[c_index]); + } + field[x_target][y_target] = SOLUTION; + + /* act */ + actual = lab_can_move(field, x, y, direction, len_x, len_y); + + /* assert */ + TEST_ASSERT_EQUAL_INT8(expected, actual); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(field[c_index]); + } + free(field); +} + From 6d3b70a1853f86a726f5b2e211baacccb44c6404 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:24:57 +0100 Subject: [PATCH 404/647] refactoring: lab_can_move --- src/main/c/labyrinth.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 53bf12d..09e00a1 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -70,13 +70,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (direction == N && field[x][y] == SOLUTION){ return 1; } - if (direction == E && field[x][y] == SOLUTION){ - return 1; - } - if (direction == S && field[x][y] == SOLUTION){ - return 1; - } - if (direction == W && field[x][y] == SOLUTION){ + if (field[x][y] == SOLUTION){ return 1; } From 7661e91741e44d40f747d294914586976af0f4c8 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:26:40 +0100 Subject: [PATCH 405/647] show_solution --- src/main/c/labyrinth.c | 12 +++++++++--- src/main/c/labyrinth.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 09e00a1..bc3c05c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -5,6 +5,15 @@ #include "stdio.h" #include "stdlib.h" +void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y){ + for (int c_x = 0; c_x < len_x; c_x++){ + for (int c_y = 0; c_y < len_y; c_y++){ + printf("%hi", field[c_x][c_y]); + } + printf("\n"); + } +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: @@ -67,9 +76,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (field[x][y] == WALL){ return 1; } - if (direction == N && field[x][y] == SOLUTION){ - return 1; - } if (field[x][y] == SOLUTION){ return 1; } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index ef19e30..42c953a 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -8,5 +8,6 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); +void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 6116b0fcd6895f13771b28e21b3d2f8717ba325b Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:27:39 +0100 Subject: [PATCH 406/647] get_natural_number --- src/main/c/labyrinth.c | 7 +++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index bc3c05c..1d70380 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -14,6 +14,13 @@ void show_solution(Field_State** field, unsigned short len_x, unsigned short len } } +unsigned short get_natural_number(char text[]){ + unsigned short result; + printf("%s", text); + scanf("%hu", &result); + return result; +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 42c953a..593d111 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -9,5 +9,6 @@ void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); +unsigned short get_natural_number(char text[]); #endif // TEST_H From 9974f82f561bfed58f9f21de8eb58a771daddf91 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:31:49 +0100 Subject: [PATCH 407/647] dimesions --- src/main/c/labyrinth.c | 5 +++++ src/main/c/labyrinth.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 1d70380..997f1b7 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -21,6 +21,11 @@ unsigned short get_natural_number(char text[]){ return result; } +void dimesions(unsigned short *len_x, unsigned short *len_y){ + *len_x = get_natural_number("Bitte gib die x-Laenge des Labyrinthes an:\n"); + *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 593d111..4494394 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -10,5 +10,6 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); +void dimesions(unsigned short *len_x, unsigned short *len_y); #endif // TEST_H From e9e1a755ee14a3567eef0335c6e24350e648d414 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:33:21 +0100 Subject: [PATCH 408/647] refactoring: dimesions --> get_lab_dimensions --- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 997f1b7..81b9ed4 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -21,7 +21,7 @@ unsigned short get_natural_number(char text[]){ return result; } -void dimesions(unsigned short *len_x, unsigned short *len_y){ +void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y){ *len_x = get_natural_number("Bitte gib die x-Laenge des Labyrinthes an:\n"); *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 4494394..d9cb80c 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -10,6 +10,6 @@ void init_field(Field_State** field, unsigned short len_x, unsigned short len_y) short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); -void dimesions(unsigned short *len_x, unsigned short *len_y); +void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); #endif // TEST_H From 4f287be714015056693dc8a2a48ede028d3f58c1 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:34:34 +0100 Subject: [PATCH 409/647] wall input --- src/main/c/labyrinth.c | 20 ++++++++++++++++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 81b9ed4..690f831 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -26,6 +26,26 @@ void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y){ *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); } +short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y){ + char answer; + printf("Moechten Sie die Koordinaten einer weiteren Labyrinthwand angeben? (y/n)\n"); + scanf(" %c", &answer); + + if (answer == 'n'){ + return 1; + } + + printf("Bitte geben Sie die Koordinaten von Labyrinthwaenden im Format x, y ein.\n"); + scanf("%hu, %hu", x, y); + + if (*x >= len_x || *y >= len_y){ + printf("Die eingegebenen Koordinaten sind zu gross.\n"); + return -1; + } + + return 0; +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index d9cb80c..b2160ff 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -11,5 +11,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); +short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 6269b4af50e1b4f5b4d94217f455062dac7b145c Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:35:39 +0100 Subject: [PATCH 410/647] refactoring: wall --> get_wall_input --- src/main/c/labyrinth.c | 2 +- src/main/c/labyrinth.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 690f831..06def76 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -26,7 +26,7 @@ void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y){ *len_y = get_natural_number("Bitte gib die y-Laenge des Labyrinthes an:\n"); } -short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y){ +short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y){ char answer; printf("Moechten Sie die Koordinaten einer weiteren Labyrinthwand angeben? (y/n)\n"); scanf(" %c", &answer); diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index b2160ff..c50580c 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -11,6 +11,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); -short wall(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); +short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 8084d5da9ce147edf4399ac16d757d915e71c013 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:36:37 +0100 Subject: [PATCH 411/647] ask_lab_walls --- src/main/c/labyrinth.c | 15 +++++++++++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 06def76..5acb7d5 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -115,3 +115,18 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire return 0; } +void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y){ + unsigned short x, y; + short a; + + init_field(field, len_x, len_y); + + do { + a = get_wall_input(&x, &y, len_x, len_y); + if (a == 0){ + set_wall(field, x, y); + show_solution(field, len_x, len_y); + } + } while (a != 1); +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index c50580c..c731167 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -12,5 +12,6 @@ void show_solution(Field_State** field, unsigned short len_x, unsigned short len unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); +void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H From 38081354431ef9cee4d1cc7c975304b7a7cd189a Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:38:24 +0100 Subject: [PATCH 412/647] refactoring: ask_lab_walls --- src/main/c/labyrinth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 5acb7d5..fafbe33 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -117,16 +117,16 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y){ unsigned short x, y; - short a; + short wall_input_continue; init_field(field, len_x, len_y); do { - a = get_wall_input(&x, &y, len_x, len_y); - if (a == 0){ + wall_input_continue = get_wall_input(&x, &y, len_x, len_y); + if (wall_input_continue == 0){ set_wall(field, x, y); show_solution(field, len_x, len_y); } - } while (a != 1); + } while (wall_input_continue != 1); } From 6af534a97b7f034ebda3214fa1183d4a10c2e9eb Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:41:56 +0100 Subject: [PATCH 413/647] calculate_lab_way --- src/main/c/labyrinth.c | 29 +++++++++++++++++++++++++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 30 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index fafbe33..584f88c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -130,3 +130,32 @@ void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len } while (wall_input_continue != 1); } +short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y){ + Direction direction = N; + + unsigned short c_x; + unsigned short c_y; + + if (x == len_x-1 && y == len_y-1){ + field[x][y] = SOLUTION; + return 0; + } + + do { + c_x = x; + c_y = y; + if (lab_can_move(field, c_x, c_y, direction, len_x, len_y) == 0){ + lab_move(&c_x, &c_y, direction); + printf("%d - %d\n", c_x, c_y); + field[c_x][c_y] = SOLUTION; + if (calculate_lab_way(field, len_x, len_y, c_x, c_y) == 0){ + return 0; + } + field[c_x][c_y] = WAY; + } + turn_direction_right(&direction); + } + while (direction != N); + return 1; +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index c731167..fc6001c 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -13,5 +13,6 @@ unsigned short get_natural_number(char text[]); void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y); +short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y); #endif // TEST_H From 2b345075e7591c87794d7f6d09458a20a7a91e3a Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:43:07 +0100 Subject: [PATCH 414/647] refactoring: calculate_lab_way --- src/main/c/labyrinth.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 584f88c..7f3d89f 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -133,8 +133,8 @@ void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y){ Direction direction = N; - unsigned short c_x; - unsigned short c_y; + unsigned short current_x; + unsigned short current_y; if (x == len_x-1 && y == len_y-1){ field[x][y] = SOLUTION; @@ -142,16 +142,16 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor } do { - c_x = x; - c_y = y; - if (lab_can_move(field, c_x, c_y, direction, len_x, len_y) == 0){ - lab_move(&c_x, &c_y, direction); - printf("%d - %d\n", c_x, c_y); - field[c_x][c_y] = SOLUTION; - if (calculate_lab_way(field, len_x, len_y, c_x, c_y) == 0){ + current_x = x; + current_y = y; + if (lab_can_move(field, current_x, current_y, direction, len_x, len_y) == 0){ + lab_move(¤t_x, ¤t_y, direction); + printf("%d - %d\n", current_x, current_y); + field[current_x][current_y] = SOLUTION; + if (calculate_lab_way(field, len_x, len_y, current_x, current_y) == 0){ return 0; } - field[c_x][c_y] = WAY; + field[current_x][current_y] = WAY; } turn_direction_right(&direction); } From 548f7e1e4f1f03fd0e7722cf80cb190638ed88bd Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:43:52 +0100 Subject: [PATCH 415/647] labyrinth --- src/main/c/labyrinth.c | 7 +++++++ src/main/c/labyrinth.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 7f3d89f..70b3f74 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -159,3 +159,10 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor return 1; } +void labyrinth(){ + unsigned short x, y; + + ask_lab_dimensions(&x, &y); + +} + diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index fc6001c..8e9f178 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -14,5 +14,6 @@ void ask_lab_dimensions(unsigned short *len_x, unsigned short *len_y); short get_wall_input(unsigned short *x, unsigned short *y, unsigned short len_x, unsigned short len_y); void ask_lab_walls(Field_State** field, unsigned short len_x, unsigned short len_y); short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned short len_y, unsigned short x, unsigned short y); +void labyrinth(); #endif // TEST_H From 342a208e5e315c0492fcd70639aeea340b2f44e8 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:44:55 +0100 Subject: [PATCH 416/647] refactoring: labyrinth --- src/main/c/labyrinth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 70b3f74..a83f54d 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -160,9 +160,9 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor } void labyrinth(){ - unsigned short x, y; + unsigned short len_x, len_y; - ask_lab_dimensions(&x, &y); + ask_lab_dimensions(&len_x, &len_y); } From 054a3a47dd5abcfe709a913b90c5ab77c77e750c Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:46:05 +0100 Subject: [PATCH 417/647] final piece of cake in labyrinth --- src/main/c/labyrinth.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index a83f54d..221e0f7 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -161,8 +161,28 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor void labyrinth(){ unsigned short len_x, len_y; + Field_State **f; ask_lab_dimensions(&len_x, &len_y); + f = malloc(len_x * sizeof *f); + for (int c_index = 0; c_index < len_x; c_index++){ + f[c_index] = malloc(len_y * sizeof f[c_index]); + } + + ask_lab_walls(f, len_x, len_y); + + if (calculate_lab_way(f, len_x, len_y, 0, 0) == 1){ + printf("Keine Loesung moeglich!\n"); + } + + show_solution(f, len_x, len_y); + + for (int c_index = 0; c_index < len_x; c_index++) + { + free(f[c_index]); + } + free(f); + } From daf05939e59699524b4377dcd65bcd0726df89ce Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:47:09 +0100 Subject: [PATCH 418/647] refactoring: labyrinth, final piece of cake --- src/main/c/labyrinth.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 221e0f7..11eaf59 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -161,28 +161,28 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor void labyrinth(){ unsigned short len_x, len_y; - Field_State **f; + Field_State **field; ask_lab_dimensions(&len_x, &len_y); - f = malloc(len_x * sizeof *f); + field = malloc(len_x * sizeof *field); for (int c_index = 0; c_index < len_x; c_index++){ - f[c_index] = malloc(len_y * sizeof f[c_index]); + field[c_index] = malloc(len_y * sizeof field[c_index]); } - ask_lab_walls(f, len_x, len_y); + ask_lab_walls(field, len_x, len_y); - if (calculate_lab_way(f, len_x, len_y, 0, 0) == 1){ + if (calculate_lab_way(field, len_x, len_y, 0, 0) == 1){ printf("Keine Loesung moeglich!\n"); } - show_solution(f, len_x, len_y); + show_solution(field, len_x, len_y); for (int c_index = 0; c_index < len_x; c_index++) { - free(f[c_index]); + free(field[c_index]); } - free(f); + free(field); } From 47a82f80ef19012d73bb77842754a170af0d4577 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Wed, 7 Feb 2024 17:08:59 +0100 Subject: [PATCH 419/647] refactoring: labyrinth --> start_labyrinth_game --- src/main/c/labyrinth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 11eaf59..bdad7fb 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -159,7 +159,7 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor return 1; } -void labyrinth(){ +void start_labyrinth_game(){ unsigned short len_x, len_y; Field_State **field; From 09daf32585ef25a8d57d8fa50b28455c11b2e9c1 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:07:52 +0100 Subject: [PATCH 420/647] Commit 1 code --- src/main/c/sudoku.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/c/sudoku.c diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c new file mode 100644 index 0000000..8e7d480 --- /dev/null +++ b/src/main/c/sudoku.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +#define SIZE 9 +#define EMPTY 0 +#define LEVEL_NUMBER 3 + + +int difficulty; +int selected_level; + + +void startSudoku(); //is instead of main + +void startSudoku() { + int grid[SIZE][SIZE]; + selected_level = 0; + + while (1) { + printf("\nDifficulty Function - Choose difficulty:\n"); + printf("1. Easy\n2. Medium\n3. Hard\n"); + printf("Enter the corresponding number or type 'quit' to exit: "); + + char input[10]; + scanf("%s", input); + + if (strcmp(input, "quit") == 0) { + break; + } + + difficulty = input[0] - '0'; // Convert the first character to an integer + + if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { + printf("Input is correct"); + } else { + printf("Invalid input. Please enter a number between 1 and 3.\n"); + } + + } +} + +int main(){ + startSudoku(); + return 0; +} \ No newline at end of file From c4026961b405151134e0aa19aecb0cde0efaf663 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:08:26 +0100 Subject: [PATCH 421/647] Commit 2 code --- src/main/c/sudoku.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 8e7d480..a065a5d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,3 +1,8 @@ + + + + + #include #include #include @@ -13,6 +18,8 @@ int selected_level; void startSudoku(); //is instead of main +void availableLevelsFunction(int difficulty); + void startSudoku() { int grid[SIZE][SIZE]; @@ -33,7 +40,7 @@ void startSudoku() { difficulty = input[0] - '0'; // Convert the first character to an integer if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { - printf("Input is correct"); + availableLevelsFunction(difficulty); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -41,6 +48,11 @@ void startSudoku() { } } +void availableLevelsFunction(int difficulty) { + printf("\nAvailable Levels for Difficulty %d:\n", difficulty); + +} + int main(){ startSudoku(); return 0; From d925b1ccad3601fb71bd0143371034cf154bac48 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:09:52 +0100 Subject: [PATCH 422/647] Commit 3 code --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index a065a5d..4ea2db4 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,8 +1,6 @@ - - #include #include #include @@ -50,7 +48,9 @@ void startSudoku() { void availableLevelsFunction(int difficulty) { printf("\nAvailable Levels for Difficulty %d:\n", difficulty); - + for (int i = 0; i < LEVEL_NUMBER; i++) { + printf("%d. Level %d\n", i + 1, i + 1); + } } int main(){ From 0736456434b43e65ec137723a1e45e98b04787af Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:10:18 +0100 Subject: [PATCH 423/647] Commit 4 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 4ea2db4..dac8629 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -17,7 +17,7 @@ int selected_level; void startSudoku(); //is instead of main void availableLevelsFunction(int difficulty); - +void selectLevel(int grid[SIZE][SIZE]); void startSudoku() { int grid[SIZE][SIZE]; @@ -39,6 +39,7 @@ void startSudoku() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { availableLevelsFunction(difficulty); + selectLevel(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -53,6 +54,22 @@ void availableLevelsFunction(int difficulty) { } } + + +void selectLevel(int grid[SIZE][SIZE]) { + int level = 0; + printf("\nSelect a level:\n"); + + + +} + + + + + + + int main(){ startSudoku(); return 0; From 021e4ee5c2a1fe55e7c400eed657be369122820e Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:11:20 +0100 Subject: [PATCH 424/647] Commit 5 code --- src/main/c/sudoku.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index dac8629..4329efc 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,6 +1,3 @@ - - - #include #include #include @@ -59,7 +56,21 @@ void availableLevelsFunction(int difficulty) { void selectLevel(int grid[SIZE][SIZE]) { int level = 0; printf("\nSelect a level:\n"); - + while (true){ + char level_select[10]; + scanf("%s", level_select); + + + level = level_select[0] - '0'; // Convert the first character to an integer + + if ((level >= 1 && level <= 3) && level_select[1] == '\0') { + printf("Input is correct"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 3.\n"); + + } + } } From 652da8fafb26635c5343ed8607bb68e150893306 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:12:27 +0100 Subject: [PATCH 425/647] Commit 6 code --- src/main/c/sudoku.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 4329efc..87089c0 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -15,6 +15,9 @@ int selected_level; void startSudoku(); //is instead of main void availableLevelsFunction(int difficulty); void selectLevel(int grid[SIZE][SIZE]); +void initializeGrid(int grid[SIZE][SIZE]); +void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); + void startSudoku() { int grid[SIZE][SIZE]; @@ -64,17 +67,39 @@ void selectLevel(int grid[SIZE][SIZE]) { level = level_select[0] - '0'; // Convert the first character to an integer if ((level >= 1 && level <= 3) && level_select[1] == '\0') { - printf("Input is correct"); + selected_level = level; + + level--; // Adjust to 0-based index + + generateSudoku(grid, difficulty, selected_level); break; } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); - + } } } +void initializeGrid(int grid[SIZE][SIZE]) { + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = EMPTY; + } + } +} + +void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { + initializeGrid(grid); + printf("Level is getting initialized"); + + +} + + + + From 17b16df1d9fc60764505c01c9e2cc9b701d81fff Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:03 +0100 Subject: [PATCH 426/647] Commit 7 code --- src/main/c/sudoku.c | 102 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 87089c0..dcdfb7b 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,3 +1,6 @@ + + + #include #include #include @@ -19,6 +22,104 @@ void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); +int availableLevels[3][3][SIZE][SIZE] = { + { //easy + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 1}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0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, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}} + }, + + {//hard + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, + + {{0, 0, 3, 0, 2, 1, 8, 0, 0}, + {6, 0, 0, 0, 7, 0, 1, 3, 2}, + {9, 2, 1, 5, 0, 0, 7, 6, 4}, + {7, 6, 0, 3, 0, 0, 4, 0, 0}, + {8, 5, 4, 1, 9, 7, 0, 0, 0}, + {1, 0, 0, 4, 0, 6, 0, 0, 0}, + {2, 9, 0, 8, 1, 5, 0, 0, 6}, + {0, 4, 8, 2, 0, 9, 5, 0, 0}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}} + } +}; + + void startSudoku() { int grid[SIZE][SIZE]; selected_level = 0; @@ -93,6 +194,7 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); printf("Level is getting initialized"); + } From 9090680a2f69affa6fa268e264ec0619fafd0c92 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:17 +0100 Subject: [PATCH 427/647] Commit 8 code --- src/main/c/sudoku.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index dcdfb7b..f877f62 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,6 +1,5 @@ - #include #include #include @@ -32,7 +31,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 1}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -42,7 +41,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 2}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -52,7 +51,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 3}}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}}, {//medium {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -194,7 +193,11 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); printf("Level is getting initialized"); - + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; + } + } } From 6172528aeab7c8a102b891bdd56706ee8e7fdb6c Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:43 +0100 Subject: [PATCH 428/647] Commit 9 code --- src/main/c/sudoku.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index f877f62..3ee5b72 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,5 +1,9 @@ + + + + #include #include #include @@ -198,6 +202,12 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; } } + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + printf("%d", grid[i][j]); + } + printf("\n"); + } } From d36ef7a70cfff5f910974e8110cc55d078ab1e1e Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:59 +0100 Subject: [PATCH 429/647] Commit 10 code --- src/main/c/sudoku.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 3ee5b72..41f512f 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -23,6 +23,7 @@ void availableLevelsFunction(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); +void turnFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -144,6 +145,7 @@ void startSudoku() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { availableLevelsFunction(difficulty); selectLevel(grid); + turnFunction(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -196,7 +198,6 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); - printf("Level is getting initialized"); for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; @@ -212,7 +213,9 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { } - +void turnFunction(int grid[SIZE][SIZE]) { + printf("\nTurn function - Choose an action:\n"); +} From 8a81dac83e83b102964c1ad78cc544c2c0bdee74 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:15 +0100 Subject: [PATCH 430/647] Commit 11 code --- src/main/c/sudoku.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 41f512f..2c82cfd 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -215,6 +215,21 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); + + int action; + + while (true){ + char action_str[10]; + scanf("%s", action_str); + + action = action_str[0] - '0'; // Convert the first character to an integer + + if ((action >= 1 && action <= 6) && action_str[1] == '\0') { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 6.\n"); + } + } } From 59eb491cffaaf02338f97af772298583d4900173 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:27 +0100 Subject: [PATCH 431/647] Commit 12 code --- src/main/c/sudoku.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 2c82cfd..8d0de5c 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -230,6 +230,29 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 6.\n"); } } + + switch (action) { + case 1: + printf("Case 1.\n"); + break; + case 2: + printf("Case 2.\n"); + break; + case 3: + printf("Case 3.\n"); + break; + case 4: + printf("Case 4.\n"); + break; + case 5: + printf("Case 5.\n"); + break; + case 6: + printf("Case 6.\n"); + break; + default: + printf("Invalid input. Please enter a number between 1 and 6.\n"); + } } From 7e3b9b62fe715b62c6aeca4e404a9eb152b629b8 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:43 +0100 Subject: [PATCH 432/647] Commit 13 code --- src/main/c/sudoku.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 8d0de5c..7d3d57d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -24,6 +24,7 @@ void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); +void tipFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -256,7 +257,9 @@ void turnFunction(int grid[SIZE][SIZE]) { } - +void tipFunction(int grid[SIZE][SIZE]) { + printf("\nTip function - Choose an option:\n"); +} From c49af67c6e142de32d773f1e21685609ac2ed18b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:14:57 +0100 Subject: [PATCH 433/647] Commit 14 code --- src/main/c/sudoku.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 7d3d57d..8f5f0b0 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -216,6 +216,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); + printf("1. Tip function\n"); int action; @@ -234,7 +235,7 @@ void turnFunction(int grid[SIZE][SIZE]) { switch (action) { case 1: - printf("Case 1.\n"); + tipFunction(grid); break; case 2: printf("Case 2.\n"); From ff14e56cdbf4203a4a9b8256a7b359d093dbce66 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:12 +0100 Subject: [PATCH 434/647] Commit 15 code --- src/main/c/sudoku.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 8f5f0b0..5b76aca 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -260,6 +260,22 @@ void turnFunction(int grid[SIZE][SIZE]) { void tipFunction(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); + + int option = 0; + + while (true){ + char tip_str[10]; + scanf("%s", tip_str); + + + option = tip_str[0] - '0'; // Convert the first character to an integer + + if ((option >= 1 && option <= 3) && tip_str[1] == '\0') { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 3.\n"); + } + } } From fb4ad57bcfdb0bbf60515c63b3e6d18c02bd00bd Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:36 +0100 Subject: [PATCH 435/647] Commit 16 code --- src/main/c/sudoku.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 5b76aca..93ec660 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -260,6 +260,10 @@ void turnFunction(int grid[SIZE][SIZE]) { void tipFunction(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); + printf("1. Set the user-specified cell to the right value\n"); + printf("2. Set the user-specified 3x3 field to the right values\n"); + printf("3. Solve the entire puzzle for the current level\n"); + int option = 0; @@ -276,6 +280,22 @@ void tipFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 3.\n"); } } + + switch (option) { + case 1: + printf("Case 1\n"); + break; + + case 2: + printf("Case 2\n"); + break; + + case 3: + printf("Case 3\n"); + break; + default: + printf("Invalid option. Please enter a number between 1 and 3.\n"); + } } From bafa79f7c9ebe4c2eda0fefa70b7edae5aa5b546 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:49 +0100 Subject: [PATCH 436/647] Commit 17 code --- src/main/c/sudoku.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 93ec660..560e174 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -124,6 +124,104 @@ int availableLevels[3][3][SIZE][SIZE] = { } }; +int solutionLevels[3][3][SIZE][SIZE] = { + + { //easy + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2,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8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}} + } +}; + void startSudoku() { int grid[SIZE][SIZE]; From 6fc66ae37caf63ad7fadf0254d4c377ef89bab31 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:16:14 +0100 Subject: [PATCH 437/647] Commit 18 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 560e174..792f227 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -381,7 +381,24 @@ void tipFunction(int grid[SIZE][SIZE]) { switch (option) { case 1: - printf("Case 1\n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row, col; + + while (true){ + char row_str[10]; + char col_str[10]; + scanf("%s %s", row_str, col_str); + + + row = row_str[0] - '0'; // Convert the first character to an integer + col = col_str[0] - '0'; // Convert the first character to an integer + + if (((row >= 1 && row <= 9) && row_str[1] == '\0') && ((col >= 1 && col <= 9) && col_str[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 2: From cb22528272ccc90fd99ec2cc378efae37a46b85a Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:16:26 +0100 Subject: [PATCH 438/647] Commit 19 code --- src/main/c/sudoku.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 792f227..353c70b 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -399,6 +399,8 @@ void tipFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 9.\n"); } } + grid[row - 1][col - 1] = solutionLevels[difficulty - 1][selected_level - 1][row - 1][col - 1]; + printf("Value set successfully.\n"); break; case 2: From b1e2dc8003e84d9b00a14f36316439d9039aa740 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:16:37 +0100 Subject: [PATCH 439/647] Commit 20 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 353c70b..23ee743 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -404,7 +404,24 @@ void tipFunction(int grid[SIZE][SIZE]) { break; case 2: - printf("Case 2\n"); + printf("Enter the coordinates (top-left cell of the 3x3 field) separated by space:\n"); + int startRow, startCol; + + while (true){ + char row_squ[10]; + char col_squ[10]; + scanf("%s %s", row_squ, col_squ); + + + startRow = row_squ[0] - '0'; // Convert the first character to an integer + startCol = col_squ[0] - '0'; // Convert the first character to an integer + + if (((startRow >= 1 && startRow <= 9) && row_squ[1] == '\0') && ((startCol >= 1 && startCol <= 9) && col_squ[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 3: From 9d996e61936c65487f2962412d15ad37f9ef32c1 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:18:15 +0100 Subject: [PATCH 440/647] Commit 21 code --- src/main/c/sudoku.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 23ee743..9b6b0f5 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -422,6 +422,13 @@ void tipFunction(int grid[SIZE][SIZE]) { printf("Invalid input. Please enter a number between 1 and 9.\n"); } } + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + grid[startRow - 1 + i][startCol - 1 + j] = + solutionLevels[difficulty - 1][selected_level - 1][startRow - 1 + i][startCol - 1 + j]; + } + } + printf("3x3 field set successfully.\n"); break; case 3: From 435caa83d4f9dbba4e93f62837c23edf69e5a615 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:18:26 +0100 Subject: [PATCH 441/647] Commit 22 code --- src/main/c/sudoku.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 9b6b0f5..65e0e50 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -432,7 +432,12 @@ void tipFunction(int grid[SIZE][SIZE]) { break; case 3: - printf("Case 3\n"); + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = solutionLevels[difficulty - 1][selected_level - 1][i][j]; + } + } + printf("Puzzle solved. \n"); break; default: printf("Invalid option. Please enter a number between 1 and 3.\n"); From af8d42a3bf181185a09fb97f641a7d0ecb9db4e0 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:18:48 +0100 Subject: [PATCH 442/647] Commit 23 code --- src/main/c/sudoku.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 65e0e50..77122dc 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -25,6 +25,7 @@ void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); +void inputFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -315,6 +316,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); + printf("2. Input function\n"); int action; @@ -336,7 +338,7 @@ void turnFunction(int grid[SIZE][SIZE]) { tipFunction(grid); break; case 2: - printf("Case 2.\n"); + inputFunction(grid); break; case 3: printf("Case 3.\n"); @@ -444,7 +446,11 @@ void tipFunction(int grid[SIZE][SIZE]) { } } +void inputFunction(int grid[SIZE][SIZE]) { + printf("\nInput function - Choose an action:\n"); + +} From b556115dfab48d17ff019229876dd90e4d892e95 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:19:02 +0100 Subject: [PATCH 443/647] Commit 24 code --- src/main/c/sudoku.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 77122dc..705e694 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -448,8 +448,35 @@ void tipFunction(int grid[SIZE][SIZE]) { void inputFunction(int grid[SIZE][SIZE]) { printf("\nInput function - Choose an action:\n"); + printf("1. Insert value in an empty field\n"); + printf("2. Clear an already filled field\n"); - + int action; + + while (true){ + char in_str[10]; + scanf("%s", in_str); + + action = in_str[0] - '0'; // Convert the first character to an integer + + if ((action >= 1 && action <= 2) && in_str[1] == '\0') { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 2.\n"); + } + } + + switch (action) { + case 1: + printf("Case 1 \n"); + break; + + case 2: + printf("Case 2 \n"); + break; + default: + printf("Invalid input. Please enter 1 or 2.\n"); + } } From ca7b7de77231c165ed4f32939127937c0b875b5e Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:19:14 +0100 Subject: [PATCH 444/647] Commit 25 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 705e694..51551e1 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -468,7 +468,24 @@ void inputFunction(int grid[SIZE][SIZE]) { switch (action) { case 1: - printf("Case 1 \n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row_e, col_e, num; + + + while (true){ + char rowe_str[10]; + char cole_str[10]; + scanf("%s %s", rowe_str, cole_str); + + row_e = rowe_str[0] - '0'; // Convert the first character to an integer + col_e = cole_str[0] - '0'; // Convert the first character to an integer + + if (((row_e >= 1 && row_e <= 9) && rowe_str[1] == '\0') && ((col_e >= 1 && col_e <= 9) && cole_str[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 2: From 20579834c238b2e8c36365ab2eb1dd1ceb5d9e69 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:19 +0100 Subject: [PATCH 445/647] Commit 26 code --- src/main/c/sudoku.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 51551e1..74e1c47 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -485,6 +485,25 @@ void inputFunction(int grid[SIZE][SIZE]) { } else { printf("Invalid input. Please enter a number between 1 and 9.\n"); } + } + printf("Enter the value to insert (1-9):\n"); + + + + + while (true){ + char nume_str[10]; + scanf("%s", nume_str); + + num = nume_str[0] - '0'; // Convert the first character to an integer + + if ((num >= 1 && num <= 9) && nume_str[1] == '\0') { + grid[row_e - 1][col_e - 1] = num; + printf("Value inserted successfully.\n"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } } break; From 5ea8e0ab421c92503b46692bf5d0ada48bc76973 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:33 +0100 Subject: [PATCH 446/647] Commit 27 code --- src/main/c/sudoku.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 74e1c47..fd4b62d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -508,11 +508,31 @@ void inputFunction(int grid[SIZE][SIZE]) { break; case 2: - printf("Case 2 \n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row_d, col_d; + + + while (true){ + char rowd_str[10]; + char cold_str[10]; + scanf("%s %s", rowd_str, cold_str); + + row_d = rowd_str[0] - '0'; // Convert the first character to an integer + col_d = cold_str[0] - '0'; // Convert the first character to an integer + + if (((row_d >= 1 && row_d <= 9) && rowd_str[1] == '\0') && ((col_d >= 1 && col_d <= 9) && cold_str[1] == '\0')) { + grid[row_d - 1][col_d - 1] = 0; + printf("Cell cleared successfully.\n"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; default: printf("Invalid input. Please enter 1 or 2.\n"); } + } From 9eaea92e27d5762c5480af1daf052a2ed789588a Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:52 +0100 Subject: [PATCH 447/647] Commit 28 code --- src/main/c/sudoku.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index fd4b62d..a9e5590 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -26,6 +26,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); +void printGrid(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -317,6 +318,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); printf("2. Input function\n"); + printf("3. Print Sudoku grid\n"); int action; @@ -341,7 +343,7 @@ void turnFunction(int grid[SIZE][SIZE]) { inputFunction(grid); break; case 3: - printf("Case 3.\n"); + printGrid(grid); break; case 4: printf("Case 4.\n"); @@ -536,6 +538,16 @@ void inputFunction(int grid[SIZE][SIZE]) { } +void printGrid(int grid[SIZE][SIZE]) { + printf("\nSudoku Grid:\n"); + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + printf("%d ", grid[i][j]); + } + printf("\n"); + } +} + int main(){ startSudoku(); From c0c4adaa402d4ee8a62a612b08b4cc35d040e779 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:21:05 +0100 Subject: [PATCH 448/647] Commit 29 code --- src/main/c/sudoku.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index a9e5590..ddff311 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -514,7 +514,7 @@ void inputFunction(int grid[SIZE][SIZE]) { int row_d, col_d; - while (true){ + while (true){ char rowd_str[10]; char cold_str[10]; scanf("%s %s", rowd_str, cold_str); @@ -534,7 +534,7 @@ void inputFunction(int grid[SIZE][SIZE]) { default: printf("Invalid input. Please enter 1 or 2.\n"); } - + printGrid(grid); } From fb2c5ef09dc48975569b05027698244ab5a82856 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:21:22 +0100 Subject: [PATCH 449/647] Commit 30 code --- src/main/c/sudoku.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index ddff311..cc5739c 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -315,6 +315,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { } void turnFunction(int grid[SIZE][SIZE]) { + while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); printf("2. Input function\n"); @@ -357,9 +358,11 @@ void turnFunction(int grid[SIZE][SIZE]) { default: printf("Invalid input. Please enter a number between 1 and 6.\n"); } + } } + void tipFunction(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); From e4519c5238b8a35d7ae0c78dd31d64ee3e9d2a0b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:21:42 +0100 Subject: [PATCH 450/647] Commit 31 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index cc5739c..ef28e84 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -27,6 +27,7 @@ void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); +void doneFunction(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -320,6 +321,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("1. Tip function\n"); printf("2. Input function\n"); printf("3. Print Sudoku grid\n"); + printf("4. Done function\n"); int action; @@ -347,7 +349,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printGrid(grid); break; case 4: - printf("Case 4.\n"); + doneFunction(grid); break; case 5: printf("Case 5.\n"); @@ -551,6 +553,21 @@ void printGrid(int grid[SIZE][SIZE]) { } } +void doneFunction(int grid[SIZE][SIZE]) { + printf("\nDone function - Checking if the solution is correct...\n"); + + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + if (grid[i][j] != solutionLevels[difficulty - 1][selected_level - 1][i][j]) { + printf("Incorrect solution. Keep trying!\n"); + return; + } + } + } + + printf("Congratulations! Sudoku is solved correctly.\n"); +} + int main(){ startSudoku(); From 31c6b21374bacb50d581238c1c3558fdee46f94b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:22:16 +0100 Subject: [PATCH 451/647] Commit 32 code --- src/main/c/sudoku.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index ef28e84..4f8b1ce 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -30,6 +30,7 @@ void printGrid(int grid[SIZE][SIZE]); void doneFunction(int grid[SIZE][SIZE]); + int availableLevels[3][3][SIZE][SIZE] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -50,7 +51,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 0}}, + {5, 0, 0, 7, 0, 3, 2, 0, 2}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -322,6 +323,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("2. Input function\n"); printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); + printf("5. Select level\n"); int action; @@ -352,7 +354,7 @@ void turnFunction(int grid[SIZE][SIZE]) { doneFunction(grid); break; case 5: - printf("Case 5.\n"); + selectLevel(grid); break; case 6: printf("Case 6.\n"); From 6147f59ab884cd359dd1774c836b693c43caef0e Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:22:46 +0100 Subject: [PATCH 452/647] Commit 33 code --- src/main/c/sudoku.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 4f8b1ce..6ea434e 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -9,6 +9,7 @@ #include #include + #define SIZE 9 #define EMPTY 0 #define LEVEL_NUMBER 3 @@ -324,6 +325,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); printf("5. Select level\n"); + printf("6. Quit\n"); int action; @@ -357,8 +359,8 @@ void turnFunction(int grid[SIZE][SIZE]) { selectLevel(grid); break; case 6: - printf("Case 6.\n"); - break; + printf("Exiting Sudoku program.\n"); + exit(0); default: printf("Invalid input. Please enter a number between 1 and 6.\n"); } From bfe1599cf4b4f3059bfdc6b396b943012bfdab42 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:32:07 +0100 Subject: [PATCH 453/647] refactoring: 1 --- src/main/c/sudoku.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 6ea434e..1b0827d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -9,7 +9,6 @@ #include #include - #define SIZE 9 #define EMPTY 0 #define LEVEL_NUMBER 3 @@ -20,7 +19,7 @@ int selected_level; void startSudoku(); //is instead of main -void availableLevelsFunction(int difficulty); +void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); @@ -247,7 +246,7 @@ void startSudoku() { difficulty = input[0] - '0'; // Convert the first character to an integer if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { - availableLevelsFunction(difficulty); + Level_Pool(difficulty); selectLevel(grid); turnFunction(grid); } else { @@ -257,7 +256,7 @@ void startSudoku() { } } -void availableLevelsFunction(int difficulty) { +void Level_Pool(int difficulty) { printf("\nAvailable Levels for Difficulty %d:\n", difficulty); for (int i = 0; i < LEVEL_NUMBER; i++) { printf("%d. Level %d\n", i + 1, i + 1); From 9fb83256352357052e692c9b531fd85a986c47a9 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:32:47 +0100 Subject: [PATCH 454/647] refactoring: 2 --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 1b0827d..ee41b13 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -18,7 +18,7 @@ int difficulty; int selected_level; -void startSudoku(); //is instead of main +void Game_loop(); //is instead of main void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); @@ -227,7 +227,7 @@ int solutionLevels[3][3][SIZE][SIZE] = { }; -void startSudoku() { +void Game_loop() { int grid[SIZE][SIZE]; selected_level = 0; @@ -573,6 +573,6 @@ void doneFunction(int grid[SIZE][SIZE]) { int main(){ - startSudoku(); + Game_loop(); return 0; } \ No newline at end of file From 94df9849eb39fccf8086eace3abf4410279c6acc Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:33:05 +0100 Subject: [PATCH 455/647] refactoring: 3 --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index ee41b13..d7f0b73 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -22,7 +22,7 @@ void Game_loop(); //is instead of main void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); -void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); +void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); @@ -280,7 +280,7 @@ void selectLevel(int grid[SIZE][SIZE]) { level--; // Adjust to 0-based index - generateSudoku(grid, difficulty, selected_level); + create_playing_field(grid, difficulty, selected_level); break; } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); @@ -299,7 +299,7 @@ void initializeGrid(int grid[SIZE][SIZE]) { } } -void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { +void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { From 933570c7e1cd7ba0a649d5941f3f0c4f0995e1c2 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:33:18 +0100 Subject: [PATCH 456/647] refactoring: 4 --- src/main/c/sudoku.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index d7f0b73..81849ef 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -23,7 +23,7 @@ void Level_Pool(int difficulty); void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); -void turnFunction(int grid[SIZE][SIZE]); +void Player_actions_for_playing(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); @@ -248,7 +248,7 @@ void Game_loop() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { Level_Pool(difficulty); selectLevel(grid); - turnFunction(grid); + Player_actions_for_playing(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -316,7 +316,7 @@ void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { } -void turnFunction(int grid[SIZE][SIZE]) { +void Player_actions_for_playing(int grid[SIZE][SIZE]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); From 3dc4e679df268458b89ad44c8434fc5a6eba6204 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:33:33 +0100 Subject: [PATCH 457/647] refactoring: 5 --- src/main/c/sudoku.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 81849ef..969ecdd 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -24,7 +24,7 @@ void selectLevel(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]); void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); void Player_actions_for_playing(int grid[SIZE][SIZE]); -void tipFunction(int grid[SIZE][SIZE]); +void giving_hints_to_player(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); void doneFunction(int grid[SIZE][SIZE]); @@ -319,7 +319,7 @@ void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { void Player_actions_for_playing(int grid[SIZE][SIZE]) { while (1) { printf("\nTurn function - Choose an action:\n"); - printf("1. Tip function\n"); + printf("1. Hints\n"); printf("2. Input function\n"); printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); @@ -343,7 +343,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { switch (action) { case 1: - tipFunction(grid); + giving_hints_to_player(grid); break; case 2: inputFunction(grid); @@ -368,7 +368,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { -void tipFunction(int grid[SIZE][SIZE]) { +void giving_hints_to_player(int grid[SIZE][SIZE]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); printf("2. Set the user-specified 3x3 field to the right values\n"); From 80b3b3711e0242aa8627393dd32e9b91d9db09f5 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:01 +0100 Subject: [PATCH 458/647] refactoring: 6 --- src/main/c/sudoku.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 969ecdd..81226e5 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -25,7 +25,7 @@ void initializeGrid(int grid[SIZE][SIZE]); void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); void Player_actions_for_playing(int grid[SIZE][SIZE]); void giving_hints_to_player(int grid[SIZE][SIZE]); -void inputFunction(int grid[SIZE][SIZE]); +void write_userinput_into_Sudoku(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); void doneFunction(int grid[SIZE][SIZE]); @@ -320,7 +320,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Hints\n"); - printf("2. Input function\n"); + printf("2. Insert Number into Game\n"); printf("3. Print Sudoku grid\n"); printf("4. Done function\n"); printf("5. Select level\n"); @@ -346,7 +346,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { giving_hints_to_player(grid); break; case 2: - inputFunction(grid); + write_userinput_into_Sudoku(grid); break; case 3: printGrid(grid); @@ -456,7 +456,7 @@ void giving_hints_to_player(int grid[SIZE][SIZE]) { } } -void inputFunction(int grid[SIZE][SIZE]) { +void write_userinput_into_Sudoku(int grid[SIZE][SIZE]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); From 8b8f5606a564a9b9bdb9920d14d7d9fa6b098d20 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:15 +0100 Subject: [PATCH 459/647] refactoring: 7 --- src/main/c/sudoku.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 81226e5..5d06bbe 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -27,7 +27,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]); void giving_hints_to_player(int grid[SIZE][SIZE]); void write_userinput_into_Sudoku(int grid[SIZE][SIZE]); void printGrid(int grid[SIZE][SIZE]); -void doneFunction(int grid[SIZE][SIZE]); +void check_if_Sudoku_solved(int grid[SIZE][SIZE]); @@ -322,7 +322,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { printf("1. Hints\n"); printf("2. Insert Number into Game\n"); printf("3. Print Sudoku grid\n"); - printf("4. Done function\n"); + printf("4. Check if your Solution is correct\n"); printf("5. Select level\n"); printf("6. Quit\n"); @@ -352,7 +352,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { printGrid(grid); break; case 4: - doneFunction(grid); + check_if_Sudoku_solved(grid); break; case 5: selectLevel(grid); @@ -556,7 +556,7 @@ void printGrid(int grid[SIZE][SIZE]) { } } -void doneFunction(int grid[SIZE][SIZE]) { +void check_if_Sudoku_solved(int grid[SIZE][SIZE]) { printf("\nDone function - Checking if the solution is correct...\n"); for (int i = 0; i < SIZE; i++) { From 91b072e5f03a41184fdb0b2ee6399877b694c384 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:39 +0100 Subject: [PATCH 460/647] refactoring: 8 --- src/main/c/sudoku.c | 71 +++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 5d06bbe..21fba11 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,15 +1,10 @@ - - - - - - #include #include #include #include -#define SIZE 9 +#define SIZE_OF_GAMEBORD_AXIS_X 9 +#define SIZE_OF_GAMEBORD_AXIS_Y 9 #define EMPTY 0 #define LEVEL_NUMBER 3 @@ -20,18 +15,18 @@ int selected_level; void Game_loop(); //is instead of main void Level_Pool(int difficulty); -void selectLevel(int grid[SIZE][SIZE]); -void initializeGrid(int grid[SIZE][SIZE]); -void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level); -void Player_actions_for_playing(int grid[SIZE][SIZE]); -void giving_hints_to_player(int grid[SIZE][SIZE]); -void write_userinput_into_Sudoku(int grid[SIZE][SIZE]); -void printGrid(int grid[SIZE][SIZE]); -void check_if_Sudoku_solved(int grid[SIZE][SIZE]); +void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level); +void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -int availableLevels[3][3][SIZE][SIZE] = { +int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -128,7 +123,7 @@ int availableLevels[3][3][SIZE][SIZE] = { } }; -int solutionLevels[3][3][SIZE][SIZE] = { +int solutionLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{4, 7, 3, 6, 2, 1, 8, 5, 9}, @@ -228,7 +223,7 @@ int solutionLevels[3][3][SIZE][SIZE] = { void Game_loop() { - int grid[SIZE][SIZE]; + int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; selected_level = 0; while (1) { @@ -265,7 +260,7 @@ void Level_Pool(int difficulty) { -void selectLevel(int grid[SIZE][SIZE]) { +void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { int level = 0; printf("\nSelect a level:\n"); while (true){ @@ -291,23 +286,23 @@ void selectLevel(int grid[SIZE][SIZE]) { } -void initializeGrid(int grid[SIZE][SIZE]) { - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { +void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { grid[i][j] = EMPTY; } } } -void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { +void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level) { initializeGrid(grid); - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; } } - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { printf("%d", grid[i][j]); } printf("\n"); @@ -316,7 +311,7 @@ void create_playing_field(int grid[SIZE][SIZE], int difficulty, int level) { } -void Player_actions_for_playing(int grid[SIZE][SIZE]) { +void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Hints\n"); @@ -368,7 +363,7 @@ void Player_actions_for_playing(int grid[SIZE][SIZE]) { -void giving_hints_to_player(int grid[SIZE][SIZE]) { +void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); printf("2. Set the user-specified 3x3 field to the right values\n"); @@ -444,8 +439,8 @@ void giving_hints_to_player(int grid[SIZE][SIZE]) { break; case 3: - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { grid[i][j] = solutionLevels[difficulty - 1][selected_level - 1][i][j]; } } @@ -456,7 +451,7 @@ void giving_hints_to_player(int grid[SIZE][SIZE]) { } } -void write_userinput_into_Sudoku(int grid[SIZE][SIZE]) { +void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); @@ -546,21 +541,21 @@ void write_userinput_into_Sudoku(int grid[SIZE][SIZE]) { } -void printGrid(int grid[SIZE][SIZE]) { +void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nSudoku Grid:\n"); - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { printf("%d ", grid[i][j]); } printf("\n"); } } -void check_if_Sudoku_solved(int grid[SIZE][SIZE]) { +void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nDone function - Checking if the solution is correct...\n"); - for (int i = 0; i < SIZE; i++) { - for (int j = 0; j < SIZE; j++) { + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { if (grid[i][j] != solutionLevels[difficulty - 1][selected_level - 1][i][j]) { printf("Incorrect solution. Keep trying!\n"); return; From 8c82bda00cdb8732b944fc64a3c574b951d8bb74 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:34:53 +0100 Subject: [PATCH 461/647] refactoring: 9 --- src/main/c/sudoku.c | 256 ++++++++++++++++++++++---------------------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 21fba11..1b134a1 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -38,88 +38,88 @@ int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { {0, 4, 8, 2, 0, 9, 5, 0, 0}, {5, 0, 0, 7, 0, 3, 2, 0, 0}}, - {{0, 0, 3, 0, 2, 1, 8, 0, 0}, - {6, 0, 0, 0, 7, 0, 1, 3, 2}, - {9, 2, 1, 5, 0, 0, 7, 6, 4}, - {7, 6, 0, 3, 0, 0, 4, 0, 0}, - {8, 5, 4, 1, 9, 7, 0, 0, 0}, - {1, 0, 0, 4, 0, 6, 0, 0, 0}, - {2, 9, 0, 8, 1, 5, 0, 0, 6}, - {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 2}}, -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7, 1, 3, 8}, + {8, 7, 9, 1, 5, 3, 4, 2, 6}, + {3, 6, 1, 4, 8, 2, 7, 5, 9}, + {1, 5, 2, 7, 3, 9, 8, 6, 4}, + {7, 4, 8, 5, 2, 6, 9, 1, 3}, + {9, 3, 6, 8, 4, 1, 5, 7, 2}, + {2, 8, 7, 9, 6, 5, 3, 4, 1}, + {6, 1, 4, 3, 7, 8, 2, 9, 5}, + {5, 9, 3, 2, 1, 4, 6, 8, 7}} } }; From 58bc8c183a88a21a0187e4584e51e4043d19cbcb Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:35:18 +0100 Subject: [PATCH 462/647] refactoring: 10 --- src/main/c/sudoku.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 1b134a1..975a080 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -3,6 +3,7 @@ #include #include + #define SIZE_OF_GAMEBORD_AXIS_X 9 #define SIZE_OF_GAMEBORD_AXIS_Y 9 #define EMPTY 0 @@ -15,7 +16,7 @@ int selected_level; void Game_loop(); //is instead of main void Level_Pool(int difficulty); -void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level); void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); @@ -242,7 +243,7 @@ void Game_loop() { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { Level_Pool(difficulty); - selectLevel(grid); + Level_Selection(grid); Player_actions_for_playing(grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); @@ -260,7 +261,7 @@ void Level_Pool(int difficulty) { -void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { int level = 0; printf("\nSelect a level:\n"); while (true){ @@ -350,7 +351,7 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO check_if_Sudoku_solved(grid); break; case 5: - selectLevel(grid); + Level_Selection(grid); break; case 6: printf("Exiting Sudoku program.\n"); From 7ccf0878b06afb60eba074f0e2ba374adb731b8b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:35:36 +0100 Subject: [PATCH 463/647] refactoring: 11 --- src/main/c/sudoku.c | 96 +++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 975a080..f18284d 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -6,28 +6,30 @@ #define SIZE_OF_GAMEBORD_AXIS_X 9 #define SIZE_OF_GAMEBORD_AXIS_Y 9 +#define AVAILABLE_DIFFICULTIES 3 +#define AVAILABLE_LEVELS 3 #define EMPTY 0 #define LEVEL_NUMBER 3 -int difficulty; +int selected_difficulty; int selected_level; void Game_loop(); //is instead of main -void Level_Pool(int difficulty); -void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level); -void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void Level_Pool(int selected_difficulty); +void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level); +void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void printGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); -int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { +int availableLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -124,7 +126,7 @@ int availableLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { } }; -int solutionLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { +int solutionLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{4, 7, 3, 6, 2, 1, 8, 5, 9}, @@ -224,7 +226,7 @@ int solutionLevels[3][3][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { void Game_loop() { - int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; selected_level = 0; while (1) { @@ -239,12 +241,12 @@ void Game_loop() { break; } - difficulty = input[0] - '0'; // Convert the first character to an integer + selected_difficulty = input[0] - '0'; // Convert the first character to an integer - if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { - Level_Pool(difficulty); - Level_Selection(grid); - Player_actions_for_playing(grid); + if ((selected_difficulty >= 1 && selected_difficulty <= 3) && input[1] == '\0') { + Level_Pool(selected_difficulty); + Level_Selection(Sudoku_grid); + Player_actions_for_playing(Sudoku_grid); } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } @@ -252,8 +254,8 @@ void Game_loop() { } } -void Level_Pool(int difficulty) { - printf("\nAvailable Levels for Difficulty %d:\n", difficulty); +void Level_Pool(int selected_difficulty) { + printf("\nAvailable Levels for Difficulty %d:\n", selected_difficulty); for (int i = 0; i < LEVEL_NUMBER; i++) { printf("%d. Level %d\n", i + 1, i + 1); } @@ -261,7 +263,7 @@ void Level_Pool(int difficulty) { -void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { int level = 0; printf("\nSelect a level:\n"); while (true){ @@ -276,7 +278,7 @@ void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) level--; // Adjust to 0-based index - create_playing_field(grid, difficulty, selected_level); + create_playing_field(Sudoku_grid, selected_difficulty, selected_level); break; } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); @@ -287,24 +289,24 @@ void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) } -void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - grid[i][j] = EMPTY; + Sudoku_grid[i][j] = EMPTY; } } } -void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level) { - initializeGrid(grid); +void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level) { + initializeGrid(Sudoku_grid); for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; + Sudoku_grid[i][j] = availableLevels[selected_difficulty - 1][level - 1][i][j]; } } for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - printf("%d", grid[i][j]); + printf("%d", Sudoku_grid[i][j]); } printf("\n"); } @@ -312,7 +314,7 @@ void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXI } -void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { while (1) { printf("\nTurn function - Choose an action:\n"); printf("1. Hints\n"); @@ -339,19 +341,19 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO switch (action) { case 1: - giving_hints_to_player(grid); + giving_hints_to_player(Sudoku_grid); break; case 2: - write_userinput_into_Sudoku(grid); + write_userinput_into_Sudoku(Sudoku_grid); break; case 3: - printGrid(grid); + printGrid(Sudoku_grid); break; case 4: - check_if_Sudoku_solved(grid); + check_if_Sudoku_solved(Sudoku_grid); break; case 5: - Level_Selection(grid); + Level_Selection(Sudoku_grid); break; case 6: printf("Exiting Sudoku program.\n"); @@ -364,7 +366,7 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO -void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nTip function - Choose an option:\n"); printf("1. Set the user-specified cell to the right value\n"); printf("2. Set the user-specified 3x3 field to the right values\n"); @@ -407,7 +409,7 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A printf("Invalid input. Please enter a number between 1 and 9.\n"); } } - grid[row - 1][col - 1] = solutionLevels[difficulty - 1][selected_level - 1][row - 1][col - 1]; + Sudoku_grid[row - 1][col - 1] = solutionLevels[selected_difficulty - 1][selected_level - 1][row - 1][col - 1]; printf("Value set successfully.\n"); break; @@ -432,8 +434,8 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - grid[startRow - 1 + i][startCol - 1 + j] = - solutionLevels[difficulty - 1][selected_level - 1][startRow - 1 + i][startCol - 1 + j]; + Sudoku_grid[startRow - 1 + i][startCol - 1 + j] = + solutionLevels[selected_difficulty - 1][selected_level - 1][startRow - 1 + i][startCol - 1 + j]; } } printf("3x3 field set successfully.\n"); @@ -442,7 +444,7 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A case 3: for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - grid[i][j] = solutionLevels[difficulty - 1][selected_level - 1][i][j]; + Sudoku_grid[i][j] = solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]; } } printf("Puzzle solved. \n"); @@ -452,7 +454,7 @@ void giving_hints_to_player(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A } } -void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); @@ -504,7 +506,7 @@ void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEB num = nume_str[0] - '0'; // Convert the first character to an integer if ((num >= 1 && num <= 9) && nume_str[1] == '\0') { - grid[row_e - 1][col_e - 1] = num; + Sudoku_grid[row_e - 1][col_e - 1] = num; printf("Value inserted successfully.\n"); break; } else { @@ -527,7 +529,7 @@ void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEB col_d = cold_str[0] - '0'; // Convert the first character to an integer if (((row_d >= 1 && row_d <= 9) && rowd_str[1] == '\0') && ((col_d >= 1 && col_d <= 9) && cold_str[1] == '\0')) { - grid[row_d - 1][col_d - 1] = 0; + Sudoku_grid[row_d - 1][col_d - 1] = 0; printf("Cell cleared successfully.\n"); break; } else { @@ -538,26 +540,26 @@ void write_userinput_into_Sudoku(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEB default: printf("Invalid input. Please enter 1 or 2.\n"); } - printGrid(grid); + printGrid(Sudoku_grid); } -void printGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void printGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nSudoku Grid:\n"); for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - printf("%d ", grid[i][j]); + printf("%d ", Sudoku_grid[i][j]); } printf("\n"); } } -void check_if_Sudoku_solved(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { +void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nDone function - Checking if the solution is correct...\n"); for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { - if (grid[i][j] != solutionLevels[difficulty - 1][selected_level - 1][i][j]) { + if (Sudoku_grid[i][j] != solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]) { printf("Incorrect solution. Keep trying!\n"); return; } From 729733ccfd711b48f47281b0158e523c8dd16e48 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:39:34 +0100 Subject: [PATCH 464/647] adding sudoku.h, changing the game to include the header --- src/main/c/sudoku.c | 71 +++++++++++++++++++++++++++++++++++++-------- src/main/c/sudoku.h | 41 ++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 src/main/c/sudoku.h diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index f18284d..accd026 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -2,7 +2,7 @@ #include #include #include - +#include "sudoku.h" #define SIZE_OF_GAMEBORD_AXIS_X 9 #define SIZE_OF_GAMEBORD_AXIS_Y 9 @@ -14,6 +14,11 @@ int selected_difficulty; int selected_level; +bool check_solved; +bool test_help = false; +int test_row_e; +int test_col_e; +int test_num; void Game_loop(); //is instead of main @@ -29,6 +34,7 @@ void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM + int availableLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { { //easy {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -234,6 +240,7 @@ void Game_loop() { printf("1. Easy\n2. Medium\n3. Hard\n"); printf("Enter the corresponding number or type 'quit' to exit: "); + if(!test_help){ char input[10]; scanf("%s", input); @@ -242,6 +249,7 @@ void Game_loop() { } selected_difficulty = input[0] - '0'; // Convert the first character to an integer + if ((selected_difficulty >= 1 && selected_difficulty <= 3) && input[1] == '\0') { Level_Pool(selected_difficulty); @@ -250,7 +258,11 @@ void Game_loop() { } else { printf("Invalid input. Please enter a number between 1 and 3.\n"); } - + } + if(test_help){ + Level_Pool(selected_difficulty); + break; + } } } @@ -267,7 +279,8 @@ void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A int level = 0; printf("\nSelect a level:\n"); while (true){ - char level_select[10]; + if(!test_help){ + char level_select[10]; scanf("%s", level_select); @@ -284,6 +297,13 @@ void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_A printf("Invalid input. Please enter a number between 1 and 3.\n"); } + } + if(test_help){ + selected_level = level; + level--; + create_playing_field(Sudoku_grid, selected_difficulty, selected_level); + break; + } } @@ -299,11 +319,13 @@ void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AX void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level) { initializeGrid(Sudoku_grid); + if(!test_help){ for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { Sudoku_grid[i][j] = availableLevels[selected_difficulty - 1][level - 1][i][j]; } } + } for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { printf("%d", Sudoku_grid[i][j]); @@ -324,8 +346,14 @@ void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF printf("5. Select level\n"); printf("6. Quit\n"); - int action; - + + int action; + if(test_help){ + printGrid(Sudoku_grid); + check_if_Sudoku_solved(Sudoku_grid); + break; + } + if(!test_help){ while (true){ char action_str[10]; scanf("%s", action_str); @@ -338,7 +366,7 @@ void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF printf("Invalid input. Please enter a number between 1 and 6.\n"); } } - + switch (action) { case 1: giving_hints_to_player(Sudoku_grid); @@ -361,6 +389,7 @@ void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF default: printf("Invalid input. Please enter a number between 1 and 6.\n"); } + } } } @@ -372,9 +401,18 @@ void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM printf("2. Set the user-specified 3x3 field to the right values\n"); printf("3. Solve the entire puzzle for the current level\n"); - + if(test_help){ + initializeGrid(Sudoku_grid); + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; i++) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { + Sudoku_grid[i][j] = solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]; + } + } + printf("Puzzle solved. \n"); + + } int option = 0; - + if(!test_help){ while (true){ char tip_str[10]; scanf("%s", tip_str); @@ -388,7 +426,7 @@ void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM printf("Invalid input. Please enter a number between 1 and 3.\n"); } } - + switch (option) { case 1: printf("Enter the coordinates (row and column) separated by space:\n"); @@ -452,15 +490,22 @@ void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM default: printf("Invalid option. Please enter a number between 1 and 3.\n"); } + } } void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) { printf("\nInput function - Choose an action:\n"); printf("1. Insert value in an empty field\n"); printf("2. Clear an already filled field\n"); + + if(test_help){ + initializeGrid(Sudoku_grid); + Sudoku_grid[test_row_e -1][test_col_e -1] = test_num; + printGrid(Sudoku_grid); + } int action; - + if(!test_help){ while (true){ char in_str[10]; scanf("%s", in_str); @@ -541,6 +586,7 @@ void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_O printf("Invalid input. Please enter 1 or 2.\n"); } printGrid(Sudoku_grid); + } } @@ -561,16 +607,17 @@ void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAM for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; j++) { if (Sudoku_grid[i][j] != solutionLevels[selected_difficulty - 1][selected_level - 1][i][j]) { printf("Incorrect solution. Keep trying!\n"); + check_solved = false; return; } } } - + check_solved = true; printf("Congratulations! Sudoku is solved correctly.\n"); } -int main(){ +int mainn(){ Game_loop(); return 0; } \ No newline at end of file diff --git a/src/main/c/sudoku.h b/src/main/c/sudoku.h new file mode 100644 index 0000000..63914c1 --- /dev/null +++ b/src/main/c/sudoku.h @@ -0,0 +1,41 @@ +#ifndef SUDOKU_H +#define SUDOKU_H + +#include +//constants +#define SIZE_OF_GAMEBORD_AXIS_X 9 +#define SIZE_OF_GAMEBORD_AXIS_Y 9 +#define AVAILABLE_DIFFICULTIES 3 +#define AVAILABLE_LEVELS 3 +#define EMPTY 0 +#define LEVEL_NUMBER 3 + + +extern int selected_difficulty; +extern int selected_level; +extern int solutionLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; +extern int availableLevels[AVAILABLE_DIFFICULTIES][AVAILABLE_LEVELS][SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; +extern bool check_solved; +extern bool test_help; +extern int test_row_e; +extern int test_col_e; +extern int test_num; + + + +//functions +void Game_loop(); //is instead of main +void Level_Pool(int selected_difficulty); +void Level_Selection(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void initializeGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void create_playing_field(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int selected_difficulty, int level); +void Player_actions_for_playing(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void giving_hints_to_player(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void write_userinput_into_Sudoku(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void printGrid(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +void check_if_Sudoku_solved(int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]); +int mainn(); + + + +#endif // SUDOKU_H From b737bb6b8fb1f7c057a562a8727a3e8850683dcd Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:42:58 +0100 Subject: [PATCH 465/647] test 1 --- src/test/c/test_sudoku.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/c/test_sudoku.c diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c new file mode 100644 index 0000000..59be98f --- /dev/null +++ b/src/test/c/test_sudoku.c @@ -0,0 +1,22 @@ +#ifdef TEST + +#include "unity.h" +#include "sudoku.h" +#include +#include +#include +#include +#include + + + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + + +#endif // TEST From 2d4997265629bfec365646db7aa5a2b7fc62f9b1 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:13 +0100 Subject: [PATCH 466/647] test 2 --- src/test/c/test_sudoku.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 59be98f..e58d373 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -18,5 +18,32 @@ void tearDown(void) { } +//1 + +// Unit test for Level_Pool() function +// Call the Level_Pool() function, prints 3 fixed lines and "Available levels for Difficulty " +void test_Level_Pool_0() { + selected_difficulty = 0; + Level_Pool(selected_difficulty); + //TEST_PASS(); + printf("Unit test for Level_Pool_0() executed.\n"); +} + +void test_Level_Pool_5() { + selected_difficulty = 5; + Level_Pool(selected_difficulty); + //TEST_PASS(); + printf("Unit test for Level_Pool_5() executed.\n"); +} + +void test_Level_Pool_neg_1() { + selected_difficulty = -1; + Level_Pool(selected_difficulty); + //TEST_PASS(); + printf("Unit test for Level_Pool_-1() executed.\n\n"); +} + + + #endif // TEST From 4ed8ae434cc8ae77b551f7ed6aad7092811499a2 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:35 +0100 Subject: [PATCH 467/647] test 3 --- src/test/c/test_sudoku.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index e58d373..674cf9b 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -43,6 +43,27 @@ void test_Level_Pool_neg_1() { printf("Unit test for Level_Pool_-1() executed.\n\n"); } +//2 + +void test_initializeGrid() { + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + + + initializeGrid(Sudoku_grid); + int expected = EMPTY; + + + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected, Sudoku_grid[i][j], "Checking if every space is 0"); + } + } + + + printf("Unit test for initializeGrid() executed.\n\n"); +} + + From 1109d8a0cbeb84622bbaffc6a5acf420d4a5b481 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:54 +0100 Subject: [PATCH 468/647] test 4 --- src/test/c/test_sudoku.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 674cf9b..92a9053 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -64,6 +64,33 @@ void test_initializeGrid() { } +//3 + +void test_create_playing_field_level_medium_two() { + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + selected_difficulty = 2; + selected_level = 2; + int expected_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = {{7, 0, 2, 0, 0, 0, 9, 5, 0}, + {0, 0, 0, 7, 5, 0, 2, 0, 6}, + {0, 0, 5, 0, 2, 8, 7, 0, 3}, + {5, 1, 8, 0, 3, 0, 6, 0, 0}, + {0, 0, 6, 1, 0, 0, 0, 3, 0}, + {0, 0, 0, 0, 6, 2, 0, 8, 1}, + {0, 9, 0, 2, 0, 4, 0, 0, 5}, + {0, 0, 0, 0, 9, 0, 0, 0, 4}, + {0, 5, 1, 0, 0, 0, 0, 9, 2}}; + + create_playing_field(Sudoku_grid, selected_difficulty, selected_level); + + // Check if the generated Sudoku grid is valid + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected_grid[i][j], Sudoku_grid[i][j], "Checking if every space is correct"); + }} + + printf("Unit test for create_playing_field() executed.\n\n"); +} + From 6629d9fbada4b66d9eba4b07515825975f9b3d2a Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:45:30 +0100 Subject: [PATCH 469/647] test 5 --- src/test/c/test_sudoku.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 92a9053..973b108 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -91,6 +91,29 @@ void test_create_playing_field_level_medium_two() { printf("Unit test for create_playing_field() executed.\n\n"); } +//4 + +// Unit test for printGrid() function +void test_printGrid() { + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {5, 3, 0, 0, 7, 0, 0, 0, 0}, + {6, 0, 0, 1, 9, 5, 0, 0, 0}, + {0, 9, 8, 0, 0, 0, 0, 6, 0}, + {8, 0, 0, 0, 6, 0, 0, 0, 3}, + {4, 0, 0, 8, 0, 3, 0, 0, 1}, + {7, 0, 0, 0, 2, 0, 0, 0, 6}, + {0, 6, 0, 0, 0, 0, 2, 8, 0}, + {0, 0, 0, 4, 1, 9, 0, 0, 5}, + {0, 0, 0, 0, 8, 0, 0, 7, 9} + }; + + printf("Sudoku Grid:\n"); + printGrid(Sudoku_grid); + //TEST_PASS(); + printf("Unit test for printGrid() executed.\n\n"); +} + + From f8ac670ea2ece7a8c09b35cc4ed47cfee8b43576 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:45:52 +0100 Subject: [PATCH 470/647] test 6 --- src/test/c/test_sudoku.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 973b108..19f424b 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -114,6 +114,52 @@ void test_printGrid() { } +//5 + +// Unit test for check_if_Sudoku_solved() function +void test_check_if_Sudoku_solved_everything_correct() { + selected_difficulty = 1; + selected_level = 1; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}; + + + check_if_Sudoku_solved(Sudoku_grid); + TEST_ASSERT_TRUE(check_solved); + + + printf("Unit test for check_if_Sudoku_solved() executed.\n"); +} + +void test_check_if_Sudoku_solved_mistake_on_purpose() { + selected_difficulty = 1; + selected_level = 1; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 3}}; + + + check_if_Sudoku_solved(Sudoku_grid); + TEST_ASSERT_FALSE(check_solved); + + + printf("Unit test for check_if_Sudoku_solved() executed.\n\n"); +} From bff208a3e0e43a468d85b6e3432392861dde365f Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:46:11 +0100 Subject: [PATCH 471/647] test 7 --- src/test/c/test_sudoku.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 19f424b..f3ff12d 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -162,5 +162,15 @@ void test_check_if_Sudoku_solved_mistake_on_purpose() { } +//6 + +void test_Game_loop_1(){ + test_help = true; + selected_difficulty = 1; + Game_loop(); + printf("Unit test for Game_loop() executed.\n\n"); +} + + #endif // TEST From 252a0e8708e7c42aa291d037cda149bca9a5d06d Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:46:29 +0100 Subject: [PATCH 472/647] test 8 --- src/test/c/test_sudoku.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index f3ff12d..0dfa07e 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -171,6 +171,27 @@ void test_Game_loop_1(){ printf("Unit test for Game_loop() executed.\n\n"); } +//7 + +void test_Level_Selection_2_2(){ + test_help = true; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + selected_difficulty = 1; + selected_level = 1; + + Level_Selection(Sudoku_grid); + + int expected = EMPTY; + + + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected, Sudoku_grid[i][j], "Checking if level gets initialized correctly"); + } + } + + printf("Unit test for Level_Selection() executed.\n\n"); +} #endif // TEST From 55bc31c9b09d8cc4896c86e0b76d48e14979d688 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:46:47 +0100 Subject: [PATCH 473/647] test 9 --- src/test/c/test_sudoku.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 0dfa07e..4cbee9c 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -193,5 +193,30 @@ void test_Level_Selection_2_2(){ printf("Unit test for Level_Selection() executed.\n\n"); } +//8 + +void test_Player_actions_for_playing_print_and_solve(){ + test_help = true; + selected_difficulty = 1; + selected_level = 1; + + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = { + {4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}; + + Player_actions_for_playing(Sudoku_grid); + TEST_ASSERT_TRUE(check_solved); + printf("Unit test for Player_actions_for_playing() executed.\n\n"); +} + + + #endif // TEST From 309885c4bc47e3a43df5f9fb261a118b1ec642d0 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:47:05 +0100 Subject: [PATCH 474/647] test 10 --- src/test/c/test_sudoku.c | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 4cbee9c..c5abf7f 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -218,5 +218,48 @@ void test_Player_actions_for_playing_print_and_solve(){ +//9 + +void test_giving_hints_to_player(){ + test_help = true; + int selected_difficulty = 1; + int selected_level = 1; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = + { + {5, 3, 0, 0, 7, 0, 0, 0, 0}, + {6, 0, 0, 1, 9, 5, 0, 0, 0}, + {0, 9, 8, 0, 0, 0, 0, 6, 0}, + {8, 0, 0, 0, 6, 0, 0, 0, 3}, + {4, 0, 0, 8, 0, 3, 0, 0, 1}, + {7, 0, 0, 0, 2, 0, 0, 0, 6}, + {0, 6, 0, 0, 0, 0, 2, 8, 0}, + {0, 0, 0, 4, 1, 9, 0, 0, 5}, + {0, 0, 0, 0, 8, 0, 0, 7, 9} + }; + int expected_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}; + + giving_hints_to_player(Sudoku_grid); + + // Check if the generated Sudoku grid is valid + for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) { + for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) { + TEST_ASSERT_EQUAL_INT_MESSAGE(expected_grid[i][j], Sudoku_grid[i][j], "Checking if every space is correct"); + }} + + + printf("Unit test for giving_hints_to_player() executed.\n\n"); +} + + + #endif // TEST From 49f77d78e1563da5e6319d8d68df84488577bfd4 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:47:22 +0100 Subject: [PATCH 475/647] test 11 --- src/test/c/test_sudoku.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index c5abf7f..557f85d 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -260,6 +260,27 @@ void test_giving_hints_to_player(){ } +// 10 + +void test_write_userinput_into_Sudoku_9_into_empty(){ + test_help = true; + test_row_e = 1; + test_col_e = 1; + test_num = 9; + int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]; + + + write_userinput_into_Sudoku(Sudoku_grid); + + TEST_ASSERT_EQUAL_INT_MESSAGE(test_num, Sudoku_grid[test_row_e -1][test_col_e -1], "Checking if number input is correct"); + + + + printf("Unit test for write_userinput_into_Sudoku() executed.\n\n"); +} + + + #endif // TEST From c92d571edab1cbbc3457abe381ee45d54bad449c Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:40:35 +0100 Subject: [PATCH 476/647] 1 Init Board --- src/main/c/TicTacToe.c | 14 ++++++++++++++ src/main/c/a.exe | Bin 0 -> 42690 bytes 2 files changed, 14 insertions(+) create mode 100644 src/main/c/TicTacToe.c create mode 100644 src/main/c/a.exe diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c new file mode 100644 index 0000000..e011caf --- /dev/null +++ b/src/main/c/TicTacToe.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +// Funktion, um das Spielfeld zu initialisieren +//1 +void Brett(char Feld[3][3]) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + Feld[i][j] = '_'; + } + } +} \ No newline at end of file diff --git a/src/main/c/a.exe b/src/main/c/a.exe new file mode 100644 index 0000000000000000000000000000000000000000..b9e385d1dd5fc87e0a27275592ca9c71612bbfaa GIT binary patch literal 42690 zcmeIb4}4VBwJ*NU%!CXi;}9;|23^L18=!2}w^>Ez z;C%d$Knrk^GI7URR<$;}sa~xI%tdfFPUy@Q;fy=nY(Zakr$BU4V^-lLUQ6PTkOZE4 zzD}Dp34paYQ*qvaGwvX~?1ru`0(HcG;t=#?H`UuJ>g6`U|=kk$< z5}q1E;R)!GZ-xBd&jnA<2p49#!Ys^|eH|9sRI#iVm#($T&?)-lo+A)xurP~z=Aa`h z1=+~-Y{r74k{l|5UOhm1576G-*O2r%eZhk>4mj8jJ-_T>uu)5w{XKCDX~0>GyPZOdivBosErDuLwln*MxN;1gIv5Uoa}3YEbtQXqc+jWB3&rpl*8*m zuAS|D?pmT>b_G|f4zM^0NWF+huu^Y>N})xB;NW`e5)6M4pdGpm44AC*iLd$GTrLIG z7Wpm0mXP9ipNSfEOkU%!fEhd#9X@O=<3|38UiPmj>s7B|y8Lz8?`ndlGj~2(GO9gwCUP6}iQGpe z#Mil#p*~`^(?JQ4UJqB(`Xi-4(Pm^tUZbngUcu9Oy@gqGd0PRUnuIO@k(ywWzS9YT zgC`}VQ-M00>WEB3aqwV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H7z#r2g>82&HBV#|y~iiS2LBy-7sgL|r&)Z1d?@%UOemrD2+I zm!OZowPWT+oY_UEI-lRE#~WBUzp?RK_v6@Z+n*PZjnNe2hiTl{v`ryZM7+b)DekU> aVEF8u0)f%P^w2rhQWx#LTy%Z)`+os4M^G~W literal 0 HcmV?d00001 From 80a7b97e213767e6f62f42f798478552e89298fc Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:41:40 +0100 Subject: [PATCH 477/647] 2 display Board --- src/main/c/TicTacToe.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index e011caf..837e2a2 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -4,11 +4,18 @@ #include // Funktion, um das Spielfeld zu initialisieren -//1 void Brett(char Feld[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Feld[i][j] = '_'; } } +} +void Bild(char Feld[3][3]) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + printf("%c ", Feld[i][j]); + } + printf("\n"); + } } \ No newline at end of file From 9bb6b7d37e13c7f2fbea409f9f2da21196b68e43 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:43:01 +0100 Subject: [PATCH 478/647] 3 del old Board --- src/main/c/TicTacToe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 837e2a2..31999f4 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -12,6 +12,11 @@ void Brett(char Feld[3][3]) { } } void Bild(char Feld[3][3]) { +#ifdef _WIN32 + system("cls"); +#else + system("clear"); +#endif for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { printf("%c ", Feld[i][j]); From d4264eae7ccf5500779cf7a08d28f0b2bb4e6b03 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:45:41 +0100 Subject: [PATCH 479/647] 4 win condition row --- src/main/c/TicTacToe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 31999f4..762fcb3 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -23,4 +23,16 @@ void Bild(char Feld[3][3]) { } printf("\n"); } +} +int Entscheiden(char Feld[3][3]) { + // Überprüfen Sieg + // Überprüfen Reihen + for (int i = 0; i < 3; i++) { + if (Feld[i][0] == Feld[i][1] && Feld[i][1] == Feld[i][2] && Feld[i][0] != '_') { + if (Feld[i][0] == 'X') { + return 1; + } + else return 2; + } + } } \ No newline at end of file From 22a68f4aee543383abb91e4e915da3064fd63f29 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:49:16 +0100 Subject: [PATCH 480/647] refactoring: function winner --- src/main/c/TicTacToe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 762fcb3..d6a2860 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -24,7 +24,7 @@ void Bild(char Feld[3][3]) { printf("\n"); } } -int Entscheiden(char Feld[3][3]) { +int Winner(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { From 4e4eb7150c2ff4c98f083ca5912f2664cb1c31f4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:57:12 +0100 Subject: [PATCH 481/647] 6 erster Test + Header --- src/main/c/TicTacToe.h | 7 +++++++ src/test/c/test_TicTacToe.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/c/TicTacToe.h create mode 100644 src/test/c/test_TicTacToe.c diff --git a/src/main/c/TicTacToe.h b/src/main/c/TicTacToe.h new file mode 100644 index 0000000..1e04a7d --- /dev/null +++ b/src/main/c/TicTacToe.h @@ -0,0 +1,7 @@ +#ifndef TICTACTOE_H +#define TICTACTOE_H + +int Winner(char board[3][3]); + +#endif + diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c new file mode 100644 index 0000000..b1c8b25 --- /dev/null +++ b/src/test/c/test_TicTacToe.c @@ -0,0 +1,29 @@ + +#include "unity.h" + +#include "TicTacToe.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_TicTacToe_Winner_X_line_1(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'X', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} \ No newline at end of file From 59e52beee2c18649b7cf15742c90099222440cc5 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 13:06:34 +0100 Subject: [PATCH 482/647] 7 zweiter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index b1c8b25..f8a1c62 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -26,4 +26,20 @@ void test_TicTacToe_Winner_X_line_1(void) /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_line_2(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'X', 'O', 'X'}, + {'O', 'O', 'O'}, + {'O', 'X', 'X'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From d0a63ece2b131f75a72b028af3f0b4e6b8ce6842 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 13:09:37 +0100 Subject: [PATCH 483/647] 8 dritter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index f8a1c62..fc12b42 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -40,6 +40,22 @@ void test_TicTacToe_Winner_O_line_2(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_X_line_3(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'O', '_', '_'}, + {'O', 'O', '_'}, + {'X', 'X', 'X'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 5f7c1d755bd297f45a7208c26d07abef3fc86507 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:22:49 +0100 Subject: [PATCH 484/647] 9 win condition column --- src/main/c/TicTacToe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index d6a2860..035d6c4 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -35,4 +35,13 @@ int Winner(char Feld[3][3]) { else return 2; } } + // Überprüfen Spalten + for (int j = 0; j < 3; j++) { + if (Feld[0][j] == Feld[1][j] && Feld[1][j] == Feld[2][j] && Feld[0][j] != '_') { + if (Feld[0][j] == 'X') { + return 1; + } + else return 2; + } + } } \ No newline at end of file From 3dc336658346cb171f47fd35d8e6b91f9fd30ef4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:26:03 +0100 Subject: [PATCH 485/647] 10 vierter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index fc12b42..57809a8 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -56,6 +56,22 @@ void test_TicTacToe_Winner_X_line_3(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_col_1(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'O', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 7a7cbc3182b5b57c7825df6c47bb07b6178d4b1b Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:28:06 +0100 Subject: [PATCH 486/647] =?UTF-8?q?11=20f=C3=BCnfter=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index 57809a8..d65895b 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -72,6 +72,22 @@ void test_TicTacToe_Winner_O_col_1(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_X_col_2(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'O', 'X', 'X'}, + {'_', 'X', 'O'}, + {'O', 'X', '_'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From cd9605abf0461fcb073ba85772e6d7fa36d6574e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 16:59:34 +0100 Subject: [PATCH 487/647] 12 sechster Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index d65895b..f0d5ab7 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -88,6 +88,22 @@ void test_TicTacToe_Winner_X_col_2(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_col_3(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'X', 'X', 'O'}, + {'_', 'O', 'O'}, + {'_', '_', 'O'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 7f064055a98560c5689db66a87e8d7ef5d0b55fc Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:01:40 +0100 Subject: [PATCH 488/647] 13 win condition diagonal --- src/main/c/TicTacToe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 035d6c4..14e960e 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -44,4 +44,13 @@ int Winner(char Feld[3][3]) { else return 2; } } + // Überprüfen Diagonalen + if ((Feld[0][0] == Feld[1][1] && Feld[1][1] == Feld[2][2]) || (Feld[0][2] == Feld[1][1] && Feld[1][1] == Feld[2][0])) { + if (Feld[1][1] != '_') { + if (Feld[1][1] == 'X') { + return 1; + } + else return 2; + } + } } \ No newline at end of file From 2d51448adb1ce5ca8c5a537978800fc51186a4f9 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:04:28 +0100 Subject: [PATCH 489/647] 14 siebter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index f0d5ab7..0dc4844 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -104,6 +104,22 @@ void test_TicTacToe_Winner_O_col_3(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_X_diagonal_1(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'X', 'O', 'X'}, + {'O', 'X', 'O'}, + {'O', '_', 'X'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 037a64fecc244f9a0f06428e85a508dfd1eb8162 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:05:25 +0100 Subject: [PATCH 490/647] 15 achter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index 0dc4844..fd80b53 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -120,6 +120,22 @@ void test_TicTacToe_Winner_X_diagonal_1(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_Winner_O_diagonal_2(void) +{ + /* arrange */ + int expected = 2; + int actual; + char board[3][3] = { + {'O', 'X', 'O'}, + {'X', 'O', 'X'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From f2f7d489a3df48ff08e9d1afeb3044fff41c814e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:08:24 +0100 Subject: [PATCH 491/647] 16 check round --- src/main/c/TicTacToe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 14e960e..72f52ae 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -53,4 +53,13 @@ int Winner(char Feld[3][3]) { else return 2; } } + //Überprüfe Runde + for (int k = 0; k < 3; k++) { + for (int l = 0; l < 3; l++) { + if (Feld[k][l] == '_') { + return 9; + } + } + } + } \ No newline at end of file From dffbb0a122a0ba8463dfeff006f9cd47018825ed Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:15:00 +0100 Subject: [PATCH 492/647] 17 neuneter Test --- src/test/c/test_TicTacToe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index fd80b53..53292e3 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -136,6 +136,22 @@ void test_TicTacToe_Winner_O_diagonal_2(void) /* act */ actual = Winner(board); + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} +void test_TicTacToe_mid_Round(void) +{ + /* arrange */ + int expected = 9; + int actual; + char board[3][3] = { + {'X', 'X', 'O'}, + {'_', 'O', 'X'}, + {'_', '_', 'O'} + }; + /* act */ + actual = Winner(board); + /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); } \ No newline at end of file From 46f535fd8b64f33076d196d45a718f750b4bd236 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:16:21 +0100 Subject: [PATCH 493/647] 18 win condition Tie --- src/main/c/TicTacToe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 72f52ae..29ac1fe 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -61,5 +61,7 @@ int Winner(char Feld[3][3]) { } } } - + //Bestätige Unendschieden + printf("Es ist ein Unendschieden\n"); + return 0; } \ No newline at end of file From 7f829b77bf4aeceb841b5acb43fdb6b5648cbf2f Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:17:22 +0100 Subject: [PATCH 494/647] 19 letzter Test --- src/test/c/test_TicTacToe.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c index 53292e3..a6e0cf9 100644 --- a/src/test/c/test_TicTacToe.c +++ b/src/test/c/test_TicTacToe.c @@ -62,18 +62,18 @@ void test_TicTacToe_Winner_X_line_3(void) void test_TicTacToe_Winner_O_col_1(void) { /* arrange */ - int expected = 2; - int actual; - char board[3][3] = { - {'O', 'X', 'X'}, - {'O', 'O', '_'}, - {'O', '_', '_'} - }; + int expected = 2; + int actual; + char board[3][3] = { + {'O', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; /* act */ - actual = Winner(board); + actual = Winner(board); /* assert */ - TEST_ASSERT_EQUAL_INT(expected, actual); + TEST_ASSERT_EQUAL_INT(expected, actual); } void test_TicTacToe_Winner_X_col_2(void) { @@ -154,4 +154,20 @@ void test_TicTacToe_mid_Round(void) /* assert */ TEST_ASSERT_EQUAL_INT(expected, actual); -} \ No newline at end of file +} +void test_TicTacToe_Tie(void) +{ + /* arrange */ + int expected = 0; + int actual; + char board[3][3] = { + {'X', 'X', 'O'}, + {'O', 'O', 'X'}, + {'X', 'X', 'O'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} From c00d42998bbe57cf0df818c6d554b9a4c319738c Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:20:01 +0100 Subject: [PATCH 495/647] 20 move O --- src/main/c/TicTacToe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 29ac1fe..024f326 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -3,6 +3,7 @@ #include #include +int Zaehler = 1; // Funktion, um das Spielfeld zu initialisieren void Brett(char Feld[3][3]) { for (int i = 0; i < 3; i++) { @@ -64,4 +65,11 @@ int Winner(char Feld[3][3]) { //Bestätige Unendschieden printf("Es ist ein Unendschieden\n"); return 0; +} +void Zuege(char Feld[3][3], int row, int col) { + if (Zaehler % 2 == 0) { + if (Feld[row][col] == '_') { + Feld[row][col] = 'O'; + } + } } \ No newline at end of file From 689900f8c88b98cc2ba565902b6bf915ddb016e4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:20:41 +0100 Subject: [PATCH 496/647] 21 move X --- src/main/c/TicTacToe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 024f326..d46d3b3 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -69,7 +69,12 @@ int Winner(char Feld[3][3]) { void Zuege(char Feld[3][3], int row, int col) { if (Zaehler % 2 == 0) { if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; + Feld[row][col] = 'O'; + } + } + else { + if (Feld[row][col] == '_') { + Feld[row][col] = 'X'; } } } \ No newline at end of file From 2e4466f89c01a034653230bf7d252502e0322f56 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:22:16 +0100 Subject: [PATCH 497/647] 22 belegtes Feld O --- src/main/c/TicTacToe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index d46d3b3..17f75bb 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -71,6 +71,14 @@ void Zuege(char Feld[3][3], int row, int col) { if (Feld[row][col] == '_') { Feld[row][col] = 'O'; } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } else { if (Feld[row][col] == '_') { From 1892577929ef6dbdcada02ae04dc9711254a70d7 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:22:56 +0100 Subject: [PATCH 498/647] 23 belegtes Feld X --- src/main/c/TicTacToe.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 17f75bb..c4de506 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -25,7 +25,8 @@ void Bild(char Feld[3][3]) { printf("\n"); } } -int Winner(char Feld[3][3]) { +int Winner +(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { @@ -69,7 +70,7 @@ int Winner(char Feld[3][3]) { void Zuege(char Feld[3][3], int row, int col) { if (Zaehler % 2 == 0) { if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; + Feld[row][col] = 'O'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); @@ -84,5 +85,13 @@ void Zuege(char Feld[3][3], int row, int col) { if (Feld[row][col] == '_') { Feld[row][col] = 'X'; } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } } \ No newline at end of file From 057a35584c80fc798adccad87e43b2c30c42fed7 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:24:23 +0100 Subject: [PATCH 499/647] 24 start Hauptfunktion --- src/main/c/TicTacToe.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index c4de506..ed21c57 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -25,8 +25,7 @@ void Bild(char Feld[3][3]) { printf("\n"); } } -int Winner -(char Feld[3][3]) { +int Winner(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { @@ -94,4 +93,21 @@ void Zuege(char Feld[3][3], int row, int col) { Zuege(Feld, row, col); } } +} +// Hauptfunktion zum Spielen des Tic Tac Toe-Spiels +int mainx() { + int row; + int col; + char Feld[3][3]; + Brett(Feld); + Bild(Feld); + if (Zaehler % 2 != 0) { + printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + } + else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); } \ No newline at end of file From a10e0a2e53ad0384f14e24e03b579ba0c5f65501 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:25:26 +0100 Subject: [PATCH 500/647] 25 Nachfrage optimiert --- src/main/c/TicTacToe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index ed21c57..8f3df43 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -105,8 +105,10 @@ int mainx() { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); row -= 1; col -= 1; Zuege(Feld, row, col); From 665934fc5ad8f41b839b51a4ba1e6fb0544f9ad5 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:58:01 +0100 Subject: [PATCH 501/647] =?UTF-8?q?26=20Runde=20Z=C3=A4hlen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 8f3df43..0622484 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -112,4 +112,5 @@ int mainx() { row -= 1; col -= 1; Zuege(Feld, row, col); + Zaehler++; } \ No newline at end of file From 02527d86a40eafa34f2e2e923865b8ffbbf6183e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:58:55 +0100 Subject: [PATCH 502/647] =?UTF-8?q?27=20mehr=20Z=C3=BCge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 0622484..37879ef 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -101,16 +101,19 @@ int mainx() { char Feld[3][3]; Brett(Feld); Bild(Feld); - if (Zaehler % 2 != 0) { - printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + while (Winner(Feld) == 9) { + Bild(Feld); + if (Zaehler % 2 != 0) { + printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + } + else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + Zaehler++; } - else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); - printf("Reihe:"); - scanf("%d", &row); - printf("Spalte:"); - scanf("%d", &col); - row -= 1; - col -= 1; - Zuege(Feld, row, col); - Zaehler++; -} \ No newline at end of file +} From 7672024756c9b0e4c23708e9ecfd4b2bd5a0dbd8 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:59:47 +0100 Subject: [PATCH 503/647] 28 Sieger bestimmen --- src/main/c/TicTacToe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 37879ef..c8a72fb 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -116,4 +116,6 @@ int mainx() { Zuege(Feld, row, col); Zaehler++; } + Bild(Feld); + Winner(Feld); } From 095925fbb2bea2e14b6aff9273464dde44ebbaa4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:01:14 +0100 Subject: [PATCH 504/647] 29 Feldrand --- src/main/c/TicTacToe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index c8a72fb..67733fd 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -113,6 +113,12 @@ int mainx() { scanf("%d", &col); row -= 1; col -= 1; + if (row > 3 || col > 3) { + printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); + scanf("%d %d", &row, &col); + row -= 1; //Für Index eins kleiner + col -= 1; + } Zuege(Feld, row, col); Zaehler++; } From c5bda9ff7183a7eb25f2d2610db79623299072f7 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:03:32 +0100 Subject: [PATCH 505/647] 30 mehr Spiele --- src/main/c/TicTacToe.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 67733fd..aa06372 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -99,29 +99,36 @@ int mainx() { int row; int col; char Feld[3][3]; - Brett(Feld); - Bild(Feld); - while (Winner(Feld) == 9) { - Bild(Feld); - if (Zaehler % 2 != 0) { - printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); - } - else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); - printf("Reihe:"); - scanf("%d", &row); - printf("Spalte:"); - scanf("%d", &col); - row -= 1; - col -= 1; - if (row > 3 || col > 3) { - printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); - scanf("%d %d", &row, &col); - row -= 1; //Für Index eins kleiner + char Nochmal[50] = { "Weiter" }; + + while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { + Zaehler = 1; + Brett(Feld); + while (Winner(Feld) == 9) { + + Bild(Feld); + if (Zaehler % 2 != 0) { + printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); + } + else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); + row -= 1; col -= 1; + if (row > 3 || col > 3) { + printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); + scanf("%d %d", &row, &col); + row -= 1; //Für Index eins kleiner + col -= 1; + } + Zuege(Feld, row, col); + Zaehler++; } - Zuege(Feld, row, col); - Zaehler++; + Bild(Feld); + Winner(Feld); + printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); + scanf("%s", Nochmal); } - Bild(Feld); - Winner(Feld); -} +} \ No newline at end of file From 0928dc9060f6f01b68eee28470bb2cce23d9cc39 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:05:57 +0100 Subject: [PATCH 506/647] =?UTF-8?q?31=20Z=C3=BCge=20O=20optimiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 49 +++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index aa06372..983e125 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -67,30 +67,34 @@ int Winner(char Feld[3][3]) { return 0; } void Zuege(char Feld[3][3], int row, int col) { - if (Zaehler % 2 == 0) { - if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; - } - else { - printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); - row -= 1; - col -= 1; - Zuege(Feld, row, col); - } - } - else { - if (Feld[row][col] == '_') { - Feld[row][col] = 'X'; + if (Zaehler < 10) { + if (Zaehler % 2 == 0) { + if (Feld[row][col] == '_') { + Feld[row][col] = 'O'; + } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } else { - printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); - row -= 1; - col -= 1; - Zuege(Feld, row, col); + if (Feld[row][col] == '_') { + Feld[row][col] = 'X'; + } + else { + printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); + printf("[Reihe Spalte]:"); + scanf("%d %d"); + row -= 1; + col -= 1; + Zuege(Feld, row, col); + } } } } @@ -131,4 +135,5 @@ int mainx() { printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } + return 0; } \ No newline at end of file From c4ef2852a5437aeb92eb4da40c014a946898d3f5 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:07:06 +0100 Subject: [PATCH 507/647] =?UTF-8?q?32=20Z=C3=BCge=20X=20optimiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 983e125..beda977 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -89,8 +89,10 @@ void Zuege(char Feld[3][3], int row, int col) { } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); - printf("[Reihe Spalte]:"); - scanf("%d %d"); + printf("Reihe:"); + scanf("%d", &row); + printf("Spalte:"); + scanf("%d", &col); row -= 1; col -= 1; Zuege(Feld, row, col); From 82fed785c52ae6a59fcef2654c7499a8d3f93135 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:08:55 +0100 Subject: [PATCH 508/647] 33 Spieler Name --- src/main/c/TicTacToe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index beda977..a544052 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -105,8 +105,10 @@ int mainx() { int row; int col; char Feld[3][3]; + char Spieler1[50], Spieler2[50]; char Nochmal[50] = { "Weiter" }; - + printf("Name der Spieler\[Spieler 1 Spieler2]\n"); + scanf("%s %s", Spieler1, Spieler2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); From 90da507a4c08ec6f0310a6219a9eaddde57227bd Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:11:32 +0100 Subject: [PATCH 509/647] =?UTF-8?q?34=20Begr=C3=BC=C3=9Fung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index a544052..e5b7a7f 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -112,6 +112,7 @@ int mainx() { while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); + printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(Feld) == 9) { Bild(Feld); From f40a29974b4bc51cb3ecfc10d3fc6ee815d742e9 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:12:59 +0100 Subject: [PATCH 510/647] 35 Sieger ausgabe --- src/main/c/TicTacToe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index e5b7a7f..0b8c6a1 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -136,7 +136,9 @@ int mainx() { Zaehler++; } Bild(Feld); - Winner(Feld); + if (Winner(Feld) == 1) { + printf("Der Sieger ist %s", Spieler1); + } printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } From f036076480f6728cd97da7ce95db6c3267ab1434 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:14:19 +0100 Subject: [PATCH 511/647] 36 Sieger ausgabe 2 --- src/main/c/TicTacToe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 0b8c6a1..a67fb06 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -139,6 +139,9 @@ int mainx() { if (Winner(Feld) == 1) { printf("Der Sieger ist %s", Spieler1); } + else if (Winner(Feld) == 2) { + printf("Der Sieger ist %s", Spieler2); + } printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } From 9f34744a5d4a08853ffc5d4b8a99b8d2c86e2384 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:17:19 +0100 Subject: [PATCH 512/647] 37 Punktestand --- src/main/c/TicTacToe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index a67fb06..4b50623 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -106,9 +106,12 @@ int mainx() { int col; char Feld[3][3]; char Spieler1[50], Spieler2[50]; + int Punkte1 = 0, Punkte2 = 0; char Nochmal[50] = { "Weiter" }; - printf("Name der Spieler\[Spieler 1 Spieler2]\n"); - scanf("%s %s", Spieler1, Spieler2); + printf("Name Spieler 1:"); + scanf("%s", Spieler1); + printf("Name Spieler 2:"); + scanf("%s", Spieler2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); @@ -138,10 +141,13 @@ int mainx() { Bild(Feld); if (Winner(Feld) == 1) { printf("Der Sieger ist %s", Spieler1); + Punkte1++; } else if (Winner(Feld) == 2) { printf("Der Sieger ist %s", Spieler2); + Punkte2++; } + printf("%s - %d, %s - %d\n", Spieler1, Punkte1, Spieler2, Punkte2); printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); scanf("%s", Nochmal); } From eb75a41c438080f43140170368beeb1ef968d2b6 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:18:07 +0100 Subject: [PATCH 513/647] 38 Entscheidung Zeichen --- src/main/c/TicTacToe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 4b50623..7c7075a 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -107,14 +107,19 @@ int mainx() { char Feld[3][3]; char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; + char Name1[50], Name2[50]; char Nochmal[50] = { "Weiter" }; printf("Name Spieler 1:"); - scanf("%s", Spieler1); + scanf("%s", Name1); printf("Name Spieler 2:"); - scanf("%s", Spieler2); + scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Zaehler = 1; Brett(Feld); + printf("%s, Was willst du sein, X oder O: ", Name1); + scanf("%s", Spieler1); + strcpy(Spieler2, (Spieler1[0] == 'X') ? Name2 : Name1); + strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(Feld) == 9) { From 8d16af038dd340830d349940940178ab6e0aabeb Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:19:33 +0100 Subject: [PATCH 514/647] 39 Auswahl begrenzt --- src/main/c/TicTacToe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 7c7075a..d92fbbf 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -118,6 +118,10 @@ int mainx() { Brett(Feld); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); + if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { + printf("Ungültige Auswahl. Das Spiel wird beendet.\n"); + break; + } strcpy(Spieler2, (Spieler1[0] == 'X') ? Name2 : Name1); strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); From 24c744feed1529032914595f005ce75a30fb2008 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:20:34 +0100 Subject: [PATCH 515/647] 40 Farbe definieren --- src/main/c/TicTacToe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index d92fbbf..a01df1b 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -3,6 +3,11 @@ #include #include +#define ANSI_COLOR_BRIGHT_RED "\x1b[91m" +#define ANSI_COLOR_BRIGHT_CYAN "\x1b[96m" +#define ANSI_COLOR_BRIGHT_YELLOW "\x1b[93m" +#define ANSI_COLOR_RESET "\x1b[0m" + int Zaehler = 1; // Funktion, um das Spielfeld zu initialisieren void Brett(char Feld[3][3]) { From 11e8af8e1e3fc87e8e74a4403fa8b09690098367 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:21:29 +0100 Subject: [PATCH 516/647] =?UTF-8?q?41=20Text=20einf=C3=A4rben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/TicTacToe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index a01df1b..c1f9a33 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -25,7 +25,15 @@ void Bild(char Feld[3][3]) { #endif for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - printf("%c ", Feld[i][j]); + if (Feld[i][j] == '_') { + printf(ANSI_COLOR_BRIGHT_YELLOW"%c "ANSI_COLOR_RESET, Feld[i][j]); + } + else if (Feld[i][j] == 'X') { + printf(ANSI_COLOR_BRIGHT_CYAN"%c "ANSI_COLOR_RESET, Feld[i][j]); + } + else { + printf(ANSI_COLOR_BRIGHT_RED"%c "ANSI_COLOR_RESET, Feld[i][j]); + } } printf("\n"); } From 5a8d0728f2c73ee0c5b5f97e879bb6a6ac8d3eb3 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:24:04 +0100 Subject: [PATCH 517/647] refactoring: Zaehler -> Runde --- src/main/c/TicTacToe.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index c1f9a33..8bbd2da 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -8,7 +8,7 @@ #define ANSI_COLOR_BRIGHT_YELLOW "\x1b[93m" #define ANSI_COLOR_RESET "\x1b[0m" -int Zaehler = 1; +int Runde = 1; // Funktion, um das Spielfeld zu initialisieren void Brett(char Feld[3][3]) { for (int i = 0; i < 3; i++) { @@ -80,8 +80,8 @@ int Winner(char Feld[3][3]) { return 0; } void Zuege(char Feld[3][3], int row, int col) { - if (Zaehler < 10) { - if (Zaehler % 2 == 0) { + if (Runde < 10) { + if (Runde % 2 == 0) { if (Feld[row][col] == '_') { Feld[row][col] = 'O'; } @@ -127,7 +127,7 @@ int mainx() { printf("Name Spieler 2:"); scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { - Zaehler = 1; + Runde = 1; Brett(Feld); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); @@ -139,9 +139,8 @@ int mainx() { strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(Feld) == 9) { - Bild(Feld); - if (Zaehler % 2 != 0) { + if (Runde % 2 != 0) { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } else printf("Spieler 2 gebe das Feld an wo du dein O setzen willst.\n"); @@ -158,7 +157,7 @@ int mainx() { col -= 1; } Zuege(Feld, row, col); - Zaehler++; + Runde++; } Bild(Feld); if (Winner(Feld) == 1) { From 748bd6725ff4298015e79d213158aa0413b2761f Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:26:21 +0100 Subject: [PATCH 518/647] refactoring: Brett -> initializeBoard --- src/main/c/TicTacToe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 8bbd2da..517be63 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -10,7 +10,7 @@ int Runde = 1; // Funktion, um das Spielfeld zu initialisieren -void Brett(char Feld[3][3]) { +void initializeBoard(char Feld[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Feld[i][j] = '_'; @@ -38,6 +38,7 @@ void Bild(char Feld[3][3]) { printf("\n"); } } + int Winner(char Feld[3][3]) { // Überprüfen Sieg // Überprüfen Reihen @@ -128,7 +129,7 @@ int mainx() { scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Runde = 1; - Brett(Feld); + initializeBoard(Feld); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { From b51cded6d699907c147152a8ff0f9c99440401e4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:27:07 +0100 Subject: [PATCH 519/647] refactoring: Feld -> board --- src/main/c/TicTacToe.c | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 517be63..2c87b2a 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -9,15 +9,15 @@ #define ANSI_COLOR_RESET "\x1b[0m" int Runde = 1; -// Funktion, um das Spielfeld zu initialisieren -void initializeBoard(char Feld[3][3]) { +// Funktion, um das Spielboard zu initialisieren +void initializeBoard(char board[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - Feld[i][j] = '_'; + board[i][j] = '_'; } } } -void Bild(char Feld[3][3]) { +void Bild(char board[3][3]) { #ifdef _WIN32 system("cls"); #else @@ -25,26 +25,26 @@ void Bild(char Feld[3][3]) { #endif for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - if (Feld[i][j] == '_') { - printf(ANSI_COLOR_BRIGHT_YELLOW"%c "ANSI_COLOR_RESET, Feld[i][j]); + if (board[i][j] == '_') { + printf(ANSI_COLOR_BRIGHT_YELLOW"%c "ANSI_COLOR_RESET, board[i][j]); } - else if (Feld[i][j] == 'X') { - printf(ANSI_COLOR_BRIGHT_CYAN"%c "ANSI_COLOR_RESET, Feld[i][j]); + else if (board[i][j] == 'X') { + printf(ANSI_COLOR_BRIGHT_CYAN"%c "ANSI_COLOR_RESET, board[i][j]); } else { - printf(ANSI_COLOR_BRIGHT_RED"%c "ANSI_COLOR_RESET, Feld[i][j]); + printf(ANSI_COLOR_BRIGHT_RED"%c "ANSI_COLOR_RESET, board[i][j]); } } printf("\n"); } } -int Winner(char Feld[3][3]) { +int Winner(char board[3][3]) { // Überprüfen Sieg // Überprüfen Reihen for (int i = 0; i < 3; i++) { - if (Feld[i][0] == Feld[i][1] && Feld[i][1] == Feld[i][2] && Feld[i][0] != '_') { - if (Feld[i][0] == 'X') { + if (board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != '_') { + if (board[i][0] == 'X') { return 1; } else return 2; @@ -52,17 +52,17 @@ int Winner(char Feld[3][3]) { } // Überprüfen Spalten for (int j = 0; j < 3; j++) { - if (Feld[0][j] == Feld[1][j] && Feld[1][j] == Feld[2][j] && Feld[0][j] != '_') { - if (Feld[0][j] == 'X') { + if (board[0][j] == board[1][j] && board[1][j] == board[2][j] && board[0][j] != '_') { + if (board[0][j] == 'X') { return 1; } else return 2; } } // Überprüfen Diagonalen - if ((Feld[0][0] == Feld[1][1] && Feld[1][1] == Feld[2][2]) || (Feld[0][2] == Feld[1][1] && Feld[1][1] == Feld[2][0])) { - if (Feld[1][1] != '_') { - if (Feld[1][1] == 'X') { + if ((board[0][0] == board[1][1] && board[1][1] == board[2][2]) || (board[0][2] == board[1][1] && board[1][1] == board[2][0])) { + if (board[1][1] != '_') { + if (board[1][1] == 'X') { return 1; } else return 2; @@ -71,7 +71,7 @@ int Winner(char Feld[3][3]) { //Überprüfe Runde for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { - if (Feld[k][l] == '_') { + if (board[k][l] == '_') { return 9; } } @@ -80,11 +80,11 @@ int Winner(char Feld[3][3]) { printf("Es ist ein Unendschieden\n"); return 0; } -void Zuege(char Feld[3][3], int row, int col) { +void Zuege(char board[3][3], int row, int col) { if (Runde < 10) { if (Runde % 2 == 0) { - if (Feld[row][col] == '_') { - Feld[row][col] = 'O'; + if (board[row][col] == '_') { + board[row][col] = 'O'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); @@ -94,12 +94,12 @@ void Zuege(char Feld[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(Feld, row, col); + Zuege(board, row, col); } } else { - if (Feld[row][col] == '_') { - Feld[row][col] = 'X'; + if (board[row][col] == '_') { + board[row][col] = 'X'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); @@ -109,7 +109,7 @@ void Zuege(char Feld[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(Feld, row, col); + Zuege(board, row, col); } } } @@ -118,7 +118,7 @@ void Zuege(char Feld[3][3], int row, int col) { int mainx() { int row; int col; - char Feld[3][3]; + char board[3][3]; char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; char Name1[50], Name2[50]; @@ -129,7 +129,7 @@ int mainx() { scanf("%s", Name2); while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { Runde = 1; - initializeBoard(Feld); + initializeBoard(board); printf("%s, Was willst du sein, X oder O: ", Name1); scanf("%s", Spieler1); if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { @@ -139,8 +139,8 @@ int mainx() { strcpy(Spieler2, (Spieler1[0] == 'X') ? Name2 : Name1); strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); - while (Winner(Feld) == 9) { - Bild(Feld); + while (Winner(board) == 9) { + Bild(board); if (Runde % 2 != 0) { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } @@ -157,15 +157,15 @@ int mainx() { row -= 1; //Für Index eins kleiner col -= 1; } - Zuege(Feld, row, col); + Zuege(board, row, col); Runde++; } - Bild(Feld); - if (Winner(Feld) == 1) { + Bild(board); + if (Winner(board) == 1) { printf("Der Sieger ist %s", Spieler1); Punkte1++; } - else if (Winner(Feld) == 2) { + else if (Winner(board) == 2) { printf("Der Sieger ist %s", Spieler2); Punkte2++; } From dac05682d0ea2b7e0a770fefc810538f9f812971 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:27:50 +0100 Subject: [PATCH 520/647] refactoring: Bild -> displayBoard --- src/main/c/TicTacToe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 2c87b2a..422b99b 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -17,7 +17,7 @@ void initializeBoard(char board[3][3]) { } } } -void Bild(char board[3][3]) { +void displayBoard(char board[3][3]) { #ifdef _WIN32 system("cls"); #else @@ -140,7 +140,7 @@ int mainx() { strcpy(Spieler1, (Spieler1[0] == 'X') ? Name1 : Name2); printf("\nWillkommen %s und %s. Eure Runde Beginnt jetzt.", Spieler1, Spieler2); while (Winner(board) == 9) { - Bild(board); + displayBoard(board); if (Runde % 2 != 0) { printf("Spieler 1 gebe das Feld an wo du dein X setzen willst.\n"); } @@ -160,7 +160,7 @@ int mainx() { Zuege(board, row, col); Runde++; } - Bild(board); + displayBoard(board); if (Winner(board) == 1) { printf("Der Sieger ist %s", Spieler1); Punkte1++; From ba9ee7b7d3aa952416a88bd38c1fa07c0623ce43 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:28:41 +0100 Subject: [PATCH 521/647] refactoring: Zuege -> makeMove --- src/main/c/TicTacToe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 422b99b..01f704b 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -80,7 +80,7 @@ int Winner(char board[3][3]) { printf("Es ist ein Unendschieden\n"); return 0; } -void Zuege(char board[3][3], int row, int col) { +void makeMove(char board[3][3], int row, int col) { if (Runde < 10) { if (Runde % 2 == 0) { if (board[row][col] == '_') { @@ -94,7 +94,7 @@ void Zuege(char board[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(board, row, col); + makeMove(board, row, col); } } else { @@ -109,7 +109,7 @@ void Zuege(char board[3][3], int row, int col) { scanf("%d", &col); row -= 1; col -= 1; - Zuege(board, row, col); + makeMove(board, row, col); } } } @@ -157,7 +157,7 @@ int mainx() { row -= 1; //Für Index eins kleiner col -= 1; } - Zuege(board, row, col); + makeMove(board, row, col); Runde++; } displayBoard(board); From 4382acd987b94ba744c905b0d6d0bd2f779a210f Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:30:17 +0100 Subject: [PATCH 522/647] refactoring: Nochmal -> Ende --- src/main/c/TicTacToe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 01f704b..6ee5c0e 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -122,12 +122,12 @@ int mainx() { char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; char Name1[50], Name2[50]; - char Nochmal[50] = { "Weiter" }; + char Ende[50] = { "Weiter" }; printf("Name Spieler 1:"); scanf("%s", Name1); printf("Name Spieler 2:"); scanf("%s", Name2); - while (Nochmal[0] == 'W' || Nochmal[0] == 'w') { + while (Ende[0] == 'W' || Ende[0] == 'w') { Runde = 1; initializeBoard(board); printf("%s, Was willst du sein, X oder O: ", Name1); @@ -171,7 +171,7 @@ int mainx() { } printf("%s - %d, %s - %d\n", Spieler1, Punkte1, Spieler2, Punkte2); printf("Wollt ihr weiter spielen?\n[Weiter]\n[Ende]\n"); - scanf("%s", Nochmal); + scanf("%s", Ende); } return 0; } \ No newline at end of file From 5c7637699a5fdf8debdd0379fdbabc96f16ca509 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:31:44 +0100 Subject: [PATCH 523/647] refactoring: Main Name --- src/main/c/TicTacToe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index 6ee5c0e..bdcfcc4 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -115,7 +115,7 @@ void makeMove(char board[3][3], int row, int col) { } } // Hauptfunktion zum Spielen des Tic Tac Toe-Spiels -int mainx() { +int TicTacToe_ausfuehren() { int row; int col; char board[3][3]; From 5a92a2beba10775598de2433609a4998f8d9e51b Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:32:23 +0100 Subject: [PATCH 524/647] refactoring: col -> column --- src/main/c/TicTacToe.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index bdcfcc4..baf3643 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -80,36 +80,36 @@ int Winner(char board[3][3]) { printf("Es ist ein Unendschieden\n"); return 0; } -void makeMove(char board[3][3], int row, int col) { +void makeMove(char board[3][3], int row, int column) { if (Runde < 10) { if (Runde % 2 == 0) { - if (board[row][col] == '_') { - board[row][col] = 'O'; + if (board[row][column] == '_') { + board[row][column] = 'O'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); printf("Reihe:"); scanf("%d", &row); printf("Spalte:"); - scanf("%d", &col); + scanf("%d", &column); row -= 1; - col -= 1; - makeMove(board, row, col); + column -= 1; + makeMove(board, row, column); } } else { - if (board[row][col] == '_') { - board[row][col] = 'X'; + if (board[row][column] == '_') { + board[row][column] = 'X'; } else { printf("Das Feld ist schon besetzt. Gib ein anderes Feld ein:\n"); printf("Reihe:"); scanf("%d", &row); printf("Spalte:"); - scanf("%d", &col); + scanf("%d", &column); row -= 1; - col -= 1; - makeMove(board, row, col); + column -= 1; + makeMove(board, row, column); } } } @@ -117,7 +117,7 @@ void makeMove(char board[3][3], int row, int col) { // Hauptfunktion zum Spielen des Tic Tac Toe-Spiels int TicTacToe_ausfuehren() { int row; - int col; + int column; char board[3][3]; char Spieler1[50], Spieler2[50]; int Punkte1 = 0, Punkte2 = 0; @@ -148,16 +148,16 @@ int TicTacToe_ausfuehren() { printf("Reihe:"); scanf("%d", &row); printf("Spalte:"); - scanf("%d", &col); + scanf("%d", &column); row -= 1; - col -= 1; - if (row > 3 || col > 3) { + column -= 1; + if (row > 3 || column > 3) { printf("Das ist nicht mehr im Feld. Versuch es nochmal:"); - scanf("%d %d", &row, &col); + scanf("%d %d", &row, &column); row -= 1; //Für Index eins kleiner - col -= 1; + column -= 1; } - makeMove(board, row, col); + makeMove(board, row, column); Runde++; } displayBoard(board); From a29bf2b398554936c865132ef830837d8c1c4215 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:34:18 +0100 Subject: [PATCH 525/647] refactoring: print rename --- src/main/c/TicTacToe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/c/TicTacToe.c b/src/main/c/TicTacToe.c index baf3643..8ce9661 100644 --- a/src/main/c/TicTacToe.c +++ b/src/main/c/TicTacToe.c @@ -130,7 +130,7 @@ int TicTacToe_ausfuehren() { while (Ende[0] == 'W' || Ende[0] == 'w') { Runde = 1; initializeBoard(board); - printf("%s, Was willst du sein, X oder O: ", Name1); + printf("%s, Was willst du sein?\n[X/O]\n", Name1); scanf("%s", Spieler1); if (Spieler1[0] != 'X' && Spieler1[0] != 'O') { printf("Ungültige Auswahl. Das Spiel wird beendet.\n"); From e1542fab13be58e9751852d4fd54ecd02bbeaa5e Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 18:35:57 +0100 Subject: [PATCH 526/647] Header aktualisiert --- src/main/c/TicTacToe.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/TicTacToe.h b/src/main/c/TicTacToe.h index 1e04a7d..645d5c3 100644 --- a/src/main/c/TicTacToe.h +++ b/src/main/c/TicTacToe.h @@ -1,7 +1,11 @@ #ifndef TICTACTOE_H #define TICTACTOE_H +void initializeBoard(char board[3][3]); +void displayBoard(char board[3][3]); int Winner(char board[3][3]); +void makeMove(char board[3][3], int row, int col); +int TicTacToe_ausfuehren(); #endif From 510d7df01f0eb3d73a663f208ee64fc7cd0759ee Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:00:46 +0100 Subject: [PATCH 527/647] =?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 9ffe61a..3591d46 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -2,4 +2,8 @@ #include #include #include -#include \ No newline at end of file +#include + +void protokoll(); + +void protokoll(){} \ No newline at end of file From 353ca94fe162b8e220df3e48786487775680fab9 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:01:27 +0100 Subject: [PATCH 528/647] =?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 3591d46..a9148fe 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -5,5 +5,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 d052a17ca42c48ee49742a2dd91aed9e2e2e98bd Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:02:06 +0100 Subject: [PATCH 529/647] =?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 a9148fe..f652182 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -6,13 +6,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 22a9f74ea214aba89de3bd8cd4234a075e5edff4 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:02:51 +0100 Subject: [PATCH 530/647] 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 f652182..265e05f 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -20,5 +20,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 d43ff1a8ef3e8322912de0caf3b581fbfec70bb6 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:05:36 +0100 Subject: [PATCH 531/647] =?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 265e05f..8e3c096 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -7,10 +7,12 @@ void protokoll(); void clear_screen(); void willkommen(); +int namePruefen(); void protokoll(){ clear_screen(); willkommen(); + namePruefen(); } void clear_screen() { @@ -24,4 +26,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 85590d1c6f9448ce9db9be4268268ac011b02db6 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:06:39 +0100 Subject: [PATCH 532/647] =?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 8e3c096..e24e633 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -8,6 +8,7 @@ void protokoll(); void clear_screen(); void willkommen(); int namePruefen(); +void nameWaehlen(); void protokoll(){ clear_screen(); @@ -54,4 +55,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 26f405da61bcc2fde943e6ed5d2d78257f7f9b8f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:07:51 +0100 Subject: [PATCH 533/647] 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 e24e633..fd60771 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -25,6 +25,7 @@ void clear_screen() { void willkommen(){ char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; + printf("%s", ENTERtxt); getchar(); } @@ -50,6 +51,8 @@ int namePruefen() { fclose(fp); return 0; } else { + printf("Sieht aus, als haettest du noch keinen Namen :(\n"); + nameWaehlen(); fclose(fp); return 0; } @@ -64,6 +67,7 @@ void nameWaehlen(){ fp = fopen("hangman.txt", "w"); clear_screen(); // + printf("Geben Sie den Namen ein: "); scanf("%s", name); @@ -72,6 +76,4 @@ void nameWaehlen(){ fprintf(fp, "%s", KonfDatei); fclose(fp); - - startauswahl(); } \ No newline at end of file From 8a44dfbf312ef0f5a30e6a61b39a3fd6ad8b3e74 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:08:33 +0100 Subject: [PATCH 534/647] =?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 fd60771..4107b04 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -9,11 +9,13 @@ void clear_screen(); void willkommen(); int namePruefen(); void nameWaehlen(); +void startauswahl(); void protokoll(){ clear_screen(); willkommen(); namePruefen(); + startauswahl(); } void clear_screen() { @@ -76,4 +78,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 39108b5b8a56800661df1b0e38f47fa286bf37c7 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:09:07 +0100 Subject: [PATCH 535/647] 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 4107b04..8b0753c 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -81,6 +81,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 932fd3ad86da58e6505e0d0ebe01c88498746561 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:09:52 +0100 Subject: [PATCH 536/647] =?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 8b0753c..c59d9b1 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -10,6 +10,7 @@ void willkommen(); int namePruefen(); void nameWaehlen(); void startauswahl(); +void nameAusgeben(); void protokoll(){ clear_screen(); @@ -97,4 +98,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 9dd852c9f2037692feec60e814eabecca4716df2 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:10:35 +0100 Subject: [PATCH 537/647] =?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 c59d9b1..b9cd326 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -88,6 +88,7 @@ void startauswahl() { clear_screen(); // printf("Willkommen "); + nameAusgeben(); printf("[1] Spielen\n[2] Namen aendern\n"); scanf("%d", &auswahl); From 31420a642f930cfb22dd5aa13dcbc030b0d0fa1f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:11:16 +0100 Subject: [PATCH 538/647] 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 b9cd326..7c7939a 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -11,6 +11,7 @@ int namePruefen(); void nameWaehlen(); void startauswahl(); void nameAusgeben(); +void levelauswahl(); void protokoll(){ clear_screen(); @@ -86,7 +87,7 @@ void startauswahl() { int modus; clear_screen(); // - + printf("Willkommen "); nameAusgeben(); printf("[1] Spielen\n[2] Namen aendern\n"); @@ -129,5 +130,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 694c7c34cd85c5f4d2539819cb9f2aa066359a64 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:21:14 +0100 Subject: [PATCH 539/647] =?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 7c7939a..6a54692 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -29,7 +29,7 @@ void clear_screen() { void willkommen(){ char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; - + printf("%s", ENTERtxt); getchar(); } @@ -71,7 +71,7 @@ void nameWaehlen(){ fp = fopen("hangman.txt", "w"); clear_screen(); // - + printf("Geben Sie den Namen ein: "); scanf("%s", name); @@ -94,7 +94,7 @@ void startauswahl() { scanf("%d", &auswahl); if(auswahl == 1){ - //levelauswahl + levelauswahl(); } else if (auswahl == 2){ nameWaehlen(); } else { @@ -154,6 +154,5 @@ void levelauswahl(){ levelstr[2] = '\0'; level = atoi(levelstr); //hauptspiel mit dem Level starten - fclose(fp); } \ No newline at end of file From 7f25efa9ad1399d80271a97f6503fabc94408606 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:21:58 +0100 Subject: [PATCH 540/647] 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 6a54692..bada2bb 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -12,6 +12,7 @@ void nameWaehlen(); void startauswahl(); void nameAusgeben(); void levelauswahl(); +void hauptSpiel(int level); void protokoll(){ clear_screen(); @@ -155,4 +156,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 073381aed8ffa31f13178d5f4b1cc9481d265665 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:23:00 +0100 Subject: [PATCH 541/647] =?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 bada2bb..04fcdd1 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -13,6 +13,7 @@ void startauswahl(); void nameAusgeben(); void levelauswahl(); void hauptSpiel(int level); +void draw_hangman(int attempts); void protokoll(){ clear_screen(); @@ -173,4 +174,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 0402615f5b891178b50979ee596c96589cbffed3 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:24:06 +0100 Subject: [PATCH 542/647] =?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 04fcdd1..1182223 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -14,6 +14,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(); @@ -248,4 +249,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 d750dec8fc73a73550e2455ac3f4c83b3008de0f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:25:15 +0100 Subject: [PATCH 543/647] 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 1182223..2c6f2ce 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -257,4 +257,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 f1ae7bb8d6ab281ccb0c5bc514610ac38fb40403 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:26:26 +0100 Subject: [PATCH 544/647] =?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 2c6f2ce..4df1645 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -15,6 +15,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(); @@ -259,4 +260,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 5a7f1d2a59adb62e530ffd67b746e176463561f3 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:28:30 +0100 Subject: [PATCH 545/647] 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 4df1645..0c3bb8d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -16,6 +16,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(); @@ -267,4 +268,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 f6a9e8cf77602a032125ba14565ea3c6b51bacab Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:41:49 +0100 Subject: [PATCH 546/647] =?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 0c3bb8d..f21347f 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -170,9 +170,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 3e5242d2fcb27eedc931dfc9afde45c43038e3fe Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:42:57 +0100 Subject: [PATCH 547/647] 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 f21347f..edcf466 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -17,6 +17,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(); @@ -291,4 +292,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 3406c5864994c15949eec5a03783501f4507fa9b Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:43:50 +0100 Subject: [PATCH 548/647] 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 edcf466..27be097 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -300,5 +300,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 6d2206f90c366d16ae8bb37e3fe98e3d4b85e7da Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:44:46 +0100 Subject: [PATCH 549/647] 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 27be097..f395ff9 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -18,6 +18,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(); @@ -305,4 +306,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 0243b52d671f4ab09c6f807f0e32d77947e30032 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:46:12 +0100 Subject: [PATCH 550/647] 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 f395ff9..24350d3 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -175,10 +175,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 d759ec3bef30c6262ccc3f3bd285559797541eaf Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:48:37 +0100 Subject: [PATCH 551/647] 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 24350d3..77be75b 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -19,6 +19,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(); @@ -175,7 +176,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(); @@ -186,7 +187,7 @@ void hauptSpiel(int level){ else { attempts++; } - //gewonnen erweitern + won = has_won(secret_word, guessed_letters); } } @@ -324,4 +325,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 ab24d1d021e67b6ab2d7e17101a0ef0365f87e2e Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:49:35 +0100 Subject: [PATCH 552/647] 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 77be75b..333cc1c 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -20,6 +20,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(); @@ -341,4 +342,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 fa15309073e88817e7db3f9c4687fca5719b336b Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:50:31 +0100 Subject: [PATCH 553/647] 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 333cc1c..e356748 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -190,6 +190,9 @@ void hauptSpiel(int level){ } won = has_won(secret_word, guessed_letters); } + if (won == 1){ + level_plus(); + } } void draw_hangman(int attempts) { From f7b1e6e51c6b34ef214a62d8fd3971bc927f6319 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:51:31 +0100 Subject: [PATCH 554/647] 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 e356748..c79702d 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -21,6 +21,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(); @@ -38,7 +39,7 @@ void clear_screen() { void willkommen(){ char ENTERtxt[] = {"-Druecke ENTER zum starten-\n"}; - + overlay(); printf("%s", ENTERtxt); getchar(); } @@ -80,7 +81,7 @@ void nameWaehlen(){ fp = fopen("hangman.txt", "w"); clear_screen(); // - + overlay(); printf("Geben Sie den Namen ein: "); scanf("%s", name); @@ -96,7 +97,7 @@ void startauswahl() { int modus; clear_screen(); // - + overlay(); printf("Willkommen "); nameAusgeben(); printf("[1] Spielen\n[2] Namen aendern\n"); @@ -149,7 +150,7 @@ void levelauswahl(){ int i = 0; clear_screen(); // - + overlay(); FILE *fp = NULL; fp = fopen("hangman.txt", "r"); @@ -162,7 +163,7 @@ void levelauswahl(){ levelstr[1] = KonfDatei[i-1]; levelstr[2] = '\0'; level = atoi(levelstr); - //hauptspiel mit dem Level starten + hauptSpiel(level); fclose(fp); } @@ -372,4 +373,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 bca29a31ccfd3bfbe09e6d7b9325ca5f5b70906f Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:44:41 +0100 Subject: [PATCH 555/647] 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 c79702d..8bc65a6 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -13,7 +13,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 69feae747d367f7852f8d08bda10474e32fa9cad Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:45:04 +0100 Subject: [PATCH 556/647] 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 8bc65a6..463ac1b 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -169,7 +169,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"; @@ -178,8 +178,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); @@ -187,7 +187,7 @@ void hauptSpiel(int level){ add_guessed_letter(guessed_letters, guessed_letter); } else { - attempts++; + versuche++; } won = has_won(secret_word, guessed_letters); } @@ -196,12 +196,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 0a382d9b9f9f884e6a1c3fbca6605e779f37585e Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:46:41 +0100 Subject: [PATCH 557/647] 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 463ac1b..cd929fc 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -13,7 +13,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); @@ -179,7 +179,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); @@ -196,7 +196,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 2c51cf5cbe5702ff085e61fcd71f4b7e9d8a9380 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:48:36 +0100 Subject: [PATCH 558/647] 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 cd929fc..ac6e736 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -14,7 +14,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]); @@ -184,7 +184,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++; @@ -270,7 +270,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 f6eaef118da75c080b0e8e7852a529696c652b1a Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:50:24 +0100 Subject: [PATCH 559/647] 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 ac6e736..0d77b67 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -16,7 +16,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]); @@ -176,7 +176,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); @@ -287,7 +287,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 ccaadd9d8804b6c0a380c3bf806c7f2cfec5775d Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:51:33 +0100 Subject: [PATCH 560/647] 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 0d77b67..20dd472 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -17,7 +17,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(); @@ -180,7 +180,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){ @@ -310,7 +310,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 a3a6b16e8d5f3c70409b82ebcd377f885db5b742 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:53:07 +0100 Subject: [PATCH 561/647] 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 20dd472..c579ebe 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -18,7 +18,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(); @@ -182,7 +182,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); } @@ -323,7 +323,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 07439b6684c13396a9efbed1002d8e48b2ff24be Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:54:13 +0100 Subject: [PATCH 562/647] 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 c579ebe..5cad90c 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -19,7 +19,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(); @@ -189,7 +189,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(); @@ -332,7 +332,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 9b5afc9b755c0636da27645ce59041d2a0ae3ab1 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 09:56:20 +0100 Subject: [PATCH 563/647] 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 5cad90c..7ec5e3f 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -117,7 +117,7 @@ void nameAusgeben(){ char name[50]; int i = 5; int zaehler = 0; - int nullt; + int nullterminante; FILE *fp = NULL; fp = fopen("hangman.txt", "r"); @@ -127,7 +127,7 @@ void nameAusgeben(){ zaehler++; i++; } - nullt = zaehler; + nullterminante = zaehler; while(zaehler != 0){ name[--zaehler] = KonfDatei[--i]; } @@ -137,7 +137,7 @@ void nameAusgeben(){ i++; } - name[nullt] = '\0'; + name[nullterminante] = '\0'; printf("%s\n", name); fclose(fp); From 47151922b976e6440d617aee3d6a6f0c17891ede Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:05:23 +0100 Subject: [PATCH 564/647] 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 7ec5e3f..5c0f15f 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -350,7 +350,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; @@ -360,10 +360,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 bdb409f8fc9b395efa86fdb1f7108d4813663fbb Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:06:15 +0100 Subject: [PATCH 565/647] 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 5c0f15f..73cac6b 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -376,7 +376,7 @@ void level_plus(){ } int overlay(){ - char hangmanArt[10][41] = { + char galgen_overlay[10][41] = { " _______ ", " | | ", " | ", @@ -391,7 +391,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 016f5e1f6126295622d38df6b592b5b390c9aae3 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:23:37 +0100 Subject: [PATCH 566/647] 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 ce099ef475d1c92944a24444ad497b1df947e485 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:25:30 +0100 Subject: [PATCH 567/647] 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 95b5e58b4fdcbf10add05b516b43d7cb739c2d72 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:26:29 +0100 Subject: [PATCH 568/647] 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 3387bf65a13331ccc91fdb9807ae94829848ecbc Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:27:13 +0100 Subject: [PATCH 569/647] 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 e3d135f247e38a1882071cbb257cadd2026317a6 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:28:49 +0100 Subject: [PATCH 570/647] 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 c9db18d9098d27a30a96c661e69bc98dd5b2d390 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:29:44 +0100 Subject: [PATCH 571/647] 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 f4303334b28cc52a968e20382028058505ed5122 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:30:49 +0100 Subject: [PATCH 572/647] 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 c20d4764254936fa76e8d296e0a0ec1f263d1bbc Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:31:44 +0100 Subject: [PATCH 573/647] 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 03a793ed78831f3f4b84f00165b01702e45ad1e0 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:32:22 +0100 Subject: [PATCH 574/647] 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 9d834b4b44ada8b421a7aa8454affb01b9c63dd1 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:32:57 +0100 Subject: [PATCH 575/647] 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 9e966772314602ec117061e5b73fda300ec9cf06 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:33:23 +0100 Subject: [PATCH 576/647] 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 46941fe4a13450370b9030684989d2ed9c49c039 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Wed, 7 Feb 2024 10:33:53 +0100 Subject: [PATCH 577/647] 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 9a2b3df87b74c0700c658d872948c401923dbe1f Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:19:55 +0100 Subject: [PATCH 578/647] 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 a7f04e3ddf978d49652187aaa1c16f9a2cf8b061 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:20:41 +0100 Subject: [PATCH 579/647] =?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 14084fe87ce8c6478162552e3bc08c85e2d9105e Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:21:21 +0100 Subject: [PATCH 580/647] 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 d0e656321d3e51ce257838fa7606987f1236ef06 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:22:18 +0100 Subject: [PATCH 581/647] =?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 7524f5481acf629305cb0df9b4d434d74d57d5c6 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:23:13 +0100 Subject: [PATCH 582/647] =?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 e15f847c0c2d9f33a0c10ba7a25574d7c8f72485 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:24:00 +0100 Subject: [PATCH 583/647] =?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 d41c7022ffe4a6903b2b7d6197481f8761e31902 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:24:55 +0100 Subject: [PATCH 584/647] =?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 3fafb6fab8ca2622835132d4700b376bee19236f Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:25:38 +0100 Subject: [PATCH 585/647] =?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 def4997083733f8afdb181857b8426d736b4a622 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:26:24 +0100 Subject: [PATCH 586/647] =?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 9cb1545dee3668a0ab39e6c2ff2e9ff65baf39ce Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:27:10 +0100 Subject: [PATCH 587/647] =?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 f989469a0d7fd0b87babb36268216c6751b6d2e2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:27:57 +0100 Subject: [PATCH 588/647] =?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 3763f76b86d8715901ab051eae8e6931863a0c9b Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:29:00 +0100 Subject: [PATCH 589/647] =?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 ae247167338dbef820554d16bac22c2bd07970de Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:30:22 +0100 Subject: [PATCH 590/647] =?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 6245fcd7652cb3e834df19f9b9bdfc16bae5b911 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:31:02 +0100 Subject: [PATCH 591/647] =?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 4834a8555373e37b117cd328020cb397ad1442c4 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:31:44 +0100 Subject: [PATCH 592/647] =?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 50e43bcb484a5b203b02e3cd68e291b46ade5832 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:32:48 +0100 Subject: [PATCH 593/647] =?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 034f4dcc4477840604807091cdccbf1af03ae18d Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:33:37 +0100 Subject: [PATCH 594/647] =?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 0232b749cdecb466092fcb5b65c0210a93caf363 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:34:40 +0100 Subject: [PATCH 595/647] 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 d9e40f42ccf38a2a8983fde5bba046a0858ed91c Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:35:23 +0100 Subject: [PATCH 596/647] 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 5e9a0502f3d8a46a014753f9d3e99a617a0f3675 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:36:25 +0100 Subject: [PATCH 597/647] 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 5d3e06d2a76fe89a51238b06f71c29aa23f75427 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:37:13 +0100 Subject: [PATCH 598/647] 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 b9578625dab5f0c0ae75882a39a5d862e4218002 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:37:48 +0100 Subject: [PATCH 599/647] 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 2abb15608c7ea1c3a7dc5257f76731d5b0a56d8b Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:38:30 +0100 Subject: [PATCH 600/647] 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 4b07fb4fd16aab8144fe115b80c178bb1fa14c60 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:39:09 +0100 Subject: [PATCH 601/647] 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 0ee87c82d7ca7fe89a207896285fdc6e31798940 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:39:53 +0100 Subject: [PATCH 602/647] 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 c275d655309217a9350f564b9999c692a090de98 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:40:29 +0100 Subject: [PATCH 603/647] 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 034fac69d0a8ddb14f011c4452fa704c4d0b53dd Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:41:14 +0100 Subject: [PATCH 604/647] 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 f86a5cddc2e7e80623a8bcc6c9be966eff73ecee Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:41:49 +0100 Subject: [PATCH 605/647] 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 8863c50f1e391854c8444425cf21adb9708d6ec9 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:42:23 +0100 Subject: [PATCH 606/647] 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 a7865207c65544ed20fd73707b3968d75576f867 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:43:04 +0100 Subject: [PATCH 607/647] 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 b344bb75bdea7cc347645dacf08c19fd85d1cb85 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:43:42 +0100 Subject: [PATCH 608/647] 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 aa1ec16a6fc91eb58639fb74ffbcf41a969ee741 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:44:31 +0100 Subject: [PATCH 609/647] 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 93c78493eddc36e07a43bb26695e067641935ffc Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:46:40 +0100 Subject: [PATCH 610/647] 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 def2d89ebe986cb74170eb816be1cfbd200e3c96 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:47:16 +0100 Subject: [PATCH 611/647] 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 0a4dc720ae69bf266ff72c94b1e80221315b15c2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:47:52 +0100 Subject: [PATCH 612/647] 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 d38154f1c509140a246835407d4fc343a4da9ab2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:55:52 +0100 Subject: [PATCH 613/647] test_dropPiece_ValidMove --- src/test/c/test_VierGewinnt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/c/test_VierGewinnt.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')); +} + From 621db5af18c0d6f282a385c9bd9d1affc8383344 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:57:30 +0100 Subject: [PATCH 614/647] 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 e8d721f19b08254f0b4a254cd00a65d6b83800e3 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 00:59:00 +0100 Subject: [PATCH 615/647] 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 c099b0a403f8eeb638bb9064c564cc83cdac0872 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:00:24 +0100 Subject: [PATCH 616/647] 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 03702d7b7905fd20a8d7693a15d88e398323e38f Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:02:32 +0100 Subject: [PATCH 617/647] 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 f893d651a69e3c837693b11a543d37fae1c72c47 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:04:02 +0100 Subject: [PATCH 618/647] 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 ca20b0fec2067dc24395bfe76944dd0a36b37e4e Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:05:34 +0100 Subject: [PATCH 619/647] 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 1caa70848a670c58b41f462087cb57667f16295c Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:07:26 +0100 Subject: [PATCH 620/647] 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 4f5300d1f21b0e373c8b5f06bbfe367a9fbad7fd Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 01:12:14 +0100 Subject: [PATCH 621/647] 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 576d4821645176b2ea9d6b9958434bc0bb8d7497 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:23:03 +0100 Subject: [PATCH 622/647] 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 7df78dc7cb3b4c4d34d296e93029ce7b7d97a93a Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:33:31 +0100 Subject: [PATCH 623/647] 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 d1a757c0a1653a60d1743bbabfcbccbe912a7bb9 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:36:35 +0100 Subject: [PATCH 624/647] 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 2b2f8de01b5da42fcc5ccc05f8ee805762fd9102 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:41:20 +0100 Subject: [PATCH 625/647] =?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 d74eb007a6a5fe3fd3a8eb3bb364ab3536291269 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:43:33 +0100 Subject: [PATCH 626/647] =?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 435bf2f26a5ee8a1862bde4e9110ac8cc3291de2 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 15:47:08 +0100 Subject: [PATCH 627/647] =?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 148ed8c7ba8d0bd9e66d20fddd663d178ca388e8 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:03:50 +0100 Subject: [PATCH 628/647] =?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 2ceddaadd8f99f566caf65750d54a78a473de472 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:10:57 +0100 Subject: [PATCH 629/647] =?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 50070ed28613f26067341bcb793cdcb371cf40ad Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:15:55 +0100 Subject: [PATCH 630/647] =?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 ace11917d49f97dffbe9a4db49c1ba2ee7058bf7 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:17:39 +0100 Subject: [PATCH 631/647] 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 dcd6441e9a7a54fb55feda6ff0c6f4496e70fb10 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 16:22:30 +0100 Subject: [PATCH 632/647] 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 zcmc&)e{5XGao)R=B8sFW>X$8&mic5$2$@>P<8RS!VM?S_%B2mLavTLw@OZp?BCk5$ zo!=cTS(0HkG7trJP+uV=0-RP#;2@Ndp!&msNx+EhC_o(42FDuh-rUkH@sCb`~Ew=}HHFp_~n$D$k zh8-bP!^ zX|Fl^Og86?H4i6J&B;XSgyVL$6D#%qc|6pg{i(Q{PQ($FO1Z6_!yunIwM4oj-7T#= z%AZ-yGC{I)%Q94{4XfZ3o-6S`unOL`3f{d6u2j(TkNg-=J>cc=SFsH=Yl4cySNnM# z5bB3aA!JRm?POv&W+zgKoU-lMsi+;zIj3~Nbw&~xKo`jIw0lBj+(asOTxDa?6yADl z6$yv4X*F>8K(A_!M{`m0ilxWG5FHyo)qFgWbh6FkSrmj52(dgkhqPvF^x(ACNs4%IiEXOe=fU+l#R5GZ z+&kaCm>RkEMlzQeajb)h)JSyL30nsextwF2y!Ogy(y^RG%CU}QqDerfPbRXlQ72`! zSmUX<)fKK(eF?{kj%P<4%?=)B#UNS3j_V|HSaKd_ShjV*h- znjW;kJf`+!_hfaZEMt+;Fv$9I=VT(4a@<{&MsdrS+KWW44Ah4ndIfYVo(J%H12hBr zA?Wj<^PrbO*I;n3g6;s_ylyy*E%_-Jl?**R)YA z1bxKRx3_O&q`!J+&EE(A4nagR6ecgCejC*z5jKE_Fp{T4*btrzz@(ksDCh9J1T2R> zsJ@LuqB(RdP~9-pzft|}pS0fZp!!4j<^m}AYJx9rR3!fzo}*}Zn~^VB7W}ljA!5X} z{D&k4U((t|^6`zv-cLv#IOzdy1%GJtRzu$>z^^hcb_F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$UwV$N&HU literal 0 HcmV?d00001 From 7e158ff1426eaccca143d7217e72120668dc3c0a Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Wed, 7 Feb 2024 17:48:21 +0000 Subject: [PATCH 633/647] 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 zcmc&)e{5XGao)R=B8sFW>X$8&mic5$2$@>P<8RS!VM?S_%B2mLavTLw@OZp?BCk5$ zo!=cTS(0HkG7trJP+uV=0-RP#;2@Ndp!&msNx+EhC_o(42FDuh-rUkH@sCb`~Ew=}HHFp_~n$D$k zh8-bP!^ zX|Fl^Og86?H4i6J&B;XSgyVL$6D#%qc|6pg{i(Q{PQ($FO1Z6_!yunIwM4oj-7T#= z%AZ-yGC{I)%Q94{4XfZ3o-6S`unOL`3f{d6u2j(TkNg-=J>cc=SFsH=Yl4cySNnM# z5bB3aA!JRm?POv&W+zgKoU-lMsi+;zIj3~Nbw&~xKo`jIw0lBj+(asOTxDa?6yADl z6$yv4X*F>8K(A_!M{`m0ilxWG5FHyo)qFgWbh6FkSrmj52(dgkhqPvF^x(ACNs4%IiEXOe=fU+l#R5GZ z+&kaCm>RkEMlzQeajb)h)JSyL30nsextwF2y!Ogy(y^RG%CU}QqDerfPbRXlQ72`! zSmUX<)fKK(eF?{kj%P<4%?=)B#UNS3j_V|HSaKd_ShjV*h- znjW;kJf`+!_hfaZEMt+;Fv$9I=VT(4a@<{&MsdrS+KWW44Ah4ndIfYVo(J%H12hBr zA?Wj<^PrbO*I;n3g6;s_ylyy*E%_-Jl?**R)YA z1bxKRx3_O&q`!J+&EE(A4nagR6ecgCejC*z5jKE_Fp{T4*btrzz@(ksDCh9J1T2R> zsJ@LuqB(RdP~9-pz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?EVUoO<4qzz=LL}`UP?l7r&o%7UBRyiA1oZ@ s`9wtvkF+oI?_Yt5?Z}qWdEP(XEFmT%?Fu}P%u4bTyl=F9^T#j$-$UwV$N&HU From c302aeaa1896ea6364af53bec81d48b6dfa643f2 Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Wed, 7 Feb 2024 18:39:52 +0000 Subject: [PATCH 634/647] Update team.md --- team.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/team.md b/team.md index 76bf093..59c808e 100644 --- a/team.md +++ b/team.md @@ -1,7 +1,8 @@ -Joe Lukas Kalb, fdai7715 -Peter Wiebe, fdai7773 -Simon Hildebrandt, fdai7864 -Lucas Heil, fdai7356 -Celine Khazarian, fdai7781 -Ahmad Thaljeh, fdai7726 -Yasin Al Satouf, fdai7731 +- COMMITTER-NAME, FD-NUMMER +- Joe Lukas Kalb, fdai7715 +- Peter Wiebe, fdai7773 +- Simon Hildebrandt, fdai7864 +- Lucas Heil, fdai7356 +- Celine Khazarian, fdai7781 +- Ahmad Thaljeh, fdai7726 +- Yasin Al Satouf, fdai7731 From ed178170a5e28a76dbda2c95129e108c4adaf019 Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Wed, 7 Feb 2024 19:09:21 +0000 Subject: [PATCH 635/647] Update team.md --- team.md | 1 - 1 file changed, 1 deletion(-) diff --git a/team.md b/team.md index 59c808e..50032ed 100644 --- a/team.md +++ b/team.md @@ -1,4 +1,3 @@ -- COMMITTER-NAME, FD-NUMMER - Joe Lukas Kalb, fdai7715 - Peter Wiebe, fdai7773 - Simon Hildebrandt, fdai7864 From 5fc96ae8ac4f2211e42f0588676bbc9331362688 Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Wed, 7 Feb 2024 22:08:01 +0000 Subject: [PATCH 636/647] Update team.md --- team.md | 1 + 1 file changed, 1 insertion(+) diff --git a/team.md b/team.md index 50032ed..59c808e 100644 --- a/team.md +++ b/team.md @@ -1,3 +1,4 @@ +- COMMITTER-NAME, FD-NUMMER - Joe Lukas Kalb, fdai7715 - Peter Wiebe, fdai7773 - Simon Hildebrandt, fdai7864 From 496a41e9df6bd913ce5753f1884bfcc48e6c37a5 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Thu, 8 Feb 2024 16:23:57 +0100 Subject: [PATCH 637/647] something --- src/test/c/test_sudoku.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 557f85d..1fbe4e9 100644 --- a/src/test/c/test_sudoku.c +++ b/src/test/c/test_sudoku.c @@ -21,7 +21,6 @@ void tearDown(void) //1 // Unit test for Level_Pool() function -// Call the Level_Pool() function, prints 3 fixed lines and "Available levels for Difficulty " void test_Level_Pool_0() { selected_difficulty = 0; Level_Pool(selected_difficulty); From 3f0a348820b7893bb17b4f898aeb85020e60dac1 Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Thu, 8 Feb 2024 15:40:04 +0000 Subject: [PATCH 638/647] Update team.md --- team.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/team.md b/team.md index 59c808e..8a54816 100644 --- a/team.md +++ b/team.md @@ -4,5 +4,5 @@ - Simon Hildebrandt, fdai7864 - Lucas Heil, fdai7356 - Celine Khazarian, fdai7781 -- Ahmad Thaljeh, fdai7726 +- fdai7726, fdai7726 - Yasin Al Satouf, fdai7731 From 00b38a43e901de198a0291b2233a32beed77c16c Mon Sep 17 00:00:00 2001 From: fdai7715 Date: Thu, 8 Feb 2024 16:12:36 +0000 Subject: [PATCH 639/647] Add new directory --- src/test/c/support/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/test/c/support/.gitkeep diff --git a/src/test/c/support/.gitkeep b/src/test/c/support/.gitkeep new file mode 100644 index 0000000..e69de29 From fd5a3449429b56bb8e3d8bfacb7fec7f4e0cb861 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 21:42:28 +0100 Subject: [PATCH 640/647] Test --- src/main/c/Mathe.c | 196 +++++++++++++++++++--------------------- src/main/c/Mathe.h | 10 ++ src/test/c/test_Mathe.c | 130 ++++++++++++++++++++++++++ src/test/c/test_test.c | 0 4 files changed, 235 insertions(+), 101 deletions(-) create mode 100644 src/main/c/Mathe.h create mode 100644 src/test/c/test_Mathe.c delete mode 100644 src/test/c/test_test.c diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index d172f55..f0c9c9d 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -1,87 +1,134 @@ -//1 + +// Geschrieben von Yasin Al Satouf + #include #include #include #include "Mathe.h" -//2 + + void initialisiereZufallsgenerator(); -//3 -int generiereZufallszahl(int min, int max); +int generiereZufallszahl(int minimum, int maximum); -//4 char generiereZufallsOperator(); -//5 int addiere(int zahl1, int zahl2); -//6 int subtrahiere(int zahl1, int zahl2); -//7 int multipliziere(int zahl1, int zahl2); - -//8 int dividiere(int zahl1, int zahl2); - -//9 int berechneErgebnis(int zahl1, int zahl2, char operator); - -//10 void spieleRunde(int schwierigkeitsgrad); - -//11 void zeigeAnleitung(); - -//12 void zeigeHighscore(int punkte); - -//13 int holeSpielerAntwort(); -//14 void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte); -//15 void zeigeRundenEnde(int punkte); -//16 + + + + void zeigeAuswahl(const char* text); -//17 void initialisiereZufallsgenerator() { srand(time(NULL)); +} -//18 -int generiereZufallszahl(int min, int max) { - return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); +int generiereZufallszahl(int minimum, int maximum) { + return minimum + (int)((double)rand() / (RAND_MAX + 1) * (maximum - minimum + 1)); +} -//19 char generiereZufallsOperator() { char operatoren[] = {'+', '-', '*', '/'}; - int index = rand() % 4; - return operatoren[index]; + int indexnumber = rand() % 4; + return operatoren[indexnumber]; +} + +void zeigeAnleitung() { + printf("\n=== Anleitung ===\n"); + printf("Löse die folgenden mathematischen Aufgaben, um Punkte zu erzielen.\n"); + printf("Sie haben die Möglichkeit, zwischen verschiedenen Schwierigkeitsgraden zu wählen.\n"); + printf("Versuche, so viele Aufgaben wie möglich korrekt zu lösen, um einen höheren Highscore zu erzielen.!\n"); +} + + +void zeigeHighscore(int punkte) { + printf("\n=== Highscore ===\n"); + printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); +} + + +void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { + if (spielerAntwort == ergebnis) { + printf("Super, das ist richtig! Du erhältst einen Punkt.\n"); + (*punkte)++; + } else { + printf(" Leider Falsch! Die richtige Antwort ist %d\n", ergebnis); + } +} + + +void zeigeRundenEnde(int punkte) { + printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); +} + +int addiere(int ersteZahl, int zweiteZahl) { + return ersteZahl + zweiteZahl; +} + +int subtrahiere(int zahl1, int zahl2) { + return zahl1 - zahl2; +} + +int multipliziere(int zahl1, int zahl2) { + return zahl1 * zahl2; +} + +int dividiere(int zahl1, int zahl2) { + if (zahl2 != 0) { + return zahl1 / zahl2; + } else { + printf("Fehler: Division durch Null vermieden.\n"); + return 0; + } +} + + + +void zeigeAuswahl(const char* text) { + printf("%s\n", text); +} +int holeSpielerAntwort() { + int spielerAntwort; + zeigeAuswahl("Deine Antwort: "); + scanf("%d", &spielerAntwort); + return spielerAntwort; +} -//20 int berechneErgebnis(int zahl1, int zahl2, char operator) { switch (operator) { case '+': @@ -99,7 +146,8 @@ int berechneErgebnis(int zahl1, int zahl2, char operator) { -//21 + + void spieleRunde(int schwierigkeitsgrad) { int punkte = 0; int anzahlAufgaben = 5; @@ -122,82 +170,28 @@ void spieleRunde(int schwierigkeitsgrad) { } +int mainx() { + srand(time(NULL)); -//22 -void zeigeAnleitung() { - printf("\n=== Anleitung ===\n"); - printf("Beantworte die mathematischen Aufgaben, um Punkte zu sammeln.\n"); - printf("Du kannst zwischen verschiedenen Schwierigkeitsgraden wählen.\n"); - printf("Versuche so viele Aufgaben wie möglich korrekt zu lösen!\n"); - - - -//23 -void zeigeHighscore(int punkte) { - printf("\n=== Highscore ===\n"); - printf("Dein aktueller Highscore ist: %d Punkte\n", punkte); - - - -//24 -int holeSpielerAntwort() { - int spielerAntwort; - zeigeAuswahl("Deine Antwort: "); - scanf("%d", &spielerAntwort); - return spielerAntwort; - - - -//25 -void bewerteAntwort(int spielerAntwort, int ergebnis, int* punkte) { - if (spielerAntwort == ergebnis) { - printf("Richtig! Du erhältst einen Punkt.\n"); - (*punkte)++; - } else { - printf("Falsch! Die richtige Antwort ist %d\n", ergebnis); - } -} - - - -//26 -void zeigeRundenEnde(int punkte) { - printf("Runde beendet. Du hast insgesamt %d Punkte erreicht.\n", punkte); - - - -//27 -int addiere(int zahl1, int zahl2) { - return zahl1 + zahl2; - - - -//28 -int subtrahiere(int zahl1, int zahl2) { - return zahl1 - zahl2; - - + int weiterSpielen = 1; + int gesamtPunkte = 0; -//29 -int multipliziere(int zahl1, int zahl2) { - return zahl1 * zahl2; + zeigeAnleitung(); + while (weiterSpielen) { + int schwierigkeitsgrad; + printf("\n Schwierigkeitsgrad wählen (1 für einfach, 2 für mittel, 3 für schwer): "); + scanf("%d", &schwierigkeitsgrad); + spieleRunde(schwierigkeitsgrad); + zeigeHighscore(gesamtPunkte); -//30 -int dividiere(int zahl1, int zahl2) { - if (zahl2 != 0) { - return zahl1 / zahl2; - } else { - printf("Fehler: Division durch Null vermieden.\n"); - return 0; + printf("\nMöchtest du eine weitere Runde spielen? (1 für Ja, 0 für Nein): "); + scanf("%d", &weiterSpielen); } -} + printf("Vielen Dank fürs Spielen! Auf Wiedersehen.\n"); - -//31 -void zeigeAuswahl(const char* text) { - printf("%s\n", text); + return 0; } diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h new file mode 100644 index 0000000..b95e151 --- /dev/null +++ b/src/main/c/Mathe.h @@ -0,0 +1,10 @@ +#ifndef TEST_H +#define TEST_H +int berechneErgebnis(int zahl1, int zahl2, char operator); +int generiereZufallszahl(int minimum, int maximum); +int multipliziere(int zahl1, int zahl2); +int dividiere(int zahl1, int zahl2); +int addiere(int ersteZahl, int zweiteZahl); +int subtrahiere(int zahl1, int zahl2); +int multipliziere(int zahl1, int zahl2); +#endif // MATHEMATIKSPIE diff --git a/src/test/c/test_Mathe.c b/src/test/c/test_Mathe.c new file mode 100644 index 0000000..ebddf8d --- /dev/null +++ b/src/test/c/test_Mathe.c @@ -0,0 +1,130 @@ +#ifdef TEST +#include "unity.h" +#include "Mathe.h" +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_Mathe_plus(void) +{ + + int a=berechneErgebnis(1,2,'+'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,3); +} + + +void test_Mathe_minus(void) +{ + + int a=berechneErgebnis(1,2,'-'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,-1); +} + + +void test_Mathe_multi(void) +{ + + int a=berechneErgebnis(1,2,'*'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,2); +} + + + +void test_Mathe_divided(void) +{ + + int a=berechneErgebnis(2,2,'/'); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,1); +} + + + +void test_Zufallszahl(void) +{ + + int a= generiereZufallszahl(1, 10); + + /* assert */ +TEST_ASSERT_INT_WITHIN (10, 1, a); + +} + + +void testGeneriereZufallsOperator() { + // Since the function always returns one of {'+', '-', '*', '/'}, no specific range check is needed. + char result = generiereZufallsOperator(); + TEST_ASSERT_TRUE(result == '+' || result == '-' || result == '*' || result == '/'); +} + + + +void test_multi() +{ + + +int a=multipliziere(4, 3); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,12); + + + +} + + + + +void test_dev() +{ + +int a=dividiere(10, 5); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,2); + + + + +} + + + + + +void test_plus() +{ + +int a=addiere(10, 5); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,15); + + + + +} + + + +void test_minus() +{ + +int a=subtrahiere(10, 5); + /* assert */ + TEST_ASSERT_EQUAL_INT(a,5); + + + + +} + + + + + +#endif diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c deleted file mode 100644 index e69de29..0000000 From 6388d96d8914a797fa2a381a8ee7bdcfa1148a05 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 22:23:57 +0100 Subject: [PATCH 641/647] resolved problem --- src/test/c/test_test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/test/c/test_test.c diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c new file mode 100644 index 0000000..1f30c72 --- /dev/null +++ b/src/test/c/test_test.c @@ -0,0 +1,13 @@ +#ifdef TEST + +#include "unity.h" + +#include "test.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} From fe9d4be720c311d912983bc5fb9b10109d007af1 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 22:40:18 +0100 Subject: [PATCH 642/647] resolved problem --- src/test/c/test_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c index 1f30c72..d079737 100644 --- a/src/test/c/test_test.c +++ b/src/test/c/test_test.c @@ -11,3 +11,5 @@ void setUp(void) void tearDown(void) { } +#endif + From 72485ebf2bd41213f6e51b8705fc00d05450857d Mon Sep 17 00:00:00 2001 From: fdai7726 Date: Thu, 8 Feb 2024 21:42:16 +0000 Subject: [PATCH 643/647] Delete test_test.c --- src/test/c/test_test.c | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/test/c/test_test.c diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c deleted file mode 100644 index d079737..0000000 --- a/src/test/c/test_test.c +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef TEST - -#include "unity.h" - -#include "test.h" - -void setUp(void) -{ -} - -void tearDown(void) -{ -} -#endif - From 77c0e85e51855e7457a3221faf2c0e49edb4a508 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 22:40:18 +0100 Subject: [PATCH 644/647] resolved problem --- src/test/c/test_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/c/test_test.c b/src/test/c/test_test.c index 1f30c72..d079737 100644 --- a/src/test/c/test_test.c +++ b/src/test/c/test_test.c @@ -11,3 +11,5 @@ void setUp(void) void tearDown(void) { } +#endif + From 83cc8683695df66c70d1542b74fc923b256a500c Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 22:46:51 +0100 Subject: [PATCH 645/647] =?UTF-8?q?Funktion=20zu=20Mathe.h-Datei=20hinzuge?= =?UTF-8?q?f=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/Mathe.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/c/Mathe.h b/src/main/c/Mathe.h index b95e151..a71b2fe 100644 --- a/src/main/c/Mathe.h +++ b/src/main/c/Mathe.h @@ -7,4 +7,5 @@ int dividiere(int zahl1, int zahl2); int addiere(int ersteZahl, int zweiteZahl); int subtrahiere(int zahl1, int zahl2); int multipliziere(int zahl1, int zahl2); +char generiereZufallsOperator(); #endif // MATHEMATIKSPIE From ee88312f7d6dd4b23178dc989e6ef4509f2aebc4 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 22:48:13 +0100 Subject: [PATCH 646/647] Ignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c2c4a5a..030e9aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -target/** \ No newline at end of file +target/** +src/test/c/test_test.c From 0281ea3ace1a905b7ec6160d4131155b28f8e87d Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 22:02:58 +0000 Subject: [PATCH 647/647] Update team.md --- team.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/team.md b/team.md index 8a54816..ec72473 100644 --- a/team.md +++ b/team.md @@ -5,4 +5,4 @@ - Lucas Heil, fdai7356 - Celine Khazarian, fdai7781 - fdai7726, fdai7726 -- Yasin Al Satouf, fdai7731 +- fdai7731, fdai7731