Browse Source

display the game board

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

13
src/main/c/GameTic_Tac_Toe/game.c

@ -4,3 +4,16 @@ char board[3][3] = {{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'}};
char currentPlayer = 'X';
// Funktionen zur Anzeige des Spielbretts
void displayBoard() {
printf("Tic-Tac-Toe\n");
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
printf("%c", board[i][j]);
if (j < 2) printf(" | ");
}
printf("\n");
if (i < 2) printf("---------\n");
}
}
Loading…
Cancel
Save