Tic-tac-toe

Tic-tac-toe, also called noughts and crosses, hugs and kisses, and many other names, is a pencil-and-paper game for two players, O and X, who take turns marking the spaces in a 3×3 grid, usually X going first. The player who succeeds in placing three respective marks in a horizontal, vertical or diagonal row wins the game. This game is won by the first player, X:

Game of tic-tac-toe, won by X

Players soon discover that best play from both parties leads to a draw. Hence, tic-tac-toe is most often played by young children; when they have discovered an unbeatable strategy they move on to more sophisticated games such as dots and boxes or 12 Cell tic-tac-toe. This reputation for ease has led to casinos offering gamblers the chance to play tic-tac-toe against trained chickens—though the chicken is advised by a computer program.[1]

The first two plies of the game tree for tic-tac-toe

The simplicity of tic-tac-toe makes it ideal as a pedagogical tool for teaching the concepts of combinatorial game theory and the branch of artificial intelligence that deals with the searching of game trees. It is straightforward to write a computer program to play tic-tac-toe perfectly, to enumerate the 765 essentially different positions (the state space complexity), or the 26,830 possible games up to rotations and reflections (the game tree complexity) on this space.

The first known video game, OXO (or Noughts and Crosses, 1952) for the EDSAC computer played perfect games of tic-tac-toe against a human opponent.

One example of a Tic-Tac-Toe playing computer is the Tinkertoy computer, developed by MIT students, and made out of Tinker Toys[2]. It only plays Tic-Tac-Toe and has never lost a game. It is currently on display at the Museum of Science, Boston.

Contents

Number of possible games

Despite its apparent simplicity, it requires some complex mathematics to determine the number of possible games. This is further complicated by the definitions used when setting the conditions.

Simplistically, there are 362,880 (ie. 9!) ways of placing Xs and Os on the board, without regard to winning combinations.

When winning combinations are considered, there are 255,168 possible games. Assuming that X makes the first move every time:

  • 1,440 are won by (X) after 5 moves
  • 47,952 are won by (X) after 7 moves
  • 81,792 are won by (X) after 9 moves
  • 5,328 are won by (O) after 6 moves
  • 72,576 are won by (O) after 8 moves

Ignoring the sequence of Xs and Os, and after eliminating symmetrical outcomes (ie. rotations and/or reflections of other outcomes), there are only 138 unique outcomes. Assuming once again that X makes the first move every time:

  • 21 won by (X) after 5 moves
  • 58 won by (X) after 7 moves
  • 12 won by (X) after 9 moves
  • 21 won by (O) after 6 moves
  • 23 won by (O) after 8 moves

Strategy

A player can play perfect tic-tac-toe if they choose the move with the highest priority in the following table[3].

  1. Win: If you have two in a row, play the third to get three in a row.
  2. Block: If the opponent has two in a row, play the third to block them.
  3. Fork: Create an opportunity where you can win in two ways.
  4. Block Opponent's Fork:
    Option 1: Create two in a row to force the opponent into defending, as long as it doesn't result in them creating a fork or winning. For example, if "X" has a corner, "O" has the center, and "X" has the opposite corner as well, "O" must not play a corner in order to win. (Playing a corner in this scenario creates a fork for "X" to win.)
    Option 2: If there is a configuration where the opponent can fork, block that fork.
  5. Center: Play the center.
  6. Opposite Corner: If the opponent is in the corner, play the opposite corner.
  7. Empty Corner: Play an empty corner.
  8. Empty Side: Play an empty side.

The first player, whom we shall designate "X," has 3 possible positions to mark during the first turn. Superficially, it might seem that there are 9 possible positions, corresponding to the 9 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 mark. For strategy purposes, 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[4].

The second player, whom we shall designate "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.

Variations

Many board games share the element of trying to be the first to get n-in-a-row: three men's morris, nine men's morris, pente, gomoku, Qubic, Connect Four, Quarto, Gobblet. The m,n,k-games are a family of generalized games based on tic-tac-toe.

Alternative names

The game has a number of alternative English names.

Sometimes, the names of the games Tic-tac-toe (where players keep adding "pieces") and Three Men's Morris (where pieces start to move after a certain number have been placed) are confused.

In fiction

In the 1983 film WarGames, tic-tac-toe is used as an allegory for nuclear war. In the climax of the film, the protagonist prevents an out of control military defense computer from launching nuclear missiles by making it repeatedly play tic-tac-toe against itself. After quickly learning that good strategy by both players produces no winner, the computer then plays through all known nuclear strike scenarios, again finding no winner. The computer concludes that "The only winning move is not to play."

In The Legend of Kyrandia Book 3: Malcolm's Revenge, the protagonist Malcolm is taken captive by the Fish Queen who routinely forcefully summons him for a game of tic-tac-toe using human pieces.

References

  1. "Columnist Susan Snyder: Defeat a chicken? Good cluck". Retrieved on 2008-06-09.
  2. "Tinkertoys and tic-tac-toe". Retrieved on 2007-09-27.
  3. Kevin Crowley, Robert S. Siegler (1993). "Flexible Strategy Use in Young Children’s Tic-Tat-Toe". Cognitive Science 17: 531–561. doi:10.1016/0364-0213(93)90003-Q. 
  4. Martin Gardner (1988). Hexaflexagons and Other Mathematical Diversions. University of Chicago Press. 

External links