Browse Source

refactoring neue Funktion int switchPlayer(int player)

remotes/origin/tictactoedev
Sabina Grisi 11 months ago
parent
commit
3cd4c0eb29
  1. 10
      src/TicTacToe.c

10
src/TicTacToe.c

@ -48,7 +48,7 @@ int main() {
}
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9);
player = (player == 10) ? 11 : 10;
player = switchPlayer(player);
}
return 0;
}
@ -136,4 +136,12 @@ void drawBoard(int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int p
}
printf("%c\n", vertical);
printf("%c%s%c%s%c%s%c\n", vertical, horizontal, vertical, horizontal, vertical, horizontal, vertical);
}
int switchPlayer(int player) {
if (player == 10) {
return 11;
} else {
return 10;
}
}
Loading…
Cancel
Save