Probability of a draw in the game

89 Views Asked by At

There is a basket with $n$ balls, such that $n$ is even. Balls come in $k$ colors. The number of balls of each color is specified by a list of positive integers $c_1,c_2,\dots,c_k$, where $c_1+\dots+c_k=n$.

Two players alternate taking balls from this basket until the basket is exhausted, so both players have $n/2$ balls. Each player then gets a score equal to the number of distinct colors among the balls they took. For example, if a player takes $2$ green, $1$ blue, $5$ red, and $3$ yellow balls, then their score is $4$, because they have the four distinct colors of green, blue, red, and yellow.

Question: Given the parameters $n,k,c_1,\dots,c_k$, how can you efficiently compute the probability that both players have the same score?

For example there are 8 balls in basket: 1 red, 2 blue, 2 green and 3 black. There is total combinations:

$$C = \dfrac{8!}{(4! \times 4!)} = 70$$

I wrote python script which found that there are only 26 combinations where both players get equal number of unique cards. So

$$P = \dfrac{26}{70} = \dfrac{13}{35}$$

Is it possible to generalize this idea to find this probability for more complex cases? For example for 5 colors and (3, 1, 6, 9, 5) balls of each color? Or probably there is some kind ways do not brute force all permutations? Beacause even on last example my script takes a lot of time to find answer