diff --git a/src/TicTacToe.c b/src/TicTacToe.c index e28e1be..3c7d1d1 100644 --- a/src/TicTacToe.c +++ b/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; + } } \ No newline at end of file