Browse Source

refactoring: separation of the game loop into functions

Author:    Ariana Ginju <ariana.ginju@informatik.hs-fulda.de>
remotes/origin/Ariana
Ariana Ginju 11 months ago
committed by David Moeller
parent
commit
29759098ad
  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) { while (1) {
displayBoard(); displayBoard();
makeMove(); makeMove();
@ -95,11 +95,10 @@ int main() {
displayBoard(); displayBoard();
printf("Unentschieden!\n"); printf("Unentschieden!\n");
break; break;
}
// Wechsle den Spieler
currentPlayer = (currentPlayer == 'X') ? 'O' : 'X';
}
} }
}
int main(){
playGame();
return 0; return 0;
} }
Loading…
Cancel
Save