Instead of intro
The standard poker deck contains 54 cards. Without two jokers who do not participate in the game, 52 cards come out. If you mix the deck well, you may create a unique combination of cards that no one has ever created before you. Because the various options for the location of 52 cards is:
Something tells me that the combination in the image is not so unique.
Now to the topic
Recently, I learned about the method of "bar divorce" on playing cards, thanks to which "smart uncles" win decent amounts. The bottom line is:
"Razvodchik" comes to the bar and chatters with others for a while, most often joins big companies of young people. He is trying to join the company and become "his" among others. After he earned some trust and got used to him, the breeder chooses the most hot-tempered and throws him to argument:
')
I heard that [blonds / low people / those who wear caps / any suitable option] have intuition just sucks! Here we argue that you can not guess (at this moment the razvodchik gets a deck of cards) the color of each next card? You can shuffle the deck, as you like! For every guessed card I pay a thousand rubles! And if you do not guess, then you give me two rubles, then you drop it to four, up to eight rubles and further, well, do you understand? And to be honest - only the one who loses in the total score, who has less winnings, can stop the game. Is going?
Most readers have already understood the scheme and with a smile estimate the amount that the breeder can win.
I wondered how long the player wins and how to act to increase the chances of winning (the best way is to abandon the game!). Naturally, the rule about stopping the game, I do not take into account, it is impossible to win with him.
What is what?
To begin, let us explain the situation in numbers and understand why it is almost impossible to win in this game. As you, of course, understood: the sums grow in different progressions. The player has an arithmetic progression in increments of a thousand (rubles). The “razvodchika” has a geometric progression with the denominator “2”. Naturally, the geometric progression grows much faster than arithmetic.
After 10 unreadable cards
(hereinafter the unreadable card is the unsung color of the card) , the benefit of the razvodchika will be equal to 1024 rubles.
To 16 non-predicted cards, the winnings will be equal to 65536 (2 ^ 16). This means that even if the player guesses the 36 remaining cards (36,000 rubles), he will lose. Therefore, to win, you need to guess 37 cards (37,000 rubles). Then the breeder will win only 32 768 rubles (15 cards, 2 ^ 15) and the player will be in the black. With a smaller card, we lost.
It would seem: to guess the 37 cards in practice is impossible, since the chance to guess 1 to 2 ^ 37
A simple cycle on php
$cards = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); $len = count($cards); shuffle($cards);
shows what we expect: on average, 26 cards are guessed (I have drawn 25,989 when I started), and the player needs to guess as many as 37 cards.
But we are not throwing a coin! We know that there are a total of 26 red cards and 26 black cards in the deck, therefore, we can increase our chances by choosing the color of the cards, which are less. Thus, if we know that there is at least one more red card left in the deck, we choose red, and vice versa.
Let's make a simple algorithm that selects the color of the card, which is more in the deck.
$cards = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
If there is an error in the code in the logic, write to the private messages, I will promptly correct it. And also, if you have a better algorithm - write it in the comments, I will definitely add it.
The result is very ambiguous, in general, the number of guessed cards has increased, I have 29-30 guessed cards.
When checking with other code, a solid result came out on Ruby: 30 (thanks to
railsfun ), which is also not enough to win a player. What to do in this case?
"Bypass" ways
Is it really impossible to win against a cunning razvodchika? Since most of all razvodchiki not so clever, and beyond this scheme, they do not depart, they do not know the result with a different number of cards. Let us examine the situation with a change in the number of cards.
Naturally, a player can express doubts about the deck (and what if there cards change somehow?!) And offer to play with a new deck from the store (36 cards), which is carefully shuffled. The breeder, knowing that the deck is not important, agrees. In the deck of 36 cards is a completely different alignment.
In order to win a razvodchiku, he needs to the player could not guess 15 cards, instead of 37 from the previous version with a deck of 52 cards. Consequently, if a player can guess 22 cards (22,000 rubles), he will exceed the benefit of the breeder with his 2 ^ 14 = 16384 rubles.
If we run a cycle with a modified array of 36 cards, we will see that the average number of guessed cards is 20. Even when changing the deck, it is very difficult to win, because the player needs to guess too many cards. However, in a single case, you might get lucky, and the player will guess 22+, but according to statistics, the player loses, in general, always.
Conclusion
In such a game, fulfilling all the conditions, winning in theory is unlikely, but in practice it is unrealistic. The only way is to change the conditions or to cheat, for example, to peep a few cards when shuffling.
PS
- The chance of winning is possible only if the rule “the loser stops the game” is canceled. Then you can take the winnings and the first luck.
- The best way not to lose is to abandon the game or use your own, labeled (marked) deck (it's a pity not everyone carries a marked deck for this occasion)
- Offer to play this game to your friends. How many of them would agree without noticing the trick? You can not take money from friends, however, according to your desire;)
Thanks
vaxXxa , changed the initial conditions. First, the breeder gets 2 rubles, not 1 ruble.
Thank you
lolmaus for the winning schedule, very visual:
And I also had a question: how much will the chance of winning increase, if during the shuffle you look at one lower card?