As always win at rock paper scissors. How to win at Rock-Paper-Scissors? (implementation of the optimal strategy in Wolfram Mathematica)

God only knows how many controversial situations in childhood were resolved with the help of playing Rock, Paper, Scissors. Why are there little ones, full of adult kids who find an easy way out in a matter of seconds and a discarded sign. So what lies behind the unpretentious throwing out of fingers: a will of chance or a well-thought-out strategy? Scientists firmly know the answer and give their victorious recipe.

Most recently, a team of Chinese researchers from Zhejiang University announced their bold findings to the world. psychological tests. Scientists from December 2010 to March of the current conducted 5 experimental cycles. Each cycle included 12 sessions with 6 participants. In total, the total number of subjects reached 360 people. The sex ratio was 217:143 with a female predominance (simply girls were more active in recording). A student or graduate student could participate in the study only once. People were out of sight of each other, in front of the monitor screens. Thus, verbal and visual contact was excluded. Each of the participants spent from one and a half to two hours on 300 games with a random opponent. The incentive to win was a small cash reward for each round won.

So what do you need to know to win? After observing a huge number of “battles”, the scientists found that the player who defeated his opponent in the current game was more likely to repeat his actions in the next round, and less likely to change anything.

On the other hand, if a player loses two or more times in a row, he will stop showing an unsuccessful combination and will try to break exactly the sign that just allowed his opponent to defeat him.

Thus, if player A was on a losing streak and player B had just rolled the scissors and thereby cut A's paper, then A would likely roll a stone, which would give a good chance of winning, since B would probably stick to the same winning tactics. The psychology of behavior is simple: if you win, you don’t change, if you lose, you switch.

Lost? Roll the sign that beats your opponent's last winning sign.

Won? Don't keep showing the same sign, instead fold your losing opponent's last combo.

Still not completely clear? Here are some winning strategies that will help you stay invincible:

If you won the last game...

If you lost in the last game (and the opponent is not aware of this technique) ...

  • ... after throwing a stone, go to the scissors in the next fight
  • ... after throwing out the scissors, go to the paper in the next fight
  • ... after throwing away the paper, go to the stone in the next fight

If you lost the last game (and your opponent is aware of this technique)...

  • ... after throwing out a stone, go to paper in the next fight
  • ... throwing out the scissors, go to the stone in the next fight
  • ... after throwing away the paper, go to the scissors in the next fight

You can learn more about the methodology for conducting research in, provided by Chinese scientists to the public. Of course, it is designed English language and contains layouts and formulas that are incomprehensible to people far from mathematics.

And in conclusion, I’ll add that the blame for the lost cars, houses and wives in “stone, scissors, paper”, first of all, should be placed on your passion, and not on the Chinese minds and the author of these lines.

Have you tried the tips above? Maybe in your life there interesting stories related to this game? Share in the comments.

There is no person who has not played the game of Rock, Paper, Scissors. After all, she can not only take time, but also solve, for example, a dispute.

Meanwhile, not many people know that this game originated in China, later, in the 19-20 centuries, gained popularity in many countries of the world, including Russia. And at the beginning of the 21st century, the first championships in this “sport” appeared with significant prize funds.

To win this game you do not need to be a psychic - to read the opponent's thoughts or program his actions, you just need to follow some rules.

1. Men tend to be the first to throw the “stone” because it is perceived as strength and determination. Therefore, it is possible to catch the strong half of humanity on this, they quite often come across on this. Using this feature, you can easily win by showing "paper". But remember that this trick will not work with experienced players.

2. If you are "lucky" to play with an experienced player, he is unlikely to show the "stone" for the first time - this is too obvious. Therefore, "scissors" is a fairly optimal option.

3. Tell your opponent what you are going to show and then...show what you said. Why? As long as you're not playing with someone who doesn't know you're being impudent, you can announce your intentions and get a profitable roll. For example, if you declare "rock", then your opponent will not throw out "paper", believing that you will show "scissors". This move can bring you a win or a draw.

4. If your opponent has thrown "scissors" twice, then the chance that he will show them a third time is very small. Most likely, he will throw out "paper" or "stone". In this case, it would be advisable for you to show "paper".

