Posted in History & Literature

Tic Tac Toe

Tic Tac Toe is a simple game where you and an opponent make a mark (X or O) on a 3×3 grid once per turn, until one person has made a line of three marks in a row (horizontal, vertical or diagonal).

However, it is so simple that there are only a certain number of permutations, meaning that if you know the algorithm, you can win most of your games (assuming your opponent does not also know the algorithm). This is called a solved game – unlike chess, where there is a near infinite number of ways the game can play out.

First, let’s take the case of you starting first. Put a X in a corner. If your opponent does not put an O in the centre, you automatically win. Your next move is to put an X in any corner away from the O. Your opponent will have to put an O between the two X’s to prevent a loss. Once they do this, you can either put an X in the centre or another corner to create two possible winning moves and your opponent can only block one. You win.

If your opponent puts their O in the centre, things get more complicated. Now you can only win if your opponent makes a mistake – otherwise the game is guaranteed to end in a draw. You can take one of two options:

– Place an X in the corner diagonally opposite to your first X. If your opponent puts an O in a corner, you win by putting an X on the last corner to block their attack and create your own double-attack.
– Place an X on an edge square that is not next to your X. You can win if your opponent puts an O in a corner not next to an X by blocking their attack and creating a double-attack.

If your opponent plays first, then you can never lose. If an opponent starts in the corner, put your X in the centre. All you have to do now is block your opponent’s attacks and you will force a draw.
The same strategy applies if your opponent starts in the centre – put an X in any corner then block every attack. The game will end in a draw unless your opponent slips up.

As you can see, there are only so many ways a game can play out, meaning it is very easy to force a draw.
A more interesting game is omok (오목 in Korean, gomoku in Japanese) – where you put white or black stones on a 15×15 board to try and connect five stones in a row.