From 47eadc816640b331792e8bbf545c6eb3fb7e5fe4 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 17:01:40 +0100 Subject: [PATCH] 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