5. During the second round, inexperienced players subconsciously show what could defeat them in the past. For example, if your opponent was losing with "paper", he will show "scissors", then your move is "rock". If for the first time the opponent threw out the "stone", then the second time it is advisable to show "scissors": he will most likely decide to throw out the "paper".

6. There are situations when you do not know what to throw out. In this case, I advise you to show the "paper". According to statistics, "scissors" are shown somewhat less often than anything else. However, not so long ago, British scientists found that the most winning strategy in the game is to show “scissors”. The fact is that most often the opponent subconsciously expects the “stone” gesture, and therefore shows “paper”.

Good game!


Translation of the post by Jon Mcloone, Director of the Department international business and strategic development Wolfram Research). Original post: How to Win at Rock-Paper-Scissors
Download post as a Mathematica document

From a mathematical point of view, the rock-paper-scissors game (see appendix 1 at the end) is not particularly interesting. The Nash equilibrium strategy is very simple: randomly and equally likely to choose from three options, and subject to holding a large number games, neither you nor your opponent will be able to win. Although, when calculating the strategy with the help of a computer, it is still possible to beat a person after a large number of games.

My nine year old daughter showed me a program she created with Scratch that won absolutely every time just by keeping track of which choice you made before making your own! But I will introduce you to simple solution, which beats a person in rock-paper-scissors without cheating.

Since the one who always commits absolutely random selection it is impossible to win, we will rely on the fact that people are not very random. If the computer can spot the pattern you are following in your attempts to be random, it will be one step closer to predicting your future actions.

I was thinking about creating an algorithm as one of the topics of our statistics course within the concept of Computer-Based Math. But the very first article that I came across in search of predictive algorithms considered the solution using complex design based on copula distributions. This solution was difficult for a schoolboy to understand (and maybe even for me), so I decided to develop a simpler solution that I could explain in simple words. And even though it has already been developed before, it is much more fun to create things in your own way than to find them ready-made implementation.

To get started, we just need to be able to start the game. At that time, a demo was already developed and available that allows you to play rock-paper-scissors, but it was not quite what I needed, so I wrote my own version. This point does not require much explanation:

For the most part, this code describes the user interface and the rules of the game. The entire strategy of the computer player is contained in this function:

Where 1 corresponds to stone, 2 to paper and 3 to scissors. it optimal solution. No matter how you play, you will win as many games as the computer, and your win rate will hover around zero.

So now it would be interesting to rewrite the function choose Go to make predictions about your choice using data about recent games stored in a variable history. The first step is to analyze the choices made during the last few games and find all occurrences of any sequence. By observing what a person did in each subsequent game, we can detect a certain pattern of behavior.

The first argument to the function is the history of past games. For example, in the data set below, the computer (second column, the second element of each sublist) has just played paper (corresponding to the number 2) against a human-played stone (number 1). This can be seen from the last element of the list. It can also be seen that this situation has already occurred twice, and both times the next move of the person was again a stone.

The second argument is the number last elements stories to search for. AT this case the number 1 is passed as an argument to the function, which searches the data for only occurrences of (1,2). If we choose 2, then the function will look for occurrences of the sequence (3,2), (1,2) and return an empty list, since such a sequence has not been encountered before.

third argument, All, indicates that both human moves and computer moves must match in the desired sequences. The argument can be changed to 1 to look only at the person's move history (that is, assuming that human choice depends only on his own previous moves), or 2, to pay attention only to the second column, that is, the history of the computer's moves (that is, assuming that the person responds to the previous moves of the computer, regardless of what moves he himself made and, therefore, whether he wins or loses).

For example, in this case, we find that the person chose after the stone, regardless of what the computer chose in the same games.

Having a large number of data, we can get by with just the argument All, and the program will be able to decide for itself whose moves, computer or human, are more important. For example, if a computer's move history is ignored by a human in the course of making a choice, then the data set obtained for any computer move history will have the same distribution as for any other computer move history, provided there is enough data from previous games. By searching through all pairs of games, we get the same result as if we first selected data on the computer's move history, and then used this subset for the function shown above. The same will happen if only the history of the computer's moves matters. However, searching under both of these assumptions separately can yield better history matches, and this is most evident when the game dataset is small at first.

So from these two checks, we can find that the first gives a score of 100% that the person's next choice will be a stone, and the second shows that with a 75% probability the person will choose a stone and with a 25% probability - scissors.

