$2$ people decide to count wins on a card game using a well shuffled standard $52$ card deck. Community (shared) cards are drawn one at a time from the deck without replacement until there is a winner for a hand. The rules are player A can initially win if $4$ triples appear (such as $KKK,444,AAA,777$). Player B wins if a single quad appears (such as $QQQQ$). As soon as there is a winner, the hand is finished, the win is awarded, all drawn cards are returned to the deck, the cards are reshuffled well, and the next hand will be drawn. There is one twist however. If B wins a hand, then next hand will have a lower win threshold for A. For example, initially the win threshold for A is $4$ triples. However, if B wins the first hand, then the new threshold will be $3$ triples. Conversely, each time A wins, A's threshold will be increased by $1$. So for example, if A wins the first hand, A's new win threshold will be $5$ triples to win. The minimum # of required triples is $1$. No more than $39$ cards will ever need to be drawn to determine a winner since even if $13$ triples are required, the $39$th card will guarantee a winner but it is likely a quad would have appeared way before then.

Note that the triples and quads need not be in any order. For example, $Q,2,Q,4,Q,7,A,10,Q$ is a quad. The requirement is not $4$ like ranks in a row however that is also a quad but very unlikely.

I am thinking since the difficulty of A winning is variable based on who wins the previous hand(s), this should reach some type of equilibrium where it is about equally likely for each to win in the longrun but how can I show this mathematically?

I ran a computer simulation and it looks like my initial hypothesis is right. There seems to be an equally likely chance for A or B to win on average. Even with as few as $10$ trials ($10$ winning hands), I am seeing mostly $5$ wins for each but sometimes $4$ vs. $6$ but I didn't even see $3$ vs. $7$ yet so it seems to hit equilibrium VERY quickly. Since the # of required trials (wins) is so low, you can probably just try this with a real deck of cards and confirm it is about $50/50$ with as few as $10$ winning hands. Just remember to update the winning threshold for A properly (for example, $4, 5, 4, 3$...). Unlike a fair coin toss where $8$, $9$, or even $10$ heads are possible, it seems almost impossible for that to happen with this type of "self adjusting" game.

So how can it be shown mathematically that this type of game will reach equilibrium where either player has about the same chance to win overall?

If you do a computer simulation of this, it is somewhat amazing how many times it will hit exactly half and half. For example, if I run $1000$ decisions, I usually get $500$ A wins and $500$ B wins. It is very consistent (yet I am using different random numbers each run). This is WAY more predictable than something like fair coin flips which could get off to a "rocky" start. I think you can call this type of game "self adjusting" in that it will reach a "fair equilibrium" very quickly.

This seems like a hard problem to state mathematically so I put a bounty of $100$ points on it as an extra incentive to those of you who want to try to solve it. If $2$ different users submit good answers then what I usually do is give one person the checkmark and the other the bounty to be more fair to both. Good luck.

  • $\begingroup$ The question is unclear to me in several respects. First, you write "It will never be allowed to go to $0$" as if this were a new rule; but this is redundant, since the requirement can't go to $0$ under the general rule, as $A$ always wins if only $1$ triple is required. Conversely, you don't provide a special rule at the other end, where one is needed: It's possible that $A$ wins despite needing $13$ triples. Presumably the requirement then remains at $13$? Second, what does it mean for a player to have "the mathematical advantage"? And third, how is "about equally likely" to be quantified? $\endgroup$
    – joriki
    Jul 10, 2016 at 1:07
  • $\begingroup$ $1$ triple minimum correct, stated for extra clarity but yes redundant. Yes I also thought about if $13$ triples is a winner but it is so highly unlikely not to have to mention it but of course in theory if that happened it would stay at $13$ max. I am asking who has the advantage as if they were to wager even money, who would likely come out ahead (with money made from playing this game)? About equally likely in this context means 50/50. A and B should have an equal chance of winning in the longrun (or in this game even in the midrun and shortrun). Also I did state no more than 39 cards. $\endgroup$
    – David
    Jul 10, 2016 at 2:32
  • $\begingroup$ (It's not at all true, by the way, that 39 cards guarantees 13 triples; indeed, that's very unliklely to happen. 39 cards doesn't even guarantee 8 triples: the leftover 13 cards could be, for example, 2 2 3 3 4 4 5 5 6 6 7 7 8.) $\endgroup$ Jul 10, 2016 at 4:55
  • 3
    $\begingroup$ @GregMartin: It doesn't say that $39$ cards guarantees $13$ triples, only that it guarantees a winner, which it does, since it guarantees either $13$ triples or a quadruple. $\endgroup$
    – joriki
    Jul 10, 2016 at 6:59
  • $\begingroup$ @David: a) Redundance using the language of non-redundance doesn't increase, but decreases clarity, by creating doubts that one has properly understood. You could add "thus", or replace "will never be allowed to go" by "will never go". As it stands, "allowed" confusingly appears to indicate the introduction of a new rule. b) The case of $13$ triples isn't of merely theoretical interest; in the only coherent interpretation I can see of what you mean by "winning in the long run", this is the one case that makes a difference in favour of $A$ by letting her win without changing the requirement. $\endgroup$
    – joriki
    Jul 10, 2016 at 7:06

