Browse Source

refactoring: get_Move

remotes/origin/Ariana
fdai7775 11 months ago
parent
commit
4a4f084441
  1. 13
      src/main/c/GameTic_Tac_Toe/tictactoe.c

13
src/main/c/GameTic_Tac_Toe/tictactoe.c

@ -26,6 +26,13 @@ void displayBoard() {
} }
} }
int get_move(){
int choice;
printf("Spieler %c, waehle eine Zahl (1-9): ", (currentPlayer == PLAYER_X) ? 'X' : 'O');
scanf("%d", &choice);
return choice;
}
char checkLine(char a, char b, char c) { char checkLine(char a, char b, char c) {
if (a == b && b == c) return a; if (a == b && b == c) return a;
return ' '; return ' ';
@ -97,12 +104,6 @@ int isGameOver() {
return (winner == PLAYER_X || winner == PLAYER_O || isBoardFull()); return (winner == PLAYER_X || winner == PLAYER_O || isBoardFull());
} }
int get_move(){
int choice;
printf("Spieler %c, waehle eine Zahl (1-9): ", (currentPlayer == PLAYER_X) ? 'X' : 'O');
scanf("%d", &choice);
return choice;
}
void printGameResult(char winner) { void printGameResult(char winner) {
if (winner == PLAYER_X || winner == PLAYER_O) { if (winner == PLAYER_X || winner == PLAYER_O) {

Loading…
Cancel
Save