And here I am somewhat stalled in solving the problem.

In this case, the two predictions are at least more or less close in results, although they diverge in the numerical values ​​of the probabilities. But if you're looking at three "slices" of data with a number of different history lengths, and the results of the predictions are inconsistent - how do you combine them?

I put a note about this problem in my "Blog it" folder and forgot about it until a few weeks ago there was an argument about how to cover the concept of "statistical significance" in a Computer-Based Math course.

I realized that the question is not how to combine the resulting predictions, but how to determine which of the predictions is the most significant. One of the predictions might be more significant than the others because it reflects a stronger trend or maybe based on a larger dataset. It didn't matter to me, so I just used the p-value of the significance test (with the null hypothesis that both players were playing randomly) to order the predictions.

I think I should listen to our own first principle that the first step in solving any mathematical problem is "the right question."

Now, if we take the last result we got, we find that best prediction is a stone with a p-value of 0.17. This means that with only a probability of 0.17, the data used for this prediction deviate from a discrete uniform distribution ( DiscreteUniformDistribution[(1,3)]), and more by chance than by systematic error produced by man or by some other cause that might alter the distribution.

The smaller this p-value, the more confident we can be that we have found the true pattern of behavior. So we just make predictions for different history lengths and data slices and choose the prediction with the smallest p-value.

And we make a choice that will beat the choice of a person.

Here you see the result. You can download and try it out for yourself from the Wolfram Demonstrations website.

When the program has too little data, it plays randomly, so you start off equally. At first, when she first starts learning, she makes some stupid decisions, so you can get ahead. But after 30-40 games, she starts to get really meaningful predictions and you will see your win rate drop into the negative area and stay there.

Of course, such a solution is only good against primitive attempts to appear random. His predictability makes him prone to losing against a well-calculated and planned strategy. It is extremely interesting to try to defeat this program with the help of intuition. It is possible, but if you stop thinking or think too hard, you will soon fall behind. Of course, a program could easily do this by applying the same algorithm to predict the next move of that program.

This approach leads to the beginning of a kind of "arms race", competitions in writing algorithms that will win rock-paper-scissors against the opponent's algorithm, and the only way stop it - return to the Nash equilibrium strategy, making a choice through RandomInteger[(1,3)].

Addition 1
In case you don't know how to play this game, the rules are as follows: you choose rock, scissors or paper using one of three gestures shown simultaneously by you and your opponent. Rock beats scissors (makes them blunt), scissors beats paper (they cut it), and paper beats rock (it wraps it up). The winner gets one point, in case of a draw both players get no points.

Thank you for your help in translating this post.

"Rock Paper Scissors". After all, she can not only take time, but also solve, for example, a dispute.

Meanwhile, not many people know that this game originated in China, later, in the 19th and 20th centuries, it gained popularity in many countries of the world, including Russia. And at the beginning of the 21st century, the first championships in this “sport” with significant prize funds appeared.

To win this game you do not need to be a psychic - to read the opponent's thoughts or program his actions, you just need to follow some rules.

1. Men tend to be the first to throw the “stone” because it is perceived as strength and determination. Therefore, it is possible to catch the strong half of humanity on this, they quite often come across on this. Using this feature, you can easily win by showing "paper". But remember that this trick will not work with experienced players.

2. If you are "lucky" to play with an experienced player, he is unlikely to show the "stone" for the first time - this is too obvious. Therefore, "scissors" is a fairly optimal option.

3. Tell your opponent what you are going to show and then...show what you said. Why? As long as you're not playing with someone who doesn't know you're being impudent, you can announce your intentions for a profitable roll. For example, if you declare "rock", then your opponent will not throw out "paper", believing that you will show "scissors". This move can bring you a win or a draw.


4. If your opponent has thrown "scissors" twice, then the chance that he will show them a third time is very small. Most likely, he will throw out "paper" or "stone". In this case, it would be advisable for you to show "paper".

5. During the second round, inexperienced players subconsciously show what could defeat them in the past. For example, if your opponent was losing with "paper", he will show "scissors", then your move is "rock". If for the first time the opponent threw out the "stone", then the second time it is advisable to show "scissors": he will most likely decide to throw out the "paper".

