# Is there a winning strategy for this tic-tac-toe?

The figure shows a variation of a tic-tac-toe board, with the usual rules: three small balls each player and three in a row wins. Is it possible to transform the layout isomorphically so the same analysis applies regardless of the board layout? • What's nice about this layout is that each node belongs to exactly three lines, and so each node is at least nominally of the same value. Whereas in regular tic-tac-toe, the center node belongs to four lines, the edge nodes belong to two, and the corner nodes belong to three... making it "obvious" that the center node is especially valuable. – mjqxxxx Jul 10 '16 at 1:09
• If you play it, you will realize that it is very interesting and difficult to win. It is deceptively simple... – Alberto Cohen Jul 10 '16 at 23:48

## 2 Answers

The first player (P1) has a winning strategy, which I'll describe here.

First, I'll quickly explain the notation I've used. Each 'cell' on the board has three lines passing through it, so I've categorised them by whether the cell is an end point or a midpoint of those lines:

1. The cell is an endpoint of one line and a midpoint of the other two (those nearest the centre). These are 'Type $1$'.
2. The cell is an endpoint of two lines and a midpoint of the third (those along the edges of the board not in the corners). These are 'Type $2$'.
3. The cell is an endpoint of all three lines (those in the corners of the board). These are 'Type $3$'.

As there are three of each type, we split the board into three sections (named $A, B$, and $C$, going clockwise around the board). Then, going top to bottom left to right, the cells in the photo provided are labelled as: $A3, A2, B2, B1, A1, B3, C1, C2, C3$. When writing moves, if a move is forced I have written this as $\rightarrow$. I have assumed the first move is made in section $A$, as the board can just be rotated otherwise.

Labelled image of the board

The first move is $A3$. Most moves that the second player (P2) can make from this point are not too difficult to work out. For instance, one sequence of moves could be: $A3, A2, A1 \rightarrow C2, B2$ wins for P1.

The general strategy for P1 is, except for the cases mentioned below, to force P2's second move to be in a cell that is not in the same line as their first move. In the above strategy for $A3, A2$, for instance, P2 is forced to play $C2$ which is not in the same line as their first move $A2$. From there P1 can setup a fork on their next turn (by which I mean, fill in the second point in two lines simultaneously), without having to deal with a threat of P2 winning with their next move.

The exceptions to this strategy are when P2 plays $B3$ or $C3$. These have slightly longer lines, as shown here. $C3$ has the line: $A3, C3, B3 \rightarrow B2 \rightarrow C1$, and $B3$ has the line: $A3, B3, C3 \rightarrow A2 \rightarrow B1$. Both of these lines win for P1.

Obviously this brute force approach is not particularly involved, and I'd like to see some analysis on exactly why there is a winning strategy for player 1, but I thought I'd share what I'd found on this. There may also be winning strategies if instead the first move is $A1$ or $A2$.

Edit: Winning strategies for $A1$ and $A2$

Leaving a couple of open questions bothered me, so I quickly ran through other options for the first move, and found that there is a winning strategy for both $A1$ and $A2$ - that is, no matter what the first move is, the first player will win with perfect play.

When the first move is $A2$, the strategy is even simpler. As before, move so that the P2's second move does not share any lines with their first move, and from there you should be able to set up a fork. There will be a move which works, although just following this rule alone is not a guarantee (after $A2, A1$, the sequence $B1 \rightarrow B3$ does not allow a fork, so instead $A3 \rightarrow C3$ should be used).

As an example, when $A2$ is met with $B3$, one line is: $A2, B3, A1 \rightarrow C1, A3$ (this is not unique - another option is $A2, B3, C1 \rightarrow A1, C3$.

The only exception to this strategy is when $A2$ is met with $B2$. From this position, all possible cells which we can force P2 to play share a line with $B2$. (The only other cell which isn't on the same line as $B2$ is $C2$, which we cannot force). The line for this case is: $A2, B2, A3 \rightarrow C3 \rightarrow C1 \rightarrow A1 \rightarrow B1$.

When the first move is $A1$, as above, the main idea is the same. The only special cases are when P2 also plays in a type 1 cell, either $B1$ or $C1$. The lines for these are: $A1, B1, C1 \rightarrow A2 \rightarrow B3$, and $A1, C1, B1 \rightarrow B2 \rightarrow C3$. From this point, any move by P2 allows P1 to setup a fork. (For example, $A1, C1, B1 \rightarrow B2 \rightarrow C3, B3 \rightarrow A3$ wins for P1).

I'm not too clear on what you mean by "transform the layout isomorphically", but if by an isomorphism you mean a bijection of nodes which preserves the rows of three then there isn't one. The ordinary tic-tac-toe board has eight rows of three, whereas this board has nine rows of three.

• By isomorphically, I tried to mean different board layouts that maintain the same properties but look different. For example, as when you use graph theory to extract the skeleton of a puzzle so that you can rebuild the board in a different shape. – Alberto Cohen Jul 10 '16 at 23:43