diff --git a/src/c/ticTacToe.c b/src/c/ticTacToe.c index 915e796..610a8ec 100644 --- a/src/c/ticTacToe.c +++ b/src/c/ticTacToe.c @@ -886,6 +886,18 @@ int play() { counter += 1; } printField(field); - printf("%d", winner); + printWinner(winner); return winner; +} + +void printWinner(int winner){ + if(winner == PLAYER){ + printf("You won\n"); + } + else if(winner == COMPUTER){ + printf("I won\n"); + } + else if(winner == DRAW){ + printf("It's a draw\n"); + } } \ No newline at end of file diff --git a/src/c/ticTacToe.h b/src/c/ticTacToe.h index 007b9cb..7033e57 100644 --- a/src/c/ticTacToe.h +++ b/src/c/ticTacToe.h @@ -18,5 +18,6 @@ int wasGameWon(char field[3][3]); void getComputerInput(char field[3][3]); void fillAlmostFull(char field[3][3], bool *pt); int play(); +void printWinner(int winner); #endif \ No newline at end of file