6. There are situations when you do not know what to throw out. In this case, I advise you to show the "paper". According to statistics, "scissors" are shown somewhat less often than anything else.

However, not so long ago, British scientists found that the most winning strategy in the game is to show “scissors”. The fact is that most often the opponent subconsciously expects the “stone” gesture, and therefore shows “paper”.

Guys, we put our soul into the site. Thanks for that
for discovering this beauty. Thanks for the inspiration and goosebumps.
Join us at Facebook and In contact with

If you're constantly losing at tic-tac-toe or rock-paper-scissors, it's probably because you don't know winning strategy. Or your opponent knows it.

website will tell you about the ways that will help you win the 5 most popular games and prevail in disputes.

1. Tic-tac-toe

When making your first move, put your "X" in the corner. If in response the opponent puts "O" anywhere except the central cell, then we can say that you won. Put a cross in any of the free corners. The enemy, without thinking, will block your winning combination and stand between your crosses.

If, after your first move, the opponent occupied the center, then you can win in this case too.

Just put a cross in the corner obliquely from the one already taken. Now, if the opponent occupies one of the free corners, then you win. Otherwise, it can easily be reduced to a draw.

2. "Monopoly"

"Monopoly"- a game in which a lot depends on your luck at the beginning and on the ability to negotiate in the middle of the game. But in order to significantly increase your chances of winning, it is important to adhere to certain rules.

    Buy railways and do not buy utilities (electricity and water). Utilities make a small profit in the middle of the game, and transport will make you rich at the very beginning.

  1. Don't worry about hotels. After you have collected one of the color territories, build 3 houses as soon as possible. The 3rd house is where you put your money to the best use. They are easy to build and they bring high income.
  2. Best Territories are orange, light blue and red. They have good location, they will bring you high income and help you win.

3. Arm wrestling

Even if you are opposed by an opponent who is superior in strength and mass, it is possible to defeat him if you use the correct technique for setting arms and torso.

    Bend over to the table, push your right leg forward and place your right elbow on the table. If you are using left hand then extend your left leg.

  • Make sure that the distance between the forearm and the body is as small as possible. So you can use not only the strength of the arm, but also the weight of your own body, this will give you an advantage.

    Raise your wrist up a little. In this case, your brush will go down, and the opponent's wrist will bend. This will make him uncomfortable, and it will help you to strengthen the grip. If you can't bend your wrist, just keep it straight.

    Now, when pressing, pull the opponent’s hand towards you, and approach yourself and pile on with your shoulder. It is important to keep your body and forearm close to each other.

  • For a decisive blow, turn your body a little and lean with your shoulder in the right direction. Now it remains only to drag the opponent towards you and push down. You won!

4. Billiards

Billiards is a game that requires skill, practice and high concentration. Therefore, if an experienced opponent plays against you, then it will be very difficult to win. To increase your chances, stick to the basic rules.

    Don't let your opponent successfully break the pyramid. This is one of the basic rules. If you have an experienced opponent in front of you, then, having broken the pyramid, he can score all the balls at once, without letting you hit even once. So try to hit first.

  1. Take your time. It sounds trite, but most people lose because they are in a hurry to hit the ball. Practice, aim, look. Pay no attention if you are in a hurry. Patience is essential in this game.
  2. Hit right. If your ball deviates from the intended trajectory, then you are not hitting the center of the ball. Place the cue so that it coincides with the line of the future strike. If you are right-handed, then put your right foot perpendicular to this line, left leg pushed forward. Shoulder, hip, elbow and chin should be in the same plane.

5. "Rock, scissors, paper"

Many people think that the game of rock, paper, scissors is all about chance. In fact, it will be easy for you to win if you know some psychological tricks.

Researchers from Zhejiang University conducted great amount experiments, the results of which showed some regularities.

    Most people always start with a rock. Moreover, men are much more likely than women. However, many people do not throw the same sign 3 times in a row. So roll "paper" 3 times in a row - and you win.

  • People don't like to be predictable. If your opponent throws a “stone” 2 times in a row, then in most cases the next sign will be “scissors”.
  • Watch your opponent's fingers- they will tell you what move the opponent is going to make. All fingers are tense - "stone". All fingers are relaxed - "paper". Only two fingers are tense - "scissors".