Such a simple game and so easy to take for granted however it's still a wonder how a human can lose at such a game. This post is for unlocking and presenting the secrets of the game of Noughts and Crosses also known as TicTacToe.

Introduction

So if you're reading this post, you're obviously interested in the strategies for winning the game but you will be thoroughly disappointed to find out that this game is drawn with perfect play. Moreover the 1st player can always force atleast a draw on the 1st move although this scenario is rather boring for humans although computers (referring to the minmax algorithm) will always play this move (if given the first move).

So what is the point of this post? Well humans are not perfect players and there are easy traps and although you may have read that there are thousands of combinations of boards, there's very little when you include board symmetry and order of moves.

Gameplay

Problem Setup

First let's create some definitions:

Corners - Adjacent (CA) or Opposite (CO)
Edges - Adjacent (EA) or Opposite (EO)
Middle - The central square (M)

These definitions are relative to the first move.

Strategies

The only real difficulty is picking the first move for Player 1 and the second move for Player 2. The rest of the game follows by force or to a draw automatically.

In the strategies below, Player 1 makes the given move and Player 2 must make one of the moves in bold to not lose the game.

Strategy 1
The easiest win/draw strategy for Player 1!
C - (M)

Strategy 2
The easy draw strategy for Player 2 if Player 1 plays this! (Boring)
M - (C)

Strategy 3
The traps strategy for both players!
E - (M | CA)

Strategy 1 is objectively the best strategy for Player 1 but most players will be able to play this out to a draw as Player 2 after simply defaulting to M on the second move. The only trap is C-M-CO-(CA) where CA would lose the game and E has to be played although this is pretty visible thinking a move ahead.

Strategy 2 is the most boring strategy for Player 1 as it's almost a wasted opportunity because the reply for Player 2 will almost be instantaneous (after a few games if opponent doesn't realise Es are bad). This strategy will work on novice players (but then again who really is a novice at this game).

Strategy 3 could pose a challenge to Player 2 (as COs and Es cannot be played) but requires extreme caution for Player 1 and hence could be the worst one yet it is also most likely where an advanced player may trip up. Therefore this strategy does not offer many winning chances for Player 1 apart from the first move for Player 2.

Game Encoding

This is a more numerical/mathematical approach to understanding the game. The entire progression of a game can be stored as a series of numbers.

Mental Model

For example, taking the board to be numbered like a phone keypad:

1 2 3
4 5 6
7 8 9

Each of these sequences encode an entire game:

  • 12437 - Player 1 wins
  • 1432965 - Player 1 wins
  • 45628317 - Player 2 wins
  • 157468239 - Draw

Every other number represents the move of one of the players.

This can be a really easy way to play mind TicTacToe whenever you're bored without needing a pen or paper! (But if you're at this stage, you probably won't lose at TicTacToe anyway and will find a better game to play ;-) )

Magic Model

This is essentially a 3x3 Magic Square. A magic square is a grid of distinct numbers that sum to the same number along the rows, columns and diagonals.

The magic square we consider here is the following:

8 1 6
3 5 7
4 9 2

Note how 5 remains in the same place as the mental model but this time the corners are even numbers and edges are odd numbers. Also note that the magic sum is 15 and that we can rotate/flip this square any number of times without changing the meaning.

So now we can simplify (or complexify the game) to the following:

You have a list of numbers from 1 to 9. Each player takes turns to take a number. The objective is to collect any 3 numbers that sum to 15.

This is a fully equivalent game removing the geometric abstraction and also a really cool mathematical interpretation!