Tic-tac-toe winning scheme. Board game secrets: how to win at tic-tac-toe. Cunning strategy for crosses

At school I was a tic-tac-toe champion, playing without knowing defeat. This game was a favorite way to pass the time before recess in boring lessons.

When there was computer games and applications for smartphones, we just had to play with a squared notebook sheet and a pencil. In winter, tic-tac-toe was played outside, drawing the playing field with a twig in the snow.

Nowadays childhood games have acquired a "mobile" character and are available online. But the rules of the game and the strategy for winning remained the same. Having mastered the simple algorithm from this note, you can easily win tic-tac-toe from Zoe, beat 5 in a row in the meta school and never lose to a living person.

Tic-tac-toe, game rules

The playing field is a 3x3 square drawn on a piece of paper and lined with nine cells. Two lines are drawn along the square, two lines across.

The options when the playing field has dimensions from 4 x 4 to infinity, we will consider below, after analyzing the combinations of the game in the 3x3 field.

The basic principles are general, and having mastered the "match three" algorithm, you can confidently play more complex and interesting versions of this ancient game.

The player who plays with crosses makes the first move. The second turn is for the player playing with zeroes. The crosses have already occupied one cell, and the zeroes for the move choose an empty one from the remaining cells.

The players take turns changing who to play for noughts and crosses.

The ancient Chinese instead of the drawn symbols "X" and "0" on the field put stones, black and white. Now at home you can use a chessboard as a field and use checkers to mark the cell to which the move is made.

The first player to build wins (within playing field) a line of three of its symbols: horizontal, vertical or diagonal.

Winning strategy step by step video analysis

A short video clip for those who find it easier to perceive information. For those who are more interested in reading, we scroll further.

    There are two possible outcomes of the game:

  1. You won.
  2. Draw. We ran out of empty cells on the playing field and there is nowhere else to go.

We do not consider the option "You have lost", since those who have read this article to the end are not in danger of losing. I won't teach you how to win all the time, but I will tell you how you can always bring the game to a draw.

For the convenience of the story, I designated each square of the playing field with numbers, from 1 to 9.

(5) - central cell.

(1), (3), (7), (9) - corner cells.

(2), (4), (6), (8) - side cells.

In order not to stretch the story, I will consider one combination for each variant of the first move. If in my example the zeros went to the corner cage (1), and in your case to the corner cage (3), (7) or (9), then mentally unfold the field and continue walking according to the algorithm I described.

Situation number 1, crosses go to the center

When the crosses occupy the central square (5) with the first move, the zeroes have to go to the corner or side square.

On this move, everything is already decided. Zeroes went to the corner cage - it's a draw. If the zeroes went to any side cell, you won. You can start a new game, this game will no longer make sense.

In our example, the zeroes went into the side cage (8).

Crosses with a reciprocal move occupy any corner cell, for example, cell (1) and get a line of two crosses (see figure).

The main wisdom of the game and the basis of all tactics is based on two principles:

Principle 1. Occupy the cell that will bring you immediate victory;

Principle 2. If there is no such cell, occupy the cell that will bring immediate victory to your opponent.

The zeros now cannot win on their own and, according to the second principle, occupy the cell (9), in turn forming a line of two zeros, see step 4.

The crosses occupying the cell (7) neutralize the threat from the zeroes and at the same time build two lines from their figures. To win in the next move, the crosses will need to occupy square (3) or (4). See step 5.

Such a formation, when two threats are created with one move, is called FORK.

The toes in the sixth step, having occupied the cell (3), close one threat from the side of the crosses.

Crosses according to the principle of 1, go to the cell (4) and win.

Situation number 2, crosses go to the center

Suppose you are now playing with zeroes. In order not to lose this meeting, the first move is to take the corner cage. It doesn't matter which one, according to your taste (1), (3), (7) or (9). Let's take (1) as an example, see the figure below, step 2.

The crosses, again no matter where they go, will get a line of two figures. see step 3.

The toes close the line of crosses, and create their own threat - see step 4.

According to the principle of 2, crosses go into a square (4), zeroes correspond to a square (6). See step 5 and 6.

