Browse Source

Check whether the selected field is valid

remotes/origin/fdai7775-main-patch-54732
fdai7775 11 months ago
parent
commit
c0df50c147
  1. 4
      src/main/c/GameTic_Tac_Toe/game.c

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

@ -56,3 +56,7 @@ void makeMove() {
int row = (choice - 1) / 3;
int col = (choice - 1) % 3;
// Überprüfe, ob das gewählte Feld gültig ist
if (choice >= 1 && choice <= 9 && board[row][col] != 'X' && board[row][col] != 'O') {
Loading…
Cancel
Save