Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Tic-tac-toe
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Strategy == [[File:Tictactoe-X.svg|thumb|right|Optimal strategy for player X if starting in upper left. In each grid, the shaded red X denotes the optimal move, and the location of O's next move gives the next subgrid to examine. Only two sequences of moves by O (both starting with the center, top-right, left-mid) lead to a draw, with the remaining sequences leading to wins from X.]] [[File:Tictactoe-O.svg|thumb|right|Optimal strategy for player O. Player O can only force a win or draw by playing in the center first.]] A player can play a [[Solved game#Perfect play|perfect game]] of tic-tac-toe (to win or at least draw) if, each time it is their turn to play, they choose the first available move from the following list, as used in Newell and Simon's 1972 tic-tac-toe program.<ref>{{cite journal|title=Flexible Strategy Use in Young Children's Tic-Tac-Toe|author=Kevin Crowley, Robert S. Siegler|journal=Cognitive Science|volume=17|pages=531β561|year=1993|issue=4 |doi=10.1207/s15516709cog1704_3 |doi-access=free }}</ref> #Win: If the player has two in a row, they can place a third to get three in a row. #Block: If the opponent has two in a row, the player must play the third themselves to block the opponent. #Fork: Cause a scenario where the player has two ways to win (two non-blocked lines of 2). #Blocking an opponent's fork: If there is only one possible fork for the opponent, the player should block it. Otherwise, the player should block all forks in any way that simultaneously allows them to make two in a row. Otherwise, the player should make a two in a row to force the opponent into defending, as long as it does not result in them producing a fork. For example, if "X" has two opposite corners and "O" has the center, "O" must not play a corner move to win. (Playing a corner move in this scenario produces a fork for "X" to win.) #Center: A player marks the center. (If it is the first move of the game, playing a corner move gives the second player more opportunities to make a mistake and may therefore be the better choice; however, it makes no difference between perfect players.) #Opposite corner: If the opponent is in the corner, the player plays the opposite corner. #Empty corner: The player plays in a corner square. #Empty side: The player plays in a middle square on any of the four sides. The first player, who shall be designated "X", has three possible strategically distinct positions to mark during the first turn. Superficially, it might seem that there are nine possible positions, corresponding to the nine squares in the grid. However, by rotating the board, we will find that, in the first turn, every corner mark is strategically equivalent to every other corner mark. The same is true of every edge (side middle) mark. From a strategic point of view, there are therefore only three possible first marks: corner, edge, or center. Player X can win or force a draw from any of these starting marks; however, playing the corner gives the opponent the smallest choice of squares which must be played to avoid losing.<ref>{{cite book|last=Gardner|first=Martin|title=Hexaflexagons and Other Mathematical Diversions|url=https://books.google.com/books?id=QpPlxwSa8akC|year=1988|publisher=University of Chicago Press|isbn=978-0-226-28254-1}}</ref> This might suggest that the corner is the best opening move for X, however another study<ref>{{cite web | last=Kutschera | first=Ant | title=The best opening move in a game of tic-tac-toe | website=The Kitchen in the Zoo | date=April 7, 2018 | url=http://blog.maxant.co.uk/pebble/2018/04/07/1523086680000.html | access-date=August 29, 2019}}</ref> shows that if the players are not perfect, an opening move in the center is best for X. The second player, who shall be designated "O", must respond to X's opening mark in such a way as to avoid the forced win. Player O must always respond to a corner opening with a center mark, and to a center opening with a corner mark. An edge opening must be answered either with a center mark, a corner mark next to the X, or an edge mark opposite the X. Any other responses will allow X to force the win. Once the opening is completed, O's task is to follow the above list of priorities in order to force the draw, or else to gain a win if X makes a weak play. More detailed, to guarantee a draw, O should adopt the following strategies: * If X plays a corner opening move, O should take center, and then an edge, forcing X to block in the next move. This will stop any forks from happening. When both X and O are perfect players and X chooses to start by marking a corner, O takes the center, and X takes the corner opposite the original. In that case, O is free to choose any edge as its second move. However, if X is not a perfect player and has played a corner and then an edge, O should not play the opposite edge as its second move, because then X is not forced to block in the next move and can fork. * If X plays edge opening move, O should take center or one of the corners adjacent to X, and then follow the above list of priorities, mainly paying attention to block forks. With perfect play, O can also force a draw by taking the opposite edge from X. * If X plays the center opening move, O should take a corner, and then follow the above list of priorities, mainly paying attention to block forks. When X plays corner first, and O is not a perfect player, the following may happen: * If O responds with a center mark (best move for them), a perfect X player will take the corner opposite the original. Then O should play an edge. However, if O plays a corner as its second move, a perfect X player will mark the remaining corner, blocking O's 3-in-a-row and making their own fork. * If O responds with a corner mark, X is guaranteed to win. By taking any of the other two corners, O can only take the position between the two Xs, then by taking the remaining corner to create a fork, X will win on the next move. * If O responds with an edge mark, X is guaranteed to win. By taking center, O can only take the corner opposite the corner which X plays first, then by taking a corner to create a fork, X will win on the next move. === Further details === Consider a board with the nine positions numbered as follows: {| class="wikitable" |<big>{{spaces|en}}1{{spaces|en}}</big> |<big>{{spaces|en}}2{{spaces|en}}</big> |<big>{{spaces|en}}3{{spaces|en}}</big> |- |<big>{{spaces|en}}4{{spaces|en}}</big> |<big>{{spaces|en}}5{{spaces|en}}</big> |<big>{{spaces|en}}6{{spaces|en}}</big> |- |<big>{{spaces|en}}7{{spaces|en}}</big> |<big>{{spaces|en}}8{{spaces|en}}</big> |<big>{{spaces|en}}9{{spaces|en}}</big> |} When X plays 1 as their opening move, then O should take 5. Then X takes 9 (in this situation, O should not take 3 or 7, O should take 2, 4, 6 or 8): * X1 β O5 β X9 β O2 β X8 β O7 β X3 β O6 β X4, this game will be a draw. or 6 (in this situation, O should not take 4 or 7, O should take 2, 3, 8 or 9. In fact, taking 9 is the best move, since a non-perfect player X may take 4, then O can take 7 to win). * X1 β O5 β X6 β O2 β X8, then O should not take 3, or X can take 7 to win, and O should not take 4, or X can take 9 to win, O should take 7 or 9. ** X1 β O5 β X6 β O2 β X8 β O7 β X3 β O9 β X4, this game will be a draw. ** X1 β O5 β X6 β O2 β X8 β O9 β X4 (7) β O7 (4) β X3, this game will be a draw. * X1 β O5 β X6 β O3 β X7 β O4 β X8 (9) β O9 (8) β X2, this game will be a draw. * X1 β O5 β X6 β O8 β X2 β O3 β X7 β O4 β X9, this game will be a draw. * X1 β O5 β X6 β O9, then X should not take 4, or O can take 7 to win, X should take 2, 3, 7 or 8. ** X1 β O5 β X6 β O9 β X2 β O3 β X7 β O4 β X8, this game will be a draw. ** X1 β O5 β X6 β O9 β X3 β O2 β X8 β O4 (7) β X7 (4), this game will be a draw. ** X1 β O5 β X6 β O9 β X7 β O4 β X2 (3) β O3 (2) β X8, this game will be a draw. ** X1 β O5 β X6 β O9 β X8 β O2 (3, 4, 7) β X4/7 (4/7, 2/3, 2/3) β O7/4 (7/4, 3/2, 3/2) β X3 (2, 7, 4), this game will be a draw. In both of these situations (X takes 9 or 6 as the second move), X has a {{sfrac|1|3}} property to win. If X is not a perfect player, X may take 2 or 3 as a second move. Then this game will be a draw, X cannot win. * X1 β O5 β X2 β O3 β X7 β O4 β X6 β O8 (9) β X9 (8), this game will be a draw. * X1 β O5 β X3 β O2 β X8 β O4 (6) β X6 (4) β O9 (7) β X7 (9), this game will be a draw. If X plays 1 opening move, and O is not a perfect player, the following may happen: Although O takes the only good position (5) as the first move, O takes a bad position as the second move: * X1 β O5 β X9 β O3 β X7, then X can take 4 or 8 to win. * X1 β O5 β X6 β O4 β X3, then X can take 7 or 9 to win. * X1 β O5 β X6 β O7 β X3, then X can take 2 or 9 to win. Although O takes good positions in the first two moves, O takes a bad position in the third move: * X1 β O5 β X6 β O2 β X8 β O3 β X7, then X can take 4 or 9 to win. * X1 β O5 β X6 β O2 β X8 β O4 β X9, then X can take 3 or 7 to win. O takes a bad position as first move (except of 5, all other positions are bad): * X1 β O3 β X7 β O4 β X9, then X can take 5 or 8 to win. * X1 β O9 β X3 β O2 β X7, then X can take 4 or 5 to win. * X1 β O2 β X5 β O9 β X7, then X can take 3 or 4 to win. * X1 β O6 β X5 β O9 β X3, then X can take 2 or 7 to win.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)