Browse Source

display the game board

remotes/origin/fdai7775-main-patch-54732
fdai7775 11 months ago
parent
commit
8957916a23
  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'}, {'4', '5', '6'},
{'7', '8', '9'}}; {'7', '8', '9'}};
char currentPlayer = 'X'; 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