Regardless of what the previous move of the crosses was, the zeroes should occupy the remaining free side cell (2) or (8). The crosses occupy the last free cell - the game is over in a draw.

Forks to crosses with such a beginning of the game will not work, but they will not give noughts either. If, through inattention, after the 6th step, the zeroes go into the corner cage (9) instead of the side cage (2) or (8), then the crosses will win by building a horizontal line (2) - (5) - (8).

Situation number 3, crosses go to the corner

Again you play with crosses, now for a change we go to the corner, no matter what the corner cell is. See fig. below, step1.

The move of zeroes, as in situation # 1, the outcome of the game depends on this move. If the zeroes went into the side cage, then you build a fork and win.

If the zeroes take the center or corner square with the first move, there will be a draw. Noughts will have to rely on your carelessness, which will give them victory. But in our example, such an outcome of events is not provided.

In the case of a move with zeroes to a side square, step 2, you occupy one more corner square, forming a threat - a line of two pieces. See step 3.

Center, cell (5) will deliberately leave empty for zeros. Often, the zeroes, instead of covering your threat with a move to the side square (2), happily occupy the center.

If the enemy fell for a trick and went into the cell (5), we occupy the cell (2) and the line is built (1) - (2) - (3)

Let's not underestimate the opponent, and in step 4 he closed our threat with a move to the side square (2)

The crosses have no choice but to occupy the central square (5) according to the first principle and build a fork.

Now, see step 6, wherever the zero touches, we will have one of the two corner cells (7) or (9) free, the move to which will bring us victory.

Situation number 4, crosses go to the side cell

The move itself is not justified in terms of a future victory. The outcomes are a draw, or a loss due to inattention.

You can independently consider a combination when you put yourself in a tactically disadvantageous position from the first move, relying on the above two principles of the game.

Renju, pearl string, gomoku, five in a row

When you feel cramped and bored in the 3x3 playing field, and playing three in a row is no longer sporting, we move on to a large playing area.

Renju - persistent logic game for two players, was known back in ancient China and Japan. A sporty take on the classic tic-tac-toe.

The playing field for renju has dimensions of 15x15 and more. This is where the scope for strategies and tactics begins. Each batch is unique.

The player who is the first to build a line of five pieces of his color wins as well. The line can be in any direction - diagonal, vertical, horizontal.

For the convenience of playing long lines (five in a row), noughts and crosses should be different in color. Otherwise, the eye will become blurry and other people's chips can be mistaken for theirs, tk. they are the same color, albeit in different shapes. In the classic version, the chips (stones, circles) that the players move are black and white.

According to the rules, Black makes the first move and it is forbidden for them to make forks 3x3, 4x4, as well as a row of 6 or more "stones" of their color in a row.

On the other hand, Black can make 3x4 forks, when two crossing lines are formed in one move - one of three stones long, the other of 4 stones. So there is no reason for someone who plays white to relax.

    White, for moving second, has the following advantages:

  • They can build forks of any size and any multiplicity;
  • White's victory is brought by the line not only 5 in a row, but also from a larger number of stones;
  • To win, White can force Black to build a line of 6 or more stones in a row.

Draw

A player can skip a move if at the moment it is not profitable for him to change the location of his stones on the playing field.

If both players in a row refuse to move, a draw is declared.

All free cells have run out - a draw.

It turns out that the player can still miss a move, because he has nowhere to go.

Gomoku, differences from Renju

  1. There are no fouls (illegal moves) for Black, and Black can build forks of any multiplicity and length.
  2. A row of six or more stones of the same color does not bring victory to either side.

Gomoku have softer rules for the convenience of playing in everyday life. Renju rules are sport-oriented.

Services where you can play online

All services for playing online have modes of playing with a computer, with another user and a second player who is next to you.

Also, almost everyone has a version of the game of renju. The links are given below, on all sites I have personally played. Compulsory registration is not required.

I recommend a service where your opponent is a live person. There are services where the computer is very weak, where it plays strongly or the game looks out of the box. But all computers play poorly long version five in a row. If there was a tie in tic-tac-toe, then the computer loses in Renju.

