Wrote the checkWinner() function.