From 4af9a27662f2e87139e7b8b09d9e6d373d578084 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:45:41 +0100 Subject: [PATCH] 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