2 Answers 2


By drawing a picture, you can get a really intuitive solution. Roughly speaking, yes you'll converge toward an equal probability of A and B winning in this game, and in any game where the following conditions hold (I've named them for convenience):

  1. Zero-sum. In every game, either A wins or B wins.
  2. Monotonicity The game gets harder for A whenever A wins, and easier whenever A loses.
  3. Straddling. There's a difficulty level where A wins with probability no less than ½, and a difficulty level where A wins with probability no more than ½.

I like to think of the game as being played like this: A and B shuffle the deck fairly, then spread out all the cards in order and see whether A or B would have won if they had drawn the cards one-by-one. Every time they shuffle the deck, there is a clear winner— either A or B. (There is never a case where they both win, for example.)

Let $n$ denote the game's current difficulty level for $A$, meaning the number of triples that $A$ must obtain in order to win. Let $p_n$ be the probability that when the deck is fairly-shuffled, the result yields a win for A— a deck where A will find $n$ triples before B finds a single quad.

Of course, the more difficult the game, the harder it is for $A$ to win: $p_1 > p_2 > p_3 > \ldots \geq 0 $. (This is true because every deck that's a win for A at some certain high level of difficulty is also a win for A with respect to each lower level of difficulty— the win conditions are nested.)

And we know that $p_1 = 1$, because A will always find a single triple before B finds a single quad. We also know that A can never win when $n=14$ because there simply aren't that many triples in the deck—we have that $p_{14} = 0$

Now we can draw an abstract diagram of the game possibilities which looks sort of like this:

Markov chain for card game

There is a node for each of the difficulty levels $n=1, 2, 3, $ and so on. Each node represents the game played at a different difficulty level for A. There is an arrow from each node to the one after it, representing the fact that the game can get more difficult if A wins. There is an arrow from each node to the one before it, representing the fact that the game can get easier if A loses. (As a special case, there is an arrow from $n=1$ to itself since we don't let the game get easier than that.)

Each of the arrows is labeled with the probability of making that particular transition. The rightward arrows are labeled with the probability of $A$ winning. The leftward probabilities are labeled with the probability of $A$ losing. (Because of the zero-sum property, if probability of going forwards is $p_n$, then the probability of going backwards is $1-p_n$.)

Now instead of playing our card game, we can simply play on this diagram: start on the $n=1$ node. With probability $p_n$, move right. With probability $1-p_{n}$, move left. We can ask about the game's equilibrium by asking whether there's an equilibrium state in this diagram.

In fact, there must be an equilibrium state. Here's why:

  1. We have the straddling property: $p_1 = 1$ and $p_{14} = 0$.
  2. We have the monotonicity property: $p_1 > p_2 > \ldots $.
  3. We have the zero-sum property: the probability of moving left is one minus the probability of moving right.
  4. Putting this together, we conclude: the probability of $A$ winning starts out at $p_1 = 1$, and smoothly/monotonically decreases up until $p_{14}=0$, taking on values in between. At the same time, the probability of $B$ winning starts out at 0 when $n=1$, and smoothly/monotonically increases up to $n=14$, where the probability is certain. Of course, we recall that we move rightward whenever $A$ wins and leftward whenever $B$ wins.
  5. This means that you can draw a dividing line that separates the nodes into two groups: the left group where $p_n \geq \frac{1}{2}$, and the right group where $p_n \leq \frac{1}{2}$. Note that if you are in the left group, you are more likely move rightward, and if you are in the right group, you are more likely to move leftward! (This is the "self-adjusting" property!)
  6. So at the boundary between the left and the right groups, there's a state $k$ where $p_k\approx \frac{1}{2}$. This game will gravitate toward an equilibrium state $k$ where $p_k \approx \frac{1}{2}$; such a state must exist because the probabilities smoothly/monotonically vary between extremes of $p_1 = 1$ and $p_{14}=0$, and such a state attracts equilibrium because you are more likely to move rightward for all states $n< k$, and more likely to move leftward for all states $n>k$. (!!)

I hope this helps! If you want an even more formal rendition of this intuitive result, you can express our diagram in the language of Markov chains, and this equilibrium solution as the steady state of such a Markov chain.

Edit: About fast convergence

The series of games happens in roughly two phases. In the first phase, the game converges toward an equilibrium node $k$. In the second phase, the game fluctuates around this equilibrium node.

During the first phase, you are essentially playing this game:

Flip an unfairly-weighted coin until you've seen $k$ heads. The weight of the coin will change depending on the outcome: initially, the coin will always land on heads. And as you see more and more heads than tails, the coin will be less and less likely to come up heads again. But the game is always weighted in your favor because the probability of heads is always greater than ½.

If we were tossing a fair coin, we would expect that it would take $2k$ tosses to reach an equilibrium node. If we were tossing a coin that always came up heads, we would expect it would take exactly $k$ tosses to reach the equilibrium state. With an adaptive coin as in this game, our rough expectation is that it will take somewhere between $k$ and $2k$ tosses to reach equilibrium. In this game, $k$ might be around 7, so we would expect it to take around 11 games to reach equilibrium.

At the end of the first phase, we know for certain that $\text{# A wins} = k+\text{# B wins}$. (Think about the number of left and right transitions required to reach equilibrium state $k$.) So based on the expected number of wins, the expected win ratio is approximately somewhere between $k:k+k = \frac{1}{3}$ and $2k:2k+k = \frac{2}{3}$.

During the second phase, the games fluctuates around the equilibrium node. The game's self-corrective behavior is key— what emerges from the rules of this game is that if A has lost more games than won, A is more likely to win, and vice versa.

A theoretical fair coin toss is memoryless, meaning that the probability of getting heads does not depend on previous coin tosses. In contrast, this game is self-correcting: whenever the game moves leftward, the probability shifts to make it more likely to move rightward, and vice-versa.

The other key property is that, I expect, there is a sharp transition where at one difficulty level $k$, we have that $p_k$ is reasonably less than ½, while for the very next difficulty level $k+1$, we have that $p_{k+1}$ is reasonably more than ½.

A standard deck has thirteen faces (A, 2, 3, ..., K, Q, J). If you played with a deck of cards with more than the standard number of faces — perhaps you played with cards labeled (A, B, C, ..., X, Y, Z)— then I think this transition would become less sharp.

The sharpness of the transition controls the strength of the self-correcting behavior (when you move too far left/right, how significantly the odds change to favor correcting it.)

Edit: Calculated probabilities

The qualitative analysis above is enough to prove that convergence happens, and happens quickly. But if you want to know quantitatively how likely A is to win at each level of difficulty, here are the results:

n       P(A wins)               P(B wins)
1       1.0                     0.0
2       0.877143650546          0.122856349454
3       0.713335184606          0.286664815394
4       0.540136101559          0.459863898441
5       0.379534087296          0.620465912704
6       0.245613806098          0.754386193902
7       0.144695490795          0.855304509205
8       0.0763060803548         0.923693919645
9       0.0351530543328         0.964846945667
10      0.0136337090929         0.986366290907
11      0.00419040924575        0.995809590754
12      0.000911291868977       0.999088708131
13      0.000105680993713       0.999894319006
14      0.0                     1.0

Note: I wrote a computer program to compute these, so feel free to double-check my results. But qualitatively, the numbers do seem correct, and they agree with my hand calculations for n=$1$, n=$13$, and n=$14$.

Importantly, these probabilities show that the game is essentially fair right from the start (where initially n=$4$)— the game starts near equilibrium. And because there is a sharp transition between n=$4$ (where A is more likely to win, $0.54$) and n=$5$ (where A is more likely to lose, $0.38$) (overall difference $\approx 0.54-0.38 = 0.16$), we expect this equilibrium to be very stable and self-correcting.

Edit: Expected number of hands before reaching a given win threshold for A

Because we can model this game as a Markov chain, we can directly compute the expected number of rounds you'd have to play before reaching a certain difficulty threshold for $A$. (Feel free to use a simulation to check these formal results.)

Following the methods of this webpage: https://www.eecis.udel.edu/~mckennar/blog/markov-chains-and-expected-value, I did the following:

  • Define the transition matrix $P$. $P$ is a $14\times 14$ matrix, where the entry $P_{ij}$ is the probability of going from difficulty level $i$ to difficulty level $j$. Of course, based on the rules of the game, $P_{ij}$ is zero unless $j = i+1$ or $j = i-1$, in which case $P_{ij}$ is the probability of A winning (respectively losing) when the win threshold is $i$. (See table for exact values of these probabilities.)
  • Form the matrix $T \equiv I - P$, where $I$ is the $14\times 14$ identity matrix.
  • Form the size-13 column vector $\text{ones}$ where each entry is 1.
  • Pick a difficulty threshold $d$ I'm interested in reaching. (For example, $d=12$.)
  • Delete row $d$ and column $d$ from the matrix $T$.
  • Solve the equation $T \cdot \vec{x} = \text{ones}$ for $\vec{x}$. Each entry $x_i$ in the solution is the expected number of hands to get from state $i$ to state $d$.

Here are the results: the expected number of hands to get from difficulty 4 to ...

  • ... difficulty 1 is 150 hands.
  • ... difficulty 2 is 22.11 hands.
  • ... difficulty 3 is 5.34 hands.
  • ... difficulty 4 is 0 hands (already there.)
  • ... difficulty 5 is 3.48 hands.
  • ... difficulty 6 is 11.81 hands.
  • ... difficulty 7 is 41.46 hands.
  • ... difficulty 8 is 223.65 hands.
  • ... difficulty 9 is 2,442 hands.
  • ... difficulty 10 is 63,362 hands.
  • ... difficulty 11 is 4,470,865 hands. (over 1 million.)
  • ... difficulty 12 is 1,051,870,809 hands. (over 1 billion.)
  • ... difficulty 13 is 1,149,376,392,099 hands. (over 1 trillion.)
  • ... difficulty 14 is 12,354,872,878,705,208. (over 10 quadrillion.)
  • $\begingroup$ What is amazing to me about this method of adjusting difficulty for A to win is how quickly it reaches "equilibrium" and how "dead on" it is for a reasonable number of decisions/wins (like more than you can easily play using a real deck of cards). Also with very large numbers like millions I am seeing a difference from exactly half and half of usually only $1$ or $0$. This is almost never the case with something like a fair coin flip. For example, simulation $1$ million fair coin flips and you are very unlikely to get $500,000$ heads, but here, VERY likely to get A winning exactly half. $\endgroup$
    – David
    Jul 15, 2016 at 10:46
  • $\begingroup$ Also yes I overlooked the extremely rare condition where A's win threshold gets to $13$ and A actually wins but obviously what would happen is it would go to $14$ and B would win the next hand then it would go back to $13$. I am thinking this type of game and this method could have some useful applications for mathematics since the theoretical probability and the actual match up VERY quickly. I think mathematically it may be very difficult to show the actual probability of each player to win but I am hoping someone attempts it, even in rough form. Computer simulation shows "dead even". $\endgroup$
    – David
    Jul 15, 2016 at 10:55
  • $\begingroup$ Just for fun, can someone please compute the probability of there being $13$ triples and no quad drawing $39$ cards (without replacement) from a well shuffled fair deck of $52$ cards? That would give us some idea of the difficulty/rareness of A's win threshold ever getting up that high. Even with $100$ million simulated hands, my simulation program never had it go above $11$. I never saw $12$ or $13$ reported. Perhaps billions of hands are needed before that ever happens and I think $14$ (win threshold) might require trillions of hands. $\endgroup$
    – David
    Jul 15, 2016 at 11:00
  • $\begingroup$ @David, Yeah! I edited my answer to talk more about convergence speed. $\endgroup$
    – user326210
    Jul 15, 2016 at 16:03
  • $\begingroup$ @David, The 13-triples-but-no-quad condition is equivalent to drawing 13 cards from the back of the deck and getting 13 different ranks. So I'd expect it to be something like $\frac{52}{52}\times \frac{51-3}{51} \times \frac{50-6}{50}\times \ldots \times\frac{52-4i}{52-i}\times \ldots \times \frac{4}{40}$. $\endgroup$
    – user326210
    Jul 15, 2016 at 16:13

My computer simulation program is quite simple. It just draws random cards (without replacement) and starts checking for a winner after $3$ cards are drawn. I use a counter array of the $13$ possible ranks do determine how many of each rank I have at any time (after $3$ cards are drawn) then I check for triples or a quad. It is interesting to me that even with $1$ million simulated hands, the maximum win threshold of A never seems to exceed $10$ (triples). So that would mean there is a winner no later than the $36$ drawn card since we would have to get all the ranks twice (that is $26$ cards) then get $10$ more ranks making $10$ triples. Of course it is MUCH more likely to get a single quad way before then.

Here is some interesting info I observed by placing checks/counters in my program and using at least $10,000$ decisions (wins) and at most $10$ million:

$4.32$ : Average # of triples required for player A to win.
$22.4$ : Average # of cards drawn to determine a winner.
$~~~~~3$ : Minimum number of cards drawn to determine a winner (obviously a single triple).
$~~~36$ : Maximum number of cards drawn to determine a winner.
$21:19$ : ratio of A wins vs. B wins at exactly $35$ cards drawn ($5$M wins total).
about$~1/2$ : Average difference from half wins for player A ($500$K out of $1$M for example).

If anyone would like other checks/counts like this just ask an I will try to add them into my program and report the results here.

This game seems interesting since it is not some fixed probability game but rather one that adjusts the make the game almost dead even as far as who is likely to win on average.

$UPDATE~1$ - I have some data from $10,000$ decisions (wins) as requested by Greg Martin. I will express them here as 4 tuples with the following format: # of triples during the win, total # of wins (A or B) with that # of triples, # of times A wins with that many triples, # of times B wins with that many triples. Here goes:


$9,10,11,12$, and $13$ triples did not show up in this table cuz I only had $10,000$ wins (as requested by Greg Martin). I can run it overnight and get $100$ million ($100$M) and create a 2nd (new) table. I would like someone else to simulate this on computer as well to make sure my numbers are correct.

I got exactly $5000$ wins for A and exactly $5000$ wins for B.

$UPDATE~2$ - Same format as above but $100$ million decisions (I ran it overnight)


$11,12$, and $13$ triples did not show up in the simulation.

I got exactly $50,000,001$ wins for A and exactly $49,999,999$ wins for B.

$UPDATE~3$ - Same format as above but now I am reporting the # of wins based on A's # of triples win threshold instead. $1$ million decisions.


An interesting pattern is shown here. Let's take $2$ and $3$ for example. The # of wins for A when the win threshold for A is $2$ is $54791$, but that is exactly the number of wins for B when the win threshold is $3$. This pattern is also true for $1$ and $2$, $3$ and $4$....

Using tt as an abbreviation for A's triple win threshold (tt = triple threshold), the actual # of wins for A is the same as actual # of wins for B when tt is one higher. For example, when tt=$4$, A will have some number of wins, call it x. When tt=$5$, that same exact number x appears as # of wins for B. Perhaps it is that whenever A wins and tt gets bumped up, on average, B will win the very next hand and thus there is even more equilibrium/balancing going on than I thought. I think that may be the answer. Note that I award the win before updating tt value in the simulation program. So for example, if A wins the very first hand when tt=$4$, then the counter for the # of wins when tt=$4$ will get incremented by $1$ and then tt will get bumped up to $5$, so at that point, the counter for the # of wins when tt=$5$ will still be at $0$.

$11,12,13$, and $14$ triple threshold did not show up in the simulation.

I got exactly $500,000$ wins for A and exactly $500,000$ wins for B.

$UPDATE~4$ - I tried $2$ manual hands using a deck of cards. The first hand I got $4$ triples (5,9,Q,7) and $27$ cards were dealt spanning all $13$ ranks. The win threshold for player A was $4$ (triples) for that hand. For the 2nd hand (since A won the first hand), A's win threshold was then bumped up to $5$. 2nd hand also got $4$ triples first but because the threshold was raised to $5$, the quad appeared before the $5$th triple. In that 2nd hand, only $22$ cards were dealt spanning only $10$ ranks. So look at how quickly the "law of averages" took place. For only $2$ games, I got $24.5$ average cards drawn and $50/50$ (split) on the wins. I did not practice any games. They were the first $2$ I tried with real cards. This gives me a better appreciation for how quickly a computer can simulate this type of game. Likely in the time it takes me to play $1$ manual game, a computer can play millions if not billions of games.

$UPDATE~5$ - I tried (for fun and to satisfy my curiosity), altering A's win threshold by $2$ instead of by $1$. The pattern above was retained here in that the # of wins for A when tt=$2$ is the same as the number of wins for B when tt=$4$. The only change I see is B is now a favorite to win at about $51.3$% to A's $48.7$% (if tt starts at $4$), and of course there are no wins where tt is odd. Interestingly, if I instead change tt (A's win threshold for # of triples) to start at $3$ instead of at $4$, then it goes back to exactly $50/50$. So apparently the initial value of tt makes a difference as far as the fairness of the game which seems somewhat surprising since I would think that with thousands or even millions of hands, it should not make a difference (but it does). We lose the "straddling" effect (where $50/50$ is achievable), when certain conditions are met. For example, when tt is an even number (such as $4$) and we change tt by an even number (such as by $2$). That makes it so there is no way for there to be a $50$% chance for each player to win. Not sure why this is true but it is what my simulation program is showing. Maybe someone else can explain why.

  • $\begingroup$ Two statistics I think would be interesting: (a) how often each # of triples comes up, and how often Triples/Quad wins at each # of triples; (b) a histogram of the difference between Triples wins and Quad wins in each batch of 10,000 or whatever. (Re: the latter: in a simple coin-flipping game, we'd expect those differences to have a spread on the order of 100s; so seeing a significantly smaller spread here will be further evidence of this game's self-correcting quality.) $\endgroup$ Jul 10, 2016 at 17:09
  • $\begingroup$ Ok I will get the information requested but I can tell you I many times see an exact $50$% of wins for each of A and B for any reasonable amount of trials. Many times even for as few as $10$ trials I see $5$ of each. Reason is, to make the game fair, on average, A needs to get about $4.3$ triples so I started the game with $4$ being the threshold for player A to win . Had I chosen something else such as $2$ or $6$, it would have taken longer to self correct. This self correcting feature is pretty cool. There is no bell curve distribution. It is a big spike right in the middle like a laser. $\endgroup$
    – David
    Jul 11, 2016 at 2:18
  • $\begingroup$ Continuation from the above comment. By spike I mean if I run $10K$ wins I see $5K$ of each, sometimes $4999$ vs. $5001$. If I run $100K$ decisions (wins) I usually get $50K$ of each, sometimes $49999$ vs. $50001$. The pattern in like that. I don't think I ever see a difference of more than $1$ from half of the # of trials. Even with as few as $10$ trials!. This method could have some usefulness in mathematics such as when you want something to equalize MUCH quicker than something like a fair coin toss which has a typical bell curve shape distribution. $\endgroup$
    – David
    Jul 11, 2016 at 3:10
  • $\begingroup$ One thing to consider though (Greg Martin) is B can win with a quad and there are NO triples. Also when I report the data it might confuse some people since A will win FAR FEWER times when there is only $1$ triple encountered cuz that is not the threshold, it is the # of triples seen in a winning hand. The data appear to be peaked (for A wins) at # of triples = $4$ which is what I expected but it is not a symmetrical bell shaped curve but that is easily explainable. The peak for B wins is when # of triples = $1$ which I think is cuz the win threshold for A rarely gets that low. $\endgroup$
    – David
    Jul 11, 2016 at 4:55
  • $\begingroup$ Thanks for the data! I think I was misleading before: what I would like to see is the decisions sorted, not by the number of triples that resulted during the decision, but rather the number of triples required by that particular decision. For example, of all the games where A needed 6 triples to win, what % of wins were by A and what % by B? $\endgroup$ Jul 11, 2016 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .