📜 ⬆️ ⬇️

On the value of cards in the game "Drunkard"

Recently, I have been playing a lot with my 5-year-old son in the card game "Drunkard". Both he and I rejoice when we win, and grieve when we lose.

At some point I wondered: what is the “financial” value of each of the cards in the “Drunkard”? Since the Six hits Ace (see the rule option under the cut), the value system in the "Drunkard" is cyclical, and the answer is not obvious. For example, is the Seven Six more valuable? Seven beats Six - then yes! But on the other hand, each of them beats only one other card in the game (Seven - Six, and Six - Ace) - means they are equal in value? But an Ace, beaten by Six, in itself is much more valuable than a Six, beaten by the Seven - means Six is ​​more valuable ?!

I decided to bring the mathematical model under the analysis of the value of the cards in the "Drunkard". The results were the most unexpected.

For starters, here are the rules for our version of this game:
')

As it is clear from the rules, the victory in this game depends solely on luck - the winner is determined by the distribution of cards, since nothing depends on the players at all.

So, how can we determine the "value" of a card in "Drunk"? I decided to determine the value of the card through the expected number of cards that this card will bring if the game continues indefinitely.

Let's start with a simple task: determining the expected number of cards for the Six and only one battle. In a deck of 36 cards, it means that if we walk by Six, it enters into battle with another (randomly chosen) card from the remaining 35. What can happen? With a probability of 4/35, an Ace falls out, and then we get both a Six and Ace. With a probability of 3/35, another Six will fall out, and a dispute will occur - and since we assume an absolutely random alignment, we are equally likely to either win or lose it, which means that, on average, it is expected that our Six will remain with us . In all other cases, we lose six. Total, the expected number of cards for Six after one battle: 7/35 Six + 4/35 Ace.

Now, fill in the matrix for the expected number of all cards for one battle (the Six series is the expected number of cards obtained after one battle involving our Six).
SixSevenEightNineTenJackLadyKingAce
Six7/3500000004/35
Seven4/357/350000000
Eight4/354/3511/35000000
Nine4/354/354/3515/3500000
Ten4/354/354/354/3519/350000
Jack4/354/354/354/354/3523/35000
Lady4/354/354/354/354/354/3527/3500
King4/354/354/354/354/354/354/3531/350
Ace04/354/354/354/354/354/354/3531/35

Obviously, it is not enough to consider one battle to determine the value of the card. For example, the Six have a chance to win an Ace who will play at some point in the future and, in turn, has a chance to win other cards. How to get a similar matrix, but with the expected number of cards in two battles? The answer turns out to be astonishingly simple - you just have to multiply this matrix by itself! (Basics of matrix multiplication: to get the element (X, Y) of the result of multiplication, you must multiply scalar row X of the first matrix by column Y of the second, that is, pairwise multiply the corresponding elements of these two vectors and add the results).

For example, the likelihood of starting with Six and holding a Six on hands after 2 battles is (7/35) ^ 2, since the Ace potentially won in the first battle does not increase the chances of getting a Six in the second. However, the same Ace increases the chances of getting each of the other cards in the second battle - but the expected number of cards for Ace in the second battle is multiplied by the probability of getting an Ace in the first battle (4/35). Etc.

Here it is quite reasonable to argue that by the time of the second battle the probabilities will no longer be the same as at the time of the first, since we assume certain results of the first battle. Indeed, ideally, we would calculate all the paths of this garden of diverging paths. But this is not easy to do, so we assume that the changing probabilities are the same for all maps and the errors are somehow averaged.

So, just a little chop code:

require 'matrix' #   -    m1 = Matrix[ [7.0/35, 0, 0, 0, 0, 0, 0, 0, 4.0/35], [4.0/35, 7.0/35, 0, 0, 0, 0, 0, 0, 0], [4.0/35, 4.0/35, 11.0/35, 0, 0, 0, 0, 0, 0], [4.0/35, 4.0/35, 4.0/35, 15.0/35, 0, 0, 0, 0, 0], [4.0/35, 4.0/35, 4.0/35, 4.0/35, 19.0/35, 0, 0, 0, 0], [4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 23.0/35, 0, 0, 0], [4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 27.0/35, 0, 0], [4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 31.0/35, 0], [0, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 4.0/35, 31.0/35] ] #   -  1000  (m1   1000) m1000 = m1 ** 1000 # ( ) => Matrix[[0.0667, 0.0667, 0.0667, 0.0667, 0.0667, 0.0667, 0.0667, 0.0667, 0.0667], [0.0095, 0.0095, 0.0095, 0.0095, 0.0095, 0.0095, 0.0095, 0.0095, 0.0095], [0.0127, 0.0127, 0.0127, 0.0127, 0.0127, 0.0127, 0.0127, 0.0127, 0.0127], [0.0178, 0.0178, 0.0178, 0.0178, 0.0178, 0.0178, 0.0178, 0.0178, 0.0178], [0.0267, 0.0267, 0.0267, 0.0267, 0.0267, 0.0267, 0.0267, 0.0267, 0.0267], [0.0444, 0.0444, 0.0444, 0.0444, 0.0444, 0.0444, 0.0444, 0.0444, 0.0444], [0.0889, 0.0889, 0.0889, 0.0889, 0.0889, 0.0889, 0.0889, 0.0889, 0.0889], [0.2667, 0.2667, 0.2667, 0.2667, 0.2667, 0.2667, 0.2667, 0.2667, 0.2667], [0.4667, 0.4667, 0.4667, 0.4667, 0.4667, 0.4667, 0.4667, 0.4667, 0.4667]] 

Notice how after a certain number of battles all the expected number of cards for one card become the same - because (because of the circular value system) we can finally win all the cards, then the expected numbers for all the cards converge to one number. Now there are very few - add up all the numbers in each row to find out the “value” of each of the cards (i.e., the expected number of cards after 1000 battles):

 m1000.row_vectors.map {|row| row.reduce(&:+).round(3)} # [0.6, 0.086, 0.114, 0.16, 0.24, 0.4, 0.8, 2.4, 4.2] 

For clarity:
SixSevenEightNineTenJackLadyKingAce
Value0.60.0860.1140.160.240.40.82.44.2

Unexpected conclusions:

Source: https://habr.com/ru/post/280312/


All Articles