Richard, my suggestion is to first, slowly and deliberately, play a game of Tic-Tac-Toe, by yourself. Note what the pattern is - write it down.

As to switching player on the move:

int player =...