Here is a question asked on MSE a few years ago: Optimal stopping in red vs black card game deck of 52 cards
Imagine you are playing a card game you start with a well shuffled deck of $52$ cards, containing $26$ red cards and $26$ black cards, stacked face down. You have a sequence of turns, $52$ possible turns in total, each turn you either pull the top card and turn it over, or you quit. If you pull a red card you win $1$, and if you pull a black card you lose $1$. If you played all $52$ turns without stopping you are guaranteed to break even. What is the optimal stopping strategy?
There is an answer given there by quasi: https://math.stackexchange.com/a/2544082/834963
Let $v(r,b)$ be the expected value of the game for the player, assuming optimal play, if the remaining deck has $r$ red cards and $b$ black cards.
Then $v(r,b)$ satisfies the recursion $$ v(r,b) = \begin{cases} 0&\;\text{if}\;r=0\\[4pt] r&\;\text{if}\;b=0\;\text{and}\;r>0\\[4pt] \max(0,f(r,b))&\;\text{if}\;r,b>0\\[4pt] \end{cases} $$ where $$ f(r,b) = \left({\small{\frac{r}{r+b}}}\right)(1+v(r-1,b)) + \left({\small{\frac{b}{r+b}}}\right)(-1+v(r,b-1)) $$ The stopping rule is simple: Stop when $v(r,b)=0$.
To explain the recursion . . .
If $r,b>0$, and the player elects to play a card, then:
- The revealed card is red with probability ${\large{\frac{r}{r+b}}}$, and in that case, the player gets a score of $+1$, and the new value is $v(r-1,b)$.$\\[4pt]$
- The revealed card is black with probability ${\large{\frac{b}{r+b}}}$, and in that case, the player gets a score of $-1$, and the new value is $v(r,b-1)$.
But the player always has the option to quit, hence, if $r,b>0$, we get $v(r,b) = \max(0,f(r,b))$.
Implementing the recursion in Maple, the value of the game is $$v(26,26) = \frac{41984711742427}{15997372030584}\approx 2.624475549$$ and the optimal stopping strategy is as follows . . .
- If $24 \le b \le 26$, play while $r \ge b - 5$.$\\[4pt]$
- If $17 \le b \le 23$, play while $r \ge b - 4$.$\\[4pt]$
- If $11 \le b \le 16$, play while $r \ge b - 3$.$\\[4pt]$
- If $6 \le b \le 10$, play while $r \ge b - 2$.$\\[4pt]$
- If $3 \le b \le 5$, play while $r \ge b - 1$.$\\[4pt]$
- If $1 \le b \le 2$, play while $r \ge b$.$\\[4pt]$
- If $b = 0$, play while $r > 0$.
However, given that this question was asked as part of a job interview, I don't think it's very realistic to get $2.62$ in a short amount of time. I was wondering if there a quick way to:
- Find the optimal stopping rule in terms of maximizing expected payoff.
- Get an estimate close to the actual answer of around $2.62$ without laborious recursive calculation or writing a program.
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/AC73024AFDDD7FE2127B4123F3978FF9/S0021900200005295a.pdf/optimal-stopping-of-a-brownian-bridge.pdf
– user51547 Jul 21 '22 at 22:03