On this note, I say goodbye to you and until we meet again on the pages of my diary. Do not forget to subscribe to updates - next time I will tell you how to always win in sea battles.

Alexander Utyshev was with you

Did you know that with the help of strategies in the game of tic-tac-toe, you can win with an 80% probability? We will talk about this further in the article!

This article is for people over 18 years of age.

Have you already turned 18?

The game of tic-tac-toe is familiar to both an adult and a kid. When playing it, it is important to leave the last decision to yourself. If the player's crosses or zeroes do not line up or diagonally, then he will be defeated. In order not to get into an unpleasant situation, you need to know the secret of how to win at tic-tac-toe.

How to win at tic-tac-toe?

The most popular is the game on a nine-cell field. The field consists of three squares horizontally and three vertically.

As always, first draw a field and choose a cross and a zero. The first question that I would like to clarify is whether it is possible to win against an opponent if you have a cross? The answer is affirmative, since the cross always moves first in this fight.

According to the rules of the competition, three identical moves must be set horizontally or diagonally. And you need to do it faster than your partner in the game. The cross goes first in the competition. The first player is more likely to win. The second move will be for zero.

How easy and quick to win with a cross?

The most beneficial first step is to be in the center of the field. This cell gives the advantage to the player to walk not only straight, but also diagonally. The player has a chance to line up three pieces in a row according to:

  • diagonals - two lines;
  • verticals - one line;
  • horizontally - one line.

After the second step of the enemy, the first zero will appear on the field. Depending on where the enemy placed him, a further line of defense is built.

In theory, the enemy has two options:

  • put a zero in one of the four side extreme cells;
  • put a zero in the position of cells that do not pass through the diagonal numbered 2, 4, 6, 8. This step can be decisive for the outcome of the battle.

Now the player with the cross has a greater chance of winning, rather than being defeated. The second step is to line up the attack. You need to put a cross in a free corner cell. It is necessary that the diagonal passes through it. This position will induce the opponent to build a line of defense.

The third move of the cross will be to capture one more corner cell. This is necessary in order to get as many rows as possible, in which one figure is missing. Thus, you go one position ahead of your opponent. At whatever point zero places its figure, the cross will always have one more option in stock.

If the enemy, on the second step of your battle, placed a piece on one of the cells numbered 1, 3, 7, 9, the chances of winning become low, although they depend on the opponent's inattention.

The winning strategy is to build a line of three identical pieces horizontally or vertically. How easy is it to increase your chance of winning? You need to put the first figure in the center or in the corner.

The scheme of moves for zero

For players fighting to win the zeroes, it is much more difficult to win. After all, the right to the first blow in this game is worth a lot. Here you need to try to reach a draw, and if your opponent is inattentive or inexperienced, there is even a chance of winning.

The first step of a zero (in case the opponent did not put his piece in the center) is to put a zero in cell number 5. Further tactics will be similar to the one that was prescribed for crosses. If cell number 5 is occupied by a cross, you need to select diagonal cells with numbers 1, 3, 7, 9.

The opponents' next strikes must be parallel and prevent the formation of a row of three pieces.

You can learn how to consistently win by studying the scheme.

If the cross made its first move not through the central, but through the corner square, then the opponent has two options for the development of the game strategy.

As soon as the zero goes to the center, the enemy needs to quickly walk to the opposite corner from the first move. In this case, the zero has two steps to choose from. Which one will be chosen - this will be the outcome of the battle. Let's say the zero will put the piece in a non-corner cage. Then the cross will begin to defend itself, and the battle will end in friendship. But if the enemy's position is indicated in the corner cell, the crosses will be able to make a kind of "fork" and take the remaining corner.

How to make the cross win all the time? You need to adhere to the following tactics:

  • take the center;
  • force zeroes to start defense;
  • build a "fork" from crosses.

There is such a strategy when the zero is placed in the corner, and the crosses are placed in a straight line. Then the zero begins to line up diagonally, but the cross here takes up the last free corner. The result is a fork.

How to win at tic-tac-toe 3 × 3 or more cells?

