832: Tic-Tac-Toe

Explain xkcd: It's 'cause you're dumb.
Revision as of 22:36, 6 April 2016 by Demro (talk | contribs) (Errors: Error 5)
Jump to: navigation, search
The only winning move is to play, perfectly, waiting for your opponent to make a mistake.
Title text: The only winning move is to play, perfectly, waiting for your opponent to make a mistake.


Each map shows every possible combination of moves which will result in that side winning or tying. It assumes that X moves first, which is why the map for O has more possible move combinations and, therefore, more subdivisions.

In what follows we will use numpad notation, i.e.:


Note that only optimal moves are shown. This means that X only begins with X7, and all grids and subgrids in Map for X have an X in position 7. For example, you can't find a grid beginning with X2, because X2 is not an optimal move.

In map for O you can find grids beginnig with X2. Since the optimal answer is O5, you won't find X2, O8, for example.

Example 1

The largest red X in Map for X is X7. This means that O must go to cell 7 in Map for O. The largest red O in this subgrid is the center cell O5. Therefore X must magnify cell 5 in the map for X and look for a big red X, which is X3, i.e. in the cell (6, 4) in a 9×9 grid. This can be repeated until one of the players wins or there is a tie.

Example 2

Download http://xkcd.com/832_large/ and edit it. Delete the upper part. Now you have a picture sized 2040×2150 pixels, with title MAP FOR O.

Assume X used the center cell, X5. You as O must magnify the center cell in the 3×3 map for O. Better still, select that cell and delete everything else. Now you have a picture sized 670×670 pixels, with a big red O7 and a big black X5. You must move O7 this time.

Assume X moves X9. You select cell 9, which is 220×220 pixels. Look for the biggest red O, which is O1. You can see you blocked a winning move.

O| |X
O| |

Now X, naively, plays X3 and you select that cell in your editor, which is 73×73 pixels wide and looks like this

O| |X
O| |X

The O in cell 4 is red, which is your winning move.

Title text

The title text is a reference to the 1983 movie WarGames. In that movie, by playing Tic-Tac-Toe the AI realizes that some games cannot be won when all the players play flawlessly, and subsequently concludes that the only way to win at the nuclear warfare "game" is not to play.


In Map for X, the grid for X7, O9, X1, O4, X3 (i.e. go to Map for X, select cell 9, and then select cell 4) shows the same picture for O5 and O6. Those pictures belong to O6. The correct pictures should be:

X| |O    X| |O
-+-+-    -+-+-
O|O|     O| |O
-+-+-    -+-+-
X|X|X    X|X|X

In Map for X, the grid for X7, O1, X9, O8, X3 (i.e. go to Map for X, select cell 1, and then select cell 8) shows the same picture for O2 and O5. Those pictures belong to O2. The correct pictures should be:

O| |X
 | |X

In Map for O, the grid for X8, O5, X2, O6 (i.e. go to Map for O, select cell 8, and then select cell 2) shows the same picture for X1 and X3. Those pictures belong to X3. The correct pictures should be:

 |X|    \   /    |X| 
-+-+-    \ /    -+-+-
O|O|O     X     O|O|O
-+-+-    / \    -+-+-
X| |X   /   \    |X|X

In Map for O, the grid for X2, O5, X8, O4 (i.e. go to Map for O, select cell 2, and then select cell 8) shows the same picture for X7 and X9. Those pictures belong to X7. The correct pictures should be:

X|X|    \   /    |X|X 
-+-+-    \ /    -+-+-
O|O|O     X     O|O|O
-+-+-    / \    -+-+-
 |X|    /   \    |X|

In Map for O, the grid for X6, O5, X4, O2 (i.e. go to Map for O, select cell 6, and then select cell 4) shows the same picture for X1 and X7. Those pictures belong to X1.

See also



[The comic comprises two large square maps, each divided into nine sections, some of which are further subdivided in the same way. The subdivisions continue down for up to five levels, and the lower map has more tiny diagrams than the upper. The smallest divisions at every scale are completed tic-tac-toe games. At the smallest divisions some of the moves are too small to see.]
Complete map of optimal Tic-Tac-Toe moves
Your move is given by the position of the largest red symbol on the grid. When your opponent picks a move, zoom in on the region of the grid where they went. Repeat.
Map for X:
[The first square map.]
Map for O:
[The second square map.]

comment.png add a comment! ⋅ comment.png add a topic (use sparingly)! ⋅ Icons-mini-action refresh blue.gif refresh comments!


