Browse Source

Pruefung auf Gewinn fuer Position 1, 2, 3

remotes/origin/tictactoedev
Sabina Grisi 11 months ago
parent
commit
6e3cfc6d97
  1. 12
      src/TicTacToe.c

12
src/TicTacToe.c

@ -48,7 +48,19 @@ int main() {
} }
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); 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); player = switchPlayer(player);
} }
return 0; return 0;
} }

Loading…
Cancel
Save