This popular game very useful for the development of logic and thinking, because it is based on the basics of programming and mathematics.

In a 3-by-3 game, the main reason for losing one of the players is the mistake he made during the first move. It is he who determines the further chain of events. In order for the second player to have a head start and not lose, he needs to place his piece in the center of the field or in one of the corners in his first move, which will be made after the initial strike. This will allow him to take a strategically important place, and, if necessary, block the threat from any point. In a 3v3 competition, the first strike strategy is the most important.

An interesting type of combat is three-dimensional 3 vs 3 vs 3. Here the competition is held in a cube. The win is assigned to the player who occupies the top center field. There can be no draw in this struggle. You can win by taking a central position on the field, as well as by using moves that are diametrically opposite to each other.

To complicate the competition and increase the winnings, the Silverman playing field of 4 by 4 square meters was invented for the players. In this battle, the player's goal is to make a straight line of four identical figures. The combat strategy for the first player is to attack and block the opponent's moves. There is no draw in this variation of the game. The worst option for starting a 4v4 competition is diagonal opposition. But even in this case, the first player always has six options for moves. As practice and battle analysis show, the players who made the first move in this game have huge benefits... In order to change the conditions and complicate the game, the main diagonals are not counted for a win. In this case, the first move does not need to be made along the main diagonal to win.

On a 4 by 4 board, you can play an interesting version of the game - "Crazy Tic-Tac-Toe." Here, the figures are not tied to the players. The winner is the one who collects the first row of any four pieces.

How to play tic-tac-toe 5 by 5 boxes?

The 5v5 game is interesting, but the principle of its operation is the same as in the game on the field of nine cells. The main tactic of the competition is making surebets, which will not give the opponent the opportunity to build a row of 5 pieces. To make the game long and interesting, special rules are established for the first player. You can not build more than two forks, and it is also forbidden to create forks on the site from cells 3 by 3 and 4 by 4. Compliance with these conditions opens up the chances of winning for the second player. It is noteworthy that in this variant of the competition, one move can be skipped. But, if the second player also misses a move, then the game ends in a draw.

How to play 10 by 10 squares tic-tac-toe?

The playing fields 10x10 and 15x15 are boards called gomoku. It's addicting sport game which is popular all over the world. The main point of the competition is drawing up a row of five identical figures. There are many algorithms for calculating moves, and even computer calculations have been carried out.

You need to know that one shape affects other shapes within five cells on each side of the shape. The main goal of the players is to prevent the enemy from placing three pieces in a row.

You need to act in a chain, building first a chain of two figures, then three, four, and so on until victory. As in the simple level, the second player always goes one step behind the first, so he needs to think carefully about each of his moves.

The game came to us from antiquity. Today, many variants of the competition are known: on paper, with stones on a computer. There are virtual games that real people play, place bets and make real money. But you need to remember that the difficulty of the battle increases with the growth of the playing field. When playing online, there is no guarantee that your opponent is not a machine that has several solutions and algorithms for one move. That's why online game requires attention and concentration from a person.

Don't lose it. Subscribe and receive a link to the article in your mail.

Each of us at least once in our life played the famous tic-tac-toe, trying to build 3 crosses or 3 noughts in a row or diagonally on a nine-square field. If you have practiced enough in this game, then you probably know that two experienced players always end up in a game, and this makes the game uninteresting for them. In this article, you will read about how to win at tic-tac-toe, or at least not lose, and you will also learn all the tricks and secrets of passing this popular game.

A little about the rules. The goal of the game is to line up on a nine-square field in a row 3 identical figures (3 crosses or 3 zeros) horizontally, vertically or diagonally before your partner in the game does. The game of tic-tac-toe begins with the player's move, who puts an X in any cell on the playing field three by three (we note right away that he has much more chances to win than his opponent). After that, the second player puts a zero in any free cell. Then the cross moves again. Then zero again. And this continues until:

  1. Some of the players will not line up or diagonally 3 crosses or 3 zeros, and as a result will be declared the winner;
  2. There will be no free cells, and there will be no three identical pieces in a row on the field - in this case, a draw is declared.

X-stitching tactics

The first move of crosses. The most advantageous position is the middle of the playing field, or, as noted on the diagram, cell # 5. It is here that your figure should be inscribed if this cell is free, and that is why beginning crosses always have an advantage. Through the central cell, you can build the largest number of possible winning options: two diagonals, one horizontal and one vertical.

The second move of crosses. After you have made the first move by placing a cross in the center, you have to wait for the opponent's move. In general, he has only 2 possible options for action: put a zero in one of the "corner" cells (No. 1, No. 3, No. 7 and No. 9) or place his figure in cells No. 2, No. 4, No. 6 or No. eight. And it should be noted right away that your ability to win fundamentally depends on this move.

If the player chooses one of the off-diagonal cells # 2, # 4, # 6 or # 8, then you have a win-win strategy. In other words, you can win with a 100% probability if you know how to act correctly. This algorithm is described in the diagram below. First of all, you need to put a cross on your second move into the corner cage, forcing your opponent to defend. And after that, you occupy one more free corner cell, as a result of which you have 2 rows, where only one cross is missing (this is shown in the last field of the diagram). Wherever your opponent puts his zero, you win in any case with a fallback strategy.

If your opponent chooses cells # 1, # 3, # 7 and # 9 with his first move, then you do not have an absolute winning strategy, and you should only rely on the further carelessness of the second player, which is quite rare in such a simple game.

Third and subsequent moves of crosses. Further moves of “crosses” should be aimed at building 3 own pieces in a row, as well as at suppressing the unlikely, but still possible attempts of “zeros” to put 3 pieces in a row.

Also, “crosses” in order to win can start not only from the central cell, but also from the corner one. More on this.

Algorithms for the moves of zeroes

If you get to play with zeroes, then in most cases you have to fight only for a draw. However, you have a chance to win if you play with a completely inexperienced player.

First move of zeroes. If player # 1 for some reason did not occupy the central cell - feel free to put a zero there and proceed further, relying on the strategy of crosses described above. But, most likely, the central cell at the time of your initial move will already be taken. In this case, do not make an unforgivable mistake and do not put a zero in cells No. 2, No. 4, No. 6 or No. 8, but select only diagonal cells No. 1, No. 3, No. 7 and No. 9.

Second and subsequent moves. Further moves of "zeroes" should be aimed at suppressing the attempts of "crosses" to put 3 figures in a row, as well as, if possible, at building 3 zeros in a row, which is practically impossible.

All strategies of the game

The graph below, which can be found on Wikipedia, shows possible winning and drawing strategies in a 9-square tic-tac-toe game.

***

I hope this article has become an assistant for you in the tic-tac-toe tricks, including money and stripping, and you now know some of the necessary tactics and strategies in order to win (or at least not lose) in this wonderful the game. And if you have comments, feedback and suggestions - leave them below.

In the first article, various options for solving the problem are analyzed, but there is no implementation in the form of a game, in the second - there is a game, but the computer "plays" rather weakly. I decided to make my own version of the game Gomoku with blackjack enough strong play computer. A publication about what happened in the end. For those who love to go straight to battle - the game itself.

First, I want to decide on the main points. Firstly, there are many varieties of the gomoku game, I settled on this option: the playing field is 15x15, crosses move first, the one who first builds 5 in a row wins. Secondly, for simplicity, I will call the game algorithm for calculating a move by a computer AI.

Thank you for the attention. I hope you enjoyed reading and playing as well as implementing it :)

P.S. A small request, if you win easily - please attach a screenshot of the game and moves (from the console logs) to analyze and improve the algorithm.

Update 1
1. Increased the importance of the attack weights by 10%. Attack is now preferable for AI over defense, other things being equal. For example, if the AI ​​and the user have 4k, then the AI ​​will prefer to win.