This is all wrong. The second move for X, unless O blocked it already, or started off in the centre should be the lower right corner. That way, O will use the centre to block, and then X goes in a third corner, thus sealing the game. 04:59, 23 July 2013 (UTC)

Can you tell which situation you mean? If X starts at 7 and O does not go to 5, then X s a win with the described tactic. There might be other ways to win, but I don't think that matters. --Chtz (talk) 09:11, 23 July 2013 (UTC)
Playing as X, you start in the upper left corner. O plays in any square other than the lower right corner (They might be able to block if they play the centre, depending on whether they anticipate this move). Then, when O blocks the centre, you play the upper right or lower left corner, depending on where O has played before, thus making it impossible to block because they only get one move. The only time this ever fails is when O knows what X is doing after the first move. 19:57, 23 July 2013 (UTC)
If it goes X7, O5, X3, then O must play anywhere but in a corner next (result is symmetric) X has to block and O can hold a draw. Just see the Map for O part. --Chtz (talk) 21:40, 23 July 2013 (UTC)
I don't know the numbers for the squares. There are only nine of them. Could we just refer to them by their positions relative to the rest of the board? 21:44, 23 July 2013 (UTC)
There is more than one way to win. Although X3 does win, as you say, the comic shows an alternative which also has a 100% chance of success. That's right, Jacky720 just signed this (talk | contribs) 00:34, 12 February 2019 (UTC)

There is an error in the drawing when starting with (numpad coordinates) X7, O9, X1, O4, X3: Both O5 and O6 have the same picture. --Chtz (talk) 09:11, 23 July 2013 (UTC)

There is also an error in X7-O1-X9-O8-X3, in which O2 and O5 have the same picture. 02:46, 7 January 2016 (UTC) (And yes, I am reviving a thread from three ago. Happy 2016.)

Tic-Tac-Toe is just a stupid simple game, Randall jokes about that. As the title text says "...waiting for your opponent to make a mistake". And the picture is just a part of this joke.--Dgbrt (talk) 22:04, 23 July 2013 (UTC)

I just don't want to analyze both maps, but I had a college assignment that made me look into Tic Tac Toe strategy, and I think that the explanation should start with "Each map shows every possible combination of moves which will result in that side not losing.". 23:40, 14 January 2014 (UTC)

The quote from War Games is "The only way to win is not to play", and it refers to the game Thermonuclear War, not Tic-Tac-Toe (although that was played earlier in the movie). I don't think the title text was based on this quote, but is only coincidentally similar. (talk) (please sign your comments with ~~~~)

With all due respect, I think the probability that the title text does not reference the movie War Games is so low as to be effectively zero. BTW the whole premise of the resolution of the movie (spoiler alert) is that by playing Tic-Tac-Toe the AI learns the futility of unwinnable 'games'. It then applies this learning to the very real scenarios of thermonuclear war and, realising the futility, stops. Plm-qaz snr (talk) 08:20, 16 August 2014 (UTC)
I think both of you are right in some way, so I fix the text that it do refer to the movie WarGames but to the AI's opinion on the nuclear warfare "game" after learn the concept of unwinnable through Tic-Tac-Toe. Arifsaha (talk) 15:58, 12 September 2014 (UTC)

Those diagrams don't depict every possible situation (e.g. "X2, O8" is missing) (talk) (please sign your comments with ~~~~)

Know any good (but not perfect) tictactoe sims? SilverMagpie (talk) 03:26, 18 April 2017 (UTC)

Could someone please explain how to read the comic?

I feel like I should get it, but I don't know how you're supposed to read this, and the explanation doesn't help. Like, if you want to put down an X somewhere, what do you look at to see what happens in that situation? Mynotoar (talk) 13:35, 6 April 2016 (UTC)

I hope you understand what I added. Demro (talk) 17:38, 6 April 2016 (UTC)
You do what the comic tells you. The comic isn't designed for you to disobey it. That's right, Jacky720 just signed this (talk | contribs) 00:36, 12 February 2019 (UTC)

What would happen if BOTH players used the chart?

I can't do this myself because I'm bad at keeping track of stuff 17:06, 10 December 2019 (UTC)

Every game would end in a tie. 14:30, 11 May 2020 (UTC)

Every game would go like this: (it makes sense in edit)

X—-  X—-  X—-  X—-  XX-  XXO  XXO  XXO. XXO
——-  -O-  -O-  -O-  -O-  -O-  -O-  OO-  OOX
——-  ——-  —-X  -OX  -OX  -OX  XOX  XOX  XOX
I added monospace, whitespace-preserving formatting using
Sollyucko (talk) 12:18, 24 March 2022 (UTC)