From 65918b52a6d7ba8175f401ff0e59394aa1ac138c Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 15:22:49 +0100 Subject: [PATCH] 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