2. Changed the values ​​of the weights by templates. By better balancing the weights, you can achieve best game AI.
The weights for the templates are now:
99999 - xxxxx - five in a row (final payline)
7000 - _xxxx_ - open four
4000 - _xxxx - half-closed four (two such fours are preferable to one open, perhaps " more interesting game" will)
2000 - _x_xxx, _xx_xx, _xxx_x - half-closed four with a gap (2 such fours are equal to one open four and "preferable" to an open three; but if only 1 such four, then an open three is preferable)
3000 - _xxx_ - open three
1500 - _xxx - semi-closed triple
800 - _xx_x, _x_xx - half-closed triplet with a hole
200 - _xx_ open deuce
Also, there are small weights (from 1 to 20-30) around all the moves, to create a "little randomness of the move."

Hello readers of my blog, today I will tell you how to win at tic-tac-toe.

A wonderful game that does not require a lot of preparation, we found a pen or pencil, a piece of paper and a partner.

In fact, the game is simple and challenging at the same time. Many do not take it seriously, so they lose. To be honest, I myself did not understand how to play it, but then, I analyzed all possible moves and realized that everything here depends on mathematics.

Why is this game very simple? The thing is that there are only 9 cells, that is, you have 1 of 9 initial options, and then this number decreases by 1. That is, if you made your move, then your opponent already has not 9 options, but only 8, because 1 cell is already occupied.

Well, I think you understood it without me, I am today, straight "captain of the obvious." Why difficult, because there are possible combinations and if you want to learn how to win in this game, then you will need a pen, as well as a clean sheet of paper.

How to win at tic tac toe

Basic concepts to know:

Field- a conventional field of 3 × 3 cells, where the battle takes place.

Crosses- these are the "x" icons, they go first.

Toe- these are the "0" icons, they go second.

Victory- when a player collects 3 crosses or 3 zeros in a row.

Here is an example of a field.

In order for you to analyze correctly, let's number each cell.

At least so that you understand where which field is.

3 × 3 winning strategy

Remember that if you play for zeroes, that is, you need to make the second move, then against a strong opponent you will only make a draw. It is difficult to win with zeros, since they move second and, practically, always defend themselves against the threats that crosses create (they move first).

Do not be surprised at what I am writing as a beginner, I want you to understand how to win with crosses and how to draw for noughts.

Let's start ...

The best strategy. The crosses make a move to the 5th square, which is in the middle.

Next, REMEMBER that if the zeroes make their second move not to the DIAGONAL CELL, then they lose. It doesn't matter which square, they make a move: 2, 4, 6, 8, if they put a zero on any of these squares, then they are forced to lose.

For example, you bet on 5, they bet on 2, now you bet on 1 or 3, threatening to make 3 crosses diagonally. Well, ok, you bet on 1, it turns out that if you put a cross on square 9, you win. You force a zero on square 9, but now you win exquisitely by placing an X on square 7.

It turns out that you are threatening to put three crosses diagonally with 3 and vertically with 4. Beauty, isn't it?

The best defense for noughts is, after playing 5 for crosses, to make moves: 1, 3, 7, 9, in this case, with care, you will always make a draw. Remember this simple rule and you will never fail.

Cunning strategy for crosses

But, after all, the player is not at all obliged to make the first move to the middle, that is, to the square - 5. Here, there is a very cool trap, you make the first move to the corner square.

The best defense here will be the occupation of the field with zeroes - 5, since it is free, then it needs to be occupied. In this case, the noughts will always make a draw, by threatening to constantly put three in a row by themselves.

If, for example, crosses make a move to square - 1, then it will be a mistake to make a move - 4 and 9, in these cases, crosses are forced to win.

Let's take a look at these options:

A) Crosses- 1, noughts - 4, crosses - 5, noughts - 9 (forced), crosses - 3 with a win on fields 2 or 7, depending on the answer of the noughts.

C) Noughts - 1, noughts - 9, crosses - 3, noughts - 2 (forced), crosses - 7 with a win on fields 4 or 5, depending on the answer of the noughts.

Well, that's all folks, I hope you now know how to win at tic-tac-toe 3x3. There is nothing difficult in it (the game), with the right defense, there will always be a draw here, but, as you can see, there are interesting variations for crosses in which you can catch zeroes.

I wish you victories, if I forgot to write something, then remind me, you can even in the comments.

Good luck everyone, bye!

Sincerely, Yuri Vatsenko!