Browse Source

refactoring: char replaced with enum

remotes/origin/Ariana
Ariana Ginju 11 months ago
committed by David Moeller
parent
commit
6d1d96c4d9
  1. 6
      src/main/c/GameTic_Tac_Toe/game.c

6
src/main/c/GameTic_Tac_Toe/game.c

@ -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;
}

Loading…
Cancel
Save