I'm reading an interview book called A Practical Guide to Quantitative Finance Interview and I have some doubts about the solution provided by the book, so I really appreciate your advice if my doubt is correct or not.
Question description (from Chap 5 Stochastic Process and Stochastic Calculus/5.3 Dynamic Programming/Dynamic Card Game):
A casino offers a card game with the standard 52 cards (26 red, 26 black). The cards are thoroughly shuffled and the dealer draws cards one by one. (Drawn cards are not returned to the deck). You can ask the dealer to stop at any time you like. For each red card drawn, you win 1 dollar; for each black card drawn, you lose 1 dollar. What is the optimal stopping rule in terms of maximizing expected payoff and how much are you willing to pay for this game?
Solution: Let $(b,r)$ represent the number of back and red cards left in the deck, respectively. By symmetry, we have:
$RedCardsDrawn-Black Cards Drawn = Black Cards Left - Red Cards Left$
At each $(b,r)$, we face the decision whether to stop or keep on playing. If we ask the dealer to stop at $(b,r)$, the payoff is $b-r$. If we keep on playing, there is $b/(b+r)$ probability that the next card will be black-in which case the state change to $(b-1,r)$-and $r/(b+r)$ probability that the next card will be red-in which case the state changes to $(b,r-1)$. We stop if and only if the expected payoff of drawing more cards is less than $b-r$. That also gives us the system equation:
Using the boundary condition:
My doubt: I think the above boundary condition should be $f(0,r)=-r$ instead because:$RedCardsDrawn-Black Cards Drawn = Black Cards Left - Red Cards Left = 0-r$ I'm wondering if my understanding is correct?