optimal strategy for drawing a deck of cards

442 Views Asked by At

The game is as follows (an interview question found online where you can only calculate by hand):

You have a shuffled deck of 26 red and 26 black cards. You continuously draw a random card from the deck and decide whether to draw again (without replacement) or to stop. If you decide to stop, you draw another random card from the deck and check whether both cards are of the same color, if yes you win, otherwise you lose. If there's only one card left in the deck when you are making decisions, you have to choose stop. What is the optimal strategy?

I can only find dynamic programming methods for this question which needs to write a program to help calculate. My code is here. And the output file of my code is here. As you can see from the output file (if my code is right), the strategy is keep drawing until the number of either one color that have been drawn reaches 25, and then you draw once again and then choose to stop. However, how can you get this strategy if you only calculate by hand?