Saturday, January 7, 2012

How to win at Tic Tac Toe

I couldn't sleep the other nite. As a result, I ended up thinking about the strategy of Tic Tac Toe. There really isn't a whole lot to think about, but in my head I went through all of the possible game states. Not a difficult feat since the game is both vertically and horizontally symmetrical. In the end, I was able to distill it down to a few basic principles. The center is the most valuable resource in the game. Always go for that. It is part of 4 possible ways to win. Next are the corners. Each of them are part of 3 possible ways to win. The middle outside spots are the worst. They are only able to help you win in 2 ways.

3 | 2 | 3
2 | 4 | 2

3 | 2 | 3

In practice then, if you are the X then you should start the game by taking the middle. If you don't you are likely to lose. The "O" player should then take a corner. If the "O" player takes a middle outside square, then the "X" player should take the corner square next to the spot taken by the "O" player. The "O" will be forced to block the potential cross victory position. The "X" player can now take a middle spot that connects his other two "X" spots, which will create a dual possibility for the win. He can also take any remaining corner spot for a dual win option on the next play.

If the "O" player is wise and takes a corner spot, the game is probably a draw. Almost any move from here creates a domino effect of blocking moves. It should be a draw. However, if the "X" player takes the opposite corner spot, then the "O" player has plenty of choices where the outcome isn't obvious. If they take an adjacent middle outside spot on the next move, then the "X" player may have to block an "O" victory, however the blocking will create the dual win situation for the "X" player. If they take any other middle outside spot, then the "X" player can setup the dual victory as well by taking the most open corner location.

The game does have a few non-obvious traps. If you are the "X" player you CAN win even against a more seasoned player by thinking about the game in terms of spot values.

1 comment:

Josh Rose said...

About time you wrote a new post!

When I was a kid, there was one day where I got the urge to master Tic-Tac-Toe. Armed with paper and pencil, I mapped out every possibility and came to a different conclusion than what you have.

I start with the corner. From the corner, there is only a single square that you can go that will prevent me from forcing a victory. If you start in the center, there are 4 squares that can bring a draw - that's only a 50/50 chance. From the corner, I have 7 in 8 chance of winning, assuming the person is equally likely to choose all squares. Also, once the person takes the one square they may take, I have two options for my next move which can be rather devastating if the opponent doesn't know how to react. What's great though is that for any of the other 7 moves, I can force a victory.

-Rose