Browse Source

Spielschleife

remotes/origin/tictactoedev
Sabina Grisi 11 months ago
parent
commit
fecea11274
  1. 9
      src/TicTacToe.c

9
src/TicTacToe.c

@ -15,6 +15,8 @@ int main() {
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9);
// Spielschleife
for (int i = 0; i < 9; i++) {
int in; int in;
printf("Choose a number: "); printf("Choose a number: ");
scanf("%d", &in); scanf("%d", &in);
@ -39,11 +41,12 @@ int main() {
} else if (pos9 == in) { } else if (pos9 == in) {
pos9 = o; pos9 = o;
} else { } else {
printf("Not Available.");
printf("Try again. ");
i--; // wiederholen
continue;
} }
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9);
}
return 0; return 0;
} }

Loading…
Cancel
Save