Ball color expected value We have a box containing b black balls and r red balls which we will take out one at a time by placing them on the table in front of us. Before each extraction we write the color of the majority of the balls not yet extracted on a sheet of paper and only in the event of a tie between black and red can we write a random color (black or red). So, once the ball has been extracted, we can establish whether or not its color corresponds to the one written on the sheet. On average, how many times does the color written on the piece of paper coincide with the color of the ball drawn?
Driven by curiosity, I simulated this game 1000 times considering a box containing b=26 black balls and r=26 red balls, obtaining an expected value approximately equal to 30. I was wondering if a closed formula could be written. Thank you!

Thanks to Parcly Taxel's answer I was able to go back to the original problem whose solution is by John Henry Steelman, Indiana University of Pennsylvania, Indiana, PA (valid for $b \ge r$):
$$
\mathbb{E}(b,r) = b + \sum_{k=0}^{r-1}\binom{b+r}{k}/\binom{b+r}{r}
$$
from which:
$$
\mathbb{E}(r,r) = r - \frac{1}{2} + \frac{2^{2r-1}}{\binom{2r}{r}};
\quad
\mathbb{E}(26,26) = \frac{3724430600965475}{123979633237026} \approx 30.040664774713895\,.
$$
 A: This is the question's process clarified. Start with $0$ correct guesses and repeat this process until no balls remain in the bag:

*

*Write down the majority colour among the bag's remaining balls. If there is a tie write either colour arbitrarily (since the probability of getting the next step right will always be $\frac12$).

*Draw a ball uniformly at random from the bag, add $1$ to the correct guesses if it matched the colour written down, then set that ball aside.

The expected number of correct guesses $E(M,m)$ from a position with $M$ majority-colour balls and $m$ minority-colour balls (the process has a colour symmetry) satisfies this recurrence:
$$E(M,0)=M$$
$$E(M,M)=\frac12+E(M,M-1)$$
$$E(M,m)=\frac{M(1+E(M-1,m))+mE(M,m-1)}{M+m}\qquad\text{ if }M>m$$
Using this we calculate
$$E(26,26)=\frac{3724430600965475}{123979633237026}=30.04066\dots$$
in close agreement with the OP's simulation.

Empirical expressions for $E$ are
$$E(M,m)=M-(-1)^m\sum_{k=1}^m\frac{k(-2)^{k-1}\binom mk}{M+m-k+1}$$
$$E(M,m)=M-\frac{m(-1)^m}{M+m}{}_2F_1(1-m,-M-m;1-M-m;2)\qquad(m>0)$$
$E(M,M)$ happens to be OEIS A322755/A322756 and is equal to $M-\frac12+2^{2M-1}/\binom{2M}M$.
