From 1fb4e971b09410d7c0501b99e1671bd6664fa573 Mon Sep 17 00:00:00 2001 From: Siamak Date: Wed, 7 Feb 2024 18:08:08 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Testfunktion=20f=C3=BCr=20O=20gewinnt=20sen?= =?UTF-8?q?krecht=20in=20der=20Mitte=20wurde=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/test_funktionen.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index 62dafa7..cbcb1b4 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -228,6 +228,21 @@ void test_o_wins_onIndex_00_10_20(void) TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_o_wins_onIndex_01_11_21(void) +{ + /* arrange */ + int actual; + int expected = 1; + + char board[][3] = {{' ','O',' '}, {' ','O',' '}, {' ','O',' '}}; + + /* act */ + actual = o_wins_01_11_21(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} + void test_stringLaenge_von_Kokosnuss(void) { /* arrange */ From d62888c0fdfa92f4301a0a9b23f342159a2b6a37 Mon Sep 17 00:00:00 2001 From: Siamak Date: Wed, 7 Feb 2024 18:10:11 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Funktion=20f=C3=BCr=20O=20gewinnt=20senkrec?= =?UTF-8?q?ht=20in=20der=20Mitte=20wurde=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/funktionen.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index 19f8742..7ed1e81 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -77,6 +77,12 @@ int o_wins_00_10_20(char board[][3]) { } } +int o_wins_01_11_21(char board[][3]) { + if (board[0][1] == 'O' && board[1][1] == 'O' && board[2][1] == 'O') { + return 1; + } +} + int string_character_counter(char string[]) { int stringLength = 0; From 4a6d739093d564f9a9b37ad6f35e09ca036c16df Mon Sep 17 00:00:00 2001 From: Siamak Date: Wed, 7 Feb 2024 18:11:34 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Funktion=20f=C3=BCr=20O=20gewinnt=20senkrec?= =?UTF-8?q?ht=20in=20der=20Mitte=20wurde=20in=20die=20Headerdatei=20eingef?= =?UTF-8?q?=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/funktionen.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/c/funktionen.h b/src/c/funktionen.h index efbc2dc..fd773a8 100644 --- a/src/c/funktionen.h +++ b/src/c/funktionen.h @@ -38,6 +38,9 @@ int x_wins_00_01_02(char board[][3]); int o_wins_00_10_20(char board[][3]) // prüft, ob O bei Index 00, 10, 20 ist. +int o_wins_01_11_21(char board[][3]) +// prüft, ob O bei Index 01, 11, 21 ist. + int string_character_counter(char string[]); // liefert die Länge eines Strings zurück