# Probabilities & Shuffle

**Shuffle used in the online game**

During the beta testing period of Gang of Four Online, we were using a purely random shuffle. This was generating many Gang of Four combinations, as predicted by probabilities. Our testers, who were highly experienced players of the card game, complained that this was not in accordance with their personal experience. We changed the card shuffling, in order to reproduce what happens in reality:

- For the first game, cards are distributed randomly.
- For the following games, we gather the cards in the order they were dropped. The deck is then shuffled using a "riffle-shuffle"*, i.e. the deck is cut at about the middle, and then cards are re-inserted one after the other.
- The cards are dealt in four hands, and the hands are given to the players at random.

This way, the number of Gang of Four combination is more like the real game experience.

*See paper of Persi Diaconis and David Aldous : "Shuffling cards and stopping times", American Mathematical Monthly, 1986

What is the probability of having a Gang of Four combination after a well randomized shuffle? This probability is rather high: almost 30%! Here is why.

The rule to apply is the "hypergeometric law", which is a heavily used in surveys. We are dealing with a random drawing without putting items back.

Let's consider a bag that contains N balls where a number 'a' of them are red. We draw 'n' balls. The probability to get 'k' red balls is:

with:

(n! meaning n x (n-1) x (n-2)... Example: 7!=7x6x5x4x3x2x1)

Applied to Gang of Four, this gives for a Gang of twos (N=64, a=6, k=4, n=16):

P(Gang of twos) = 0.0274 i.e. 2.7%

If you add up all probabilities (which is a good approximation, because the events are almost independent), you get: **29.7%**

Another interesting element is to compute the probability that the other players have one or more Gang of Four combinations when you have one in your hand (thanks to John for these computations):

Number of Gang of Four for other players | ||||||

0 | 1 | 2 | 3 | 4 | ||

knowing that your hand contains: | 0 | 35.8% | 39.7% | 18.7% | 5.0% | 0.7% |

1 | 31.3% | 39.2% | 21.8% | 6.4% | 1.1% | |

2 | 26.3% | 37.5% | 25.2% | 8.8% | 1.8% | |

3 | 9.1% | 31.8% | 31.8% | 22.7% | 4.6% |

As you can see, the probability that someone else have another Gang of Four when you have already one is as high as 39.7%! You will notice that the more Gang of Four you have, the more likely the others have some too. This is logical, because the game is sorting itself when this happens.