Stealing pages from the server...

Develop Strategy for Tic-Tac-Toe


Introduction

Tic-tac-toe is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a diagonal, horizontal, or vertical row is the winner. It is a solved game with a forced draw assuming best play from both players. In this article, I want to discuss whether there’s a must-win strategy for this game.

Gameplay

In order to win the game, a player must place three of their marks in a horizontal, vertical, or diagonal row. The following example game is won by the first player, X:

Play it Yourself

Entertain yourself!



Combinatorics

When considering only the state of the board, and after taking into account board symmetries (i.e. rotations and reflections), there are only 138 terminal board positions. A combinatorics study of the game shows that when “X” makes the first move every time, the game outcomes are as follows:

  • 91 distinct positions are won by (X)
  • 44 distinct positions are won by (O)
  • 3 distinct positions are drawn (often called a “cat’s game”)

Strategy

In essence, there are only 6 endings, 3 different opening moves and 2 different results.

There are three positions on tic-tac-toe game board:

  • center
  • corner
  • edge

We will look through this in detail. Let’s assume you are O.

Center First

Center first, edge next, resulting in winning.

Center first, edge next, resulting in draw.

Corner First

Corner first, center next, resulting in draw.

Corner first, no matter what’s next, resulting in winning.

Edge First

Edge first, edge beside it next, resulting in winning.

Edge first, center next, resulting in draw.

Discover

From here you can see the tic-tac-toe, for the backhand, it is a very disadvantageous situation.

  1. The first hand to the center and the second hand must play the corner, otherwise the backhand will lose.
  2. First to the corner and the second hand must play the center to grab a draw, otherwise the backhand will lose.
  3. First play the edge side, if the second hand plays the proximal edge, then the second hand must lose, the other places are draws.

According to BoardGameGeek, the US board game credibility website, tic-tac-toe is ranked 20480, which is at the bottom of the list of all rated games. Why tic-tac-toe sucks? Zermelo’s theorem proves that if the following conditions are satisfied, then either one of the parties must win or else there must be a draw.

  1. Two-player game : A and B play each other.
  2. The game is Perfect Information: everything is spread out in the sun, nothing like a “Bridge” that you can’t see.
  3. No Randomness: You won’t be asked to roll a die midway through the game.
  4. The total number of rounds in the game is capped at N.

The above conditions are obviously met by the tic-tac-toe. For the tic-tac-toe, the game will definitely end in 9 hands at worst.

Conclusion

Tic tac toe is a classic game. It can be played virtually anywhere and on anything, from a bar napkin to a computer screen!

References

  1. http://www.javascriptkit.com/script/script2/tactoe.shtml
  2. https://www.dcard.tw/f/funny/p/234877959
  3. https://en.wikipedia.org/wiki/Tic-tac-toe

Author: Yang Wang
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Yang Wang !
 Previous
Viterbi Algorithm for HMM Decoding Viterbi Algorithm for HMM Decoding
Viterbi Algorithm is usually used to find the most likely sequence in HMM. It is now also commonly used in speech recognition, speech synthesis, diarization, keyword spotting, computational linguistics, and bioinformatics. This semester, in the course "Speech Technology", the acoustic signal is treated as the observed sequence of events, and a string of text is considered to be the hidden cause of the acoustic signal in speech recognition task. The Viterbi algorithm finds the most likely string of text given the acoustic signal.
2021-04-17
Next 
Dissertation Paraphraser Dissertation Paraphraser
Paraphrasing and summarizing are vital so that you essay doesn't become one long quote of other academics' work. To paraphrase a piece of text is to write it in your own words. In this article, I will show you how I make an app that will help me rephrase the sentence I need.
2021-03-31
  TOC