Browse Source

Check diagonal lines

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

4
src/main/c/GameTic_Tac_Toe/game.c

@ -25,3 +25,7 @@ char checkWinner() {
if (board[i][0] == board[i][1] && board[i][1] == board[i][2]) return board[i][0]; if (board[i][0] == board[i][1] && board[i][1] == board[i][2]) return board[i][0];
if (board[0][i] == board[1][i] && board[1][i] == board[2][i]) return board[0][i]; if (board[0][i] == board[1][i] && board[1][i] == board[2][i]) return board[0][i];
} }
// Überprüfe diagonale Linien
if (board[0][0] == board[1][1] && board[1][1] == board[2][2]) return board[0][0];
if (board[0][2] == board[1][1] && board[1][1] == board[2][0]) return board[0][2];
Loading…
Cancel
Save