|
|
@ -24,14 +24,16 @@ void displayBoard() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
char checkLine(char a, char b, char c) { |
|
|
|
if (a == b && b == c) return a; |
|
|
|
return ' '; |
|
|
|
} |
|
|
|
|
|
|
|
// Funktion zur Überprüfung des Gewinners |
|
|
|
char checkWinner() { |
|
|
|
// Überprüfe horizontale und vertikale Linien |
|
|
|
for (int i = 0; i < 3; i++) { |
|
|
|
for (int i = 0; i < BOARD_SIZE; i++) { |
|
|
|
char horizontalWinner = checkLine(board[i][0], board[i][1], board[i][2]); |
|
|
|
char verticalWinner = checkLine(board[0][i], board[1][i], board[2][i]); |
|
|
|
|
|
|
@ -65,7 +67,7 @@ int isBoardFull() { |
|
|
|
|
|
|
|
|
|
|
|
// Funktion zum Zug eines Spielers |
|
|
|
char switchPlayer(char currentPlayer) { |
|
|
|
enum switchPlayer(enum currentPlayer) { |
|
|
|
return (currentPlayer == PLAYER_X) ? PLAYER_O : PLAYER_X; |
|
|
|
} |
|
|
|
|
|
|
|