Tic-Tac-Toe Strategy - Stephen Ostermiller

graceacupuncture - 10/06/2022 - STRATEGY - 721 Views

Zero Sum Game

If you know what you are doing, you can't lose at Tic-Tac-Toe.If your opponent knows what they are doing, you can't win at Tic-Tac-Toe.The game is a zero sum game.If both players are playing with an optimal strategy, every game will end in a tie.

Surpisingly few people know optimal Tic-Tac-Toe stategy. Yes there are some people (and computers) that you will never beat, but they are relatively rare.Knowing this, you can become a Tic-Tac-Toe master.

Before getting started, open a Tic-Tac-Toe playing board in a new browser window so that you can experiment while you read this article.

Players

There are four player types in Tic-Tac-Toe.

The Novice player makes random movesThe Intermediate player will blocks their opponent from winningThe Experienced player knows that playing in certain first squares will lose the gameThe Expert player will never lose

Pitting these players against each other, you can see that in all cases, the better player wins more.

Experimental win statistics after 1000 games for each matchingPlayer TwoNoviceIntermediateExperiencedExpertPlayer OneNovice1 wins: 57.1%2 wins: 30.6%Ties: 12.3%1 wins: 6.40%2 wins: 68.3%Ties: 25.3%1 wins: 2.60%2 wins: 76.4%Ties: 21.0%1 wins: 0.00%2 wins: 79.6%Ties: 20.4%Intermediate1 wins: 90.4%2 wins: 1.60%Ties: 8.00%1 wins: 31.6%2 wins: 17.1%Ties: 51.3%1 wins: 16.1%2 wins: 10.3%Ties: 73.6%1 wins: 0.00%2 wins: 16.1%Ties: 83.9%Experienced1 wins: 90.8%2 wins: .700%Ties: 8.50%1 wins: 35.5%2 wins: 11.7%Ties: 52.8%1 wins: 13.3%2 wins: .800%Ties: 85.9%1 wins: 0.00%2 wins: 1.70%Ties: 98.3%Expert1 wins: 97.8%2 wins: 0.00%Ties: 2.20%1 wins: 76.6%2 wins: 0.00%Ties: 23.4%1 wins: 27.1%2 wins: 0.00%Ties: 72.9%1 wins: 0.00%2 wins: 0.00%Ties: 100.%

On the Tic-Tac-Toe game board that you have opened in a new window, choose the "Expert" type for each player and hit "New Game".Verify that the result of each game is a tie (cat's game).

Cat's GameOXOOXXXOX

Neither of the computer players can be beaten because they are playing as well as game can be played.The computer does this by playing out every single game of Tic-Tac-Toe ahead of time and figuring out which moves are good and which are bad.The computer can do this because there are not a lot of possible games.The first move can be played in any of nine squares, the second in any of eight squares, the third in any of seven squares and so on.That means there are at most nine factorial or 362,880 possible games.A computer can breeze though 400,000 games in a blink of an eye.In reality, it has to play far fewer games than that.There are only 125,168 games of Tic-Tac-Toe because somebody wins most of them before all off the squares have been filled.The Tic-Tac-Toe is symetrical and if the computer can realize that many games are the same because it could rotate the board, there are even fewer games than that.Suffice to say that computers win through brute force.

So how can a human become unbeatable in Tic-Tac-Toe?A human doesn't even have time to play out one hundred games in the mind and still make a move in a reasonable amount of time. However, a human can compensate with experience and reasoning.

A player that moves randomly will not see that an opponent should be blocked.O XOX

Tic-Tac-Toe Strategy - Stephen Ostermiller

Everybody can beat the "Novice" player virtually every game.Set one player to Novice and the other to human and observe how easy it is to beat the novice.

The novice simply places its mark in any empty square.This stategy is very poor and almost never wins.

A reactionary player will block an opponent's win.O XO

X

Most Tic-Tac-Toe players start off as reactionary players.Reactionary players will block their opponents three in a row, or take any three in a row that they can.Otherwise, they play like a novice and choose random moves.This style of play is what the "Intermediate" computer player uses.

The experienced player knows the best starting moves.The stategies below explain these moves in detail.

Strategies

If two intermediate players play many games.The player that goes first will win about twice as often as the player that goes second.Verify this for yourself by pitting two intermediate players against each other and watching the stats as you have them play many new games.

On some level this makes sense.There are only nine squares on a Tic-Tac-Toe board, the first player will get five of them but the second player will only get four.

When two experts play, the game always ends in a tie.In all other cases, the player that goes first wins far more than they would have if their opponent had gone first.

Safe moves for player 1's first move

Player 1

If you are going first, know the safe first moves.The trick is to avoid the edges.The corners and the center are safe moves:

Player 2

There are two possibilities.Either player 1 tookthe corner, or the center.

Safe moves for player 2's first move (player 1 in center)X

Safe moves for player 2's first move (player 1 in corner)X

Best moves for player 1's first move

If player 1 moves in the corner for the first move, player 2 must take the center.If player 1 is playing against a novice, player 1 can be ruthless and always play in the corner first.That leaves a lot of board for novice to choose from and player 1 will win more often.

The first moves (or opening book) are the hardest to figure out.Beyond the first move, it doesn't take much practice to move from being an experienced player to being an expert player.One good way to go about it is to play the fool against a computer expert player and see how you get beaten.Try known bad first moves and see how the compuer can outwit you every time.Beyond this point, I leave becoming an expert as an exercise to the reader.