## Tuesday, December 14, 2010

### Winning at Tic Tac Toe

Who hasn’t played Tic Tac Toe? You may know it by different names, like naughts and crosses or X-zero, but you are certain to have played it in your childhood. You would have progressed in the game to a stage where it was difficult for someone to beat you and any game with a good player always resulted in a draw. You figured that this is a very simple game and moved on to other things in life.

But have you thought about what is a foolproof formula to win in this game? Or at the very least increase your chances of a win against an inexperienced player, since it is not possible to beat a good player? If you think about it, it’s actually very interesting to figure out the move sequences in this game. Let’s try to analyze the first few moves.

But first, the rules. The game consists of drawing a grid of 3 x 3 squares like this.

The players take turns to play. The first player puts an ‘X’ in one of the nine squares. The next player puts a ‘O’. Back to the first player who puts an ‘X’ and so on, till any one player gets three of his pieces (X or O) in a row, vertically, horizontally or diagonally to win. In case no one succeeds in doing that, it’s a draw.

A typical game when finished would look like this – in this case X has just won:

The strategy is of course to complete the row of three once you have two in a row; if you don’t have two in a row waiting, you block your opponent if he has two in a row; if that is not the case, you see if you can create a situation where you place your move in such a way that you create two opportunities of a finish, in other words create a fork, which makes the opponent helpless. What I mean by a fork is this:

X has created a situation where he will win in the next move.

The first move that X makes can be one of three types:

Centre opening: Where X places his move in the centre square, like this:

Corner opening: Where X places his move in one of the four diagonal corners, like this:

Side opening: where X places his move in one of the side squares, like this:

Let’s analyze each of these openings one by one.

Centre opening: If X opens in the Centre, O has to place his move in one of the diagonals, else he loses.

If O places his move on the side, this is what happens:

X wins

Corner Opening: If X places his move in the diagonal corner, O has only one possible move, and that is, the centre. This is what happens if he plays any other way, e.g.,
Possibility 1: If O replies with one of the sides:

Possibility 2: If O replies with one of the corners:

X wins in both cases.

Side opening: If X opens on the side, O can play one of the following four moves:

i.e. O can place his move to either side of, or in any of the two squares above, X.

If he doesn’t, this is what happens:

Case 1:

Case 2:

X wins in both cases.

I shall not analyze the moves following these. That should be easy enough for you to do!