*spoilers ahead*
In order to win as X, you have to play OPPOSITE of where O plays. If you fail to do this, O will win.