Tic-tac-toe

Tic-tac-toe, also spelled tick tack toe, or noughts and crosses as it is known in the UK, Australia, New Zealand, 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.

The following example 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 chess or chinese checkers. This reputation for ease has led to casinos offering gamblers the chance to play tic-tac-toe against trained chickens called chick tac toe—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.

The earliest known variant of tic-tac-toe originated in the Roman Empire around the first century BC. It was called Terni Lapilli and instead of having any number of pieces, each player only had three, thus they had to move them around to empty spaces to keep playing. The game's grid markings have been found chalked all over Rome.

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.

In theory, there are 19,683 possible board layouts (39 since each of the nine spaces can be X, O or blank), and 362,880 (i.e. 9!) different sequences for placing the Xs and Os on the board; that is, without taking into consideration winning combinations which would make many of them unreachable in an actual game.

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 (i.e. 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 (win or draw) given they move according to the highest possible move from 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 a center of that row or column.
  7. Empty Corner: Play in a corner square.
  8. Empty Side: Play in a middle square on any of the 4 sides.

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 English names

The game has a number of alternative English names.

In the United States, the name "noughts and crosses" is not well understood, as the word "nought" is archaic in usage, and where X-shaped objects are not generally called crosses except in the case of specific named crosses like St. Patrick's Cross.

Sometimes, the 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.

History

According to Claudia Zaslavsky's book Tic Tac Toe: And Other Three-In-A Row Games from Ancient Egypt to the Modern Computer, the game Tic Tac Toe is originally from ancient Egypt.[6]

Etymology

The name "tic-tac-toe" may ultimately derive from "tick-tack", the name of an old version of backgammon first described in 1558. The first print reference to "noughts and crosses", the British name for tic-tac-toe, occurred in 1864. The first print reference to a game called "tick-tack-toe" occurred in 1884, but referred to "a children's game played on a slate, consisting in trying with the eyes shut to bring the pencil down on one of the numbers of a set, the number hit being scored". The U.S. renaming of noughts and crosses as tic-tac-toe occurred in the 20th century.[7]

In popular culture

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, "The only winning move is not to play."

References

  1. "Columnist Susan Snyder: Defeat a chicken? Good cluck". http://www.lasvegassun.com/news/2002/jun/21/columnist-susan-snyder-defeat-a-chicken-good-cluck. Retrieved 2008-06-09. 
  2. "Tinkertoys and tic-tac-toe". http://www.rci.rutgers.edu/~cfs/472_html/Intro/TinkertoyComputer/TinkerToy.html. Retrieved 2007-09-27. 
  3. Kevin Crowley, Robert S. Siegler (1993). "Flexible Strategy Use in Young Children’s Tic-Tac-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. 
  5. Oren Patashnik, Qubic: 4 x 4 x 4 Tic-Tac-Toe, Mathematical Magazine 53 (1980) 202-216.
  6. Zaslavsky, Claudia (1982). Tic Tac Toe: And Other Three-In-A Row Games from Ancient Egypt to the Modern Computer. Crowell. ISBN 0690043163. http://www.jacketflap.com/bookdetail.asp?bookid=0690043163. 
  7. Oxford English Dictionary entries for "Noughts and Crosses", "Tick-Tack" and "Tick-Tack-Toe", http://dictionary.oed.com

External links