Browse Source

refactoring: separation of the game loop into functions

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

11
src/main/c/GameTic_Tac_Toe/game.c

@ -79,7 +79,7 @@ void makeMove() {
}
}
int main() {
void playGame() {
while (1) {
displayBoard();
makeMove();
@ -95,11 +95,10 @@ int main() {
displayBoard();
printf("Unentschieden!\n");
break;
}
// Wechsle den Spieler
currentPlayer = (currentPlayer == 'X') ? 'O' : 'X';
}
}
}
int main(){
playGame();
return 0;
}
Loading…
Cancel
Save