I have been told that it is possible to guarantee no worse than a tie in normal 3x3 tic-tac-toe, but that the first move is very important. What is that important first move?
-
1$\begingroup$ See related discussion at meta meta.puzzling.stackexchange.com/questions/63/… $\endgroup$– James JenkinsCommented May 15, 2014 at 12:31
-
$\begingroup$ a few years back out of curiosity, I worked this out. but looks like some other people have already nailed it.(stick with a corner) $\endgroup$– HashbrownsCommented Mar 9, 2017 at 16:18
-
1$\begingroup$ The optimal first move is to choose to play against a complete beginner. It is the only way to win. $\endgroup$– Florian FCommented Oct 25, 2021 at 20:06
6 Answers
Tic-tac-toe has been solved. The optimal first move is to go in the corner.
As always, there is a relevant xkcd.
-
1$\begingroup$ This is actually the most comprehensive answer yet. Wish I'd thought of it. $\endgroup$– XynarizCommented May 14, 2014 at 22:16
-
1$\begingroup$ @Xynariz: Oddly, you did think of it first according to the timestamp on this comment; that diagram is in the link you provided. $\endgroup$– blundersCommented May 15, 2014 at 2:48
-
5$\begingroup$ I'm a bit sorry for 'stealing' the accepted answer like this. Using xkcd is a surefire way to get a high scoring answer. $\endgroup$– SQBCommented May 15, 2014 at 7:27
-
1$\begingroup$ I didn't accept the answer because it was from XKCD, I accepted it because it is the most complete answer, followed (currently) by Kendall's. $\endgroup$– XynarizCommented May 16, 2014 at 2:04
-
$\begingroup$ As much as I like everything xkcd does, this particular visualisation is actually a bit hard to read, if you were going to try to use it for strategising. $\endgroup$– HakanaiCommented Nov 20, 2017 at 4:48
The first move can be made anywhere without sacrificing the game. If the opponent plays perfectly, any first move leads to a draw.
However, if the opponent does not play perfectly, then the optimal place to go is the corner, since that leaves only one spot (the center) for the opponent to go to get a draw, increasing their chance of making a mistake.
-
1$\begingroup$ Also, even if they do go in the center, you can go in the opposite corner and if they play in a third corner you win, also. $\endgroup$ Commented May 14, 2014 at 21:52
-
3$\begingroup$ You could also add that, since you are obviously playing against a human, you should keep changing your starting position (not going for the corner every time) so that the opponent takes more time to learn the perfect strategy. $\endgroup$ Commented Apr 19, 2015 at 15:58
-
$\begingroup$ @kendall frey Why the corner - do you have any references? $\endgroup$ Commented Apr 7, 2018 at 21:09
If you're first: Go in a corner.
If you're second, and the first person went in a corner: Go in the middle.
From both of these positions, it is possible to guarantee no worse than a tie.
-
4$\begingroup$ It would be nice seeing the data to back this up. $\endgroup$ Commented May 14, 2014 at 21:45
-
4$\begingroup$ en.wikipedia.org/wiki/Tic-tac-toe#Strategy $\endgroup$– XynarizCommented May 14, 2014 at 21:57
-
6$\begingroup$ To guarantee no worse than a tie, the first move makes no difference. It's the second move that's important. $\endgroup$ Commented May 21, 2014 at 5:14
-
$\begingroup$ Wikipedia does not say that starting in the corner is best. $\endgroup$ Commented Apr 7, 2018 at 21:10
There is a nice article analyzing the Tic Tac Toe first move strategy at https://paperandpencilgames.com/2019/02/tic-tac-toe-strategy-tutorial.html
To address the reviewers comments, here is the conclusion of the article. There is no way of winning against a "perfect player". Choosing a corner as the first move gives you the best chance of winning against a less experienced opponent. Even if your opponent is a "perfect player" you can still tie the game.
-
1$\begingroup$ I am new to this site. Thank you for your reviews. I updated my answer to address your comments. $\endgroup$– DomosedCommented Feb 8, 2019 at 18:53
From experience of playing against kids that don't have the game solved (daughters, ages 5 and 7 at the time of play), starting in the corner gave about 1/3 chance to win and starting in the center gave about 5/6 for first few games and then 2/3.
Starting in the corner: everyone put o
in the center. Nearly always. It just looks so inviting. Then I put it in the opposite corner. Then, chance of their draw was about 2/3 theoretically - chance they put o
somewhere on the side, forcing me to block and then we rapidly fill the whole board by eliminating the obvious 3 in a line options. (well, it was about 1/2 as they sometimes didn't see upcoming 3 in a line)
Starting in the center: in the first few games (more with younger daughter), win chances are pretty good - half of the time they put their first o
on the edge instead of the corner. If they don't fail this test, then I am putting another x
in the same line so their first o
now blocks my line. Probability they are putting o
randomly in one of remaining corners is just 1/3. So, probability of my win starts at about about 5/6 initially (1/2 * 1/3 they make the correct first two moves), though it fairly quickly drops to 2/3 where it remains longer.
Interestingly, after they learn how to play against starting in the center, starting in the corner gives a great winning chances for a game or two because they will then try blocking in the corner as learned previously.
I might retest how much they forgot.
One way to answer this is to consider all 255,168 possible games of tic-tac-toe and record if they result in a win, draw or loss for the starting player and analysing where the first move was for each of those games. According to such an analysis, opening in the centre is best, in this case.
Taking it a step further, about 90% of those games are "stupid" because they include moves where players either miss the chance to win immediately or they miss blocking the opponent who can win in their next move. If you disregard those games, then the best opening move becomes a question of how you define "best". If you consider the number of winning games that there are after opening, then an edge opening is best. If you want to avoid drawing or losing, then the center is best. You can combine those results, say weighting winning with a factor of one hundred, drawing with a factor of 10 and losing with a factor of -1. This results in the center again being the best place to start.
In contradiction to most of the answers here, starting in the corner is hence not the best move, when using the number of games that can be played from an opening move as an indicator of what is "best".
-
$\begingroup$ I came to a similar conclusion by thinking about possible win configurations. The center square has 4 configurations for a win (two diagonals, and a plus in the middle) whereas the corners have only three. I wonder if there's something we're missing! $\endgroup$– rtindruCommented Oct 30, 2020 at 1:02
-
$\begingroup$ I wrote a program and came to the same conclusion. It assumes both players play perfectly (always block when required, always win when able, ~45K combinations), and uses minimax with probabilities (value of a node is average of all child nodes). Starting at a corner gives a 23.5% chance of winning and starting in the center gives a 25.8% chance of winning. $\endgroup$– aiwlCommented Apr 13, 2021 at 19:15
-
$\begingroup$ Correction, I don't believe it gave the probability but the weighted average of scores, if a win had a value of 1. In the case a win is given the value equal to the number of moves left (higher value for earlier win), the result is the same. $\endgroup$– aiwlCommented Apr 14, 2021 at 8:43