diff --git a/src/TicTacToe.c b/src/TicTacToe.c index 3c7d1d1..b8d825d 100644 --- a/src/TicTacToe.c +++ b/src/TicTacToe.c @@ -48,7 +48,19 @@ int main() { } drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); + // Prüfung auf Gewinn + if (pos1 == player && pos2 == player && pos3 == player) { + if(player == 10){ + printf("\nSpieler X hat gewonnen!\n\n"); + break; + }else{ + printf("\nSpieler O hat gewonnen!\n\n"); + break; + } + } + player = switchPlayer(player); + } return 0; }