text: BrainDen.com - Brain Teasers
  • 0
  
  ## Question
  
  "Here's the deal. You give me \$10. Then I will deal four cards (from a regular 52 card deck), chosen randomly, face down. You get to look at #1 first and decide whether to keep it. If not, look at #2 and decide whether to keep that one. If not look at #3, and decide. If you don't take that, then #4 is your choice. If your chosen value is n, I will pay you \$n. Then we can reshuffle the entire deck, you give me another \$10, and we can play again, and again, and again."
  "Hmmm....I need a good strategy to beat you at this game, but I think I can do it."
  Help the second player out with a strategy that will win.
  Note that the cards all have face value with the following exceptions: Ace=1, Jack = 11, Queen = 12, and King = 13.
  
  ## Recommended Posts
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  The first two cards didn't seem to have that much effect in simulations.
  
  For 20 million simulations of four different cases: All values +/- 0.0003:
  
  Cards 1+2 < 14 Cards 1+2 >= 14 Average
  
  10 9 7 10.2047 10.2048 10.2048
  
  10 9 8 10.2069 10.2063 10.2066
  
  10 9 8 seems always preferable to 10 9 7.
  
  The code calculates the exact probability for the average payoff with the best strategy (unless I messed up.)
  
  Both simulation and code must take into account the cards leaving the deck. Also, must discard invalid (in terms of strategy) variations. E.g., a draw like (13, 13, 8).
  
  The criteria for the staying card on the third turn can be established analytically (see the spoiler.)
  
  The criteria for the staying card on the third turn can be established analytically:
  
  Initially all cards in the deck add up to 364 for the average draw of 364/52 = 7. Let’s say we drew (1, 1, 7). Now the average draw for the fourth turn becomes: (364-1-1-7)/49 ~ 7.24, which is better than 7, meaning we must draw. If we drew (9, 8, 7), the average of the fourth draw would be (364-9-8-7)/49 ~ 6.94, meaning we should stay on 7 and not go for the fourth draw.
  
  Whereas to find the second and first turn staying criteria and corresponding average payoff, I resort to writing a program.
  
  The code essentially relies on a recursive (one that invokes itself) function DrawCard(Deck(), Probability, DrawTurn) and looks somewhat like the following:
  
  ' Initialize deck with 4 cards of each value.
  
  For i = 1 To 13 Step 1
  
  deck(i) = 4
  
  Next i
  
  AvgPayoff = DrawCard(deck(), 1, 1)
  
  End
  
  '****************************
  
  ' The recursive function**
  
  '****************************
  
  DrawCard(deck(), Probability, DrawTrun)
  
  Rpay = 0 ‘ Accumulator for the average pay in this routine instance.
  
  ' Go through the cards from King=13 down to Ace=1,
  
  ' while finding stay/draw strategy and accumulating the average payoff.
  
  For c = 13 To 1 Step -1
  
  wkprob = Probability * deck( c ) / (53 - DrawTurn) ' deck( c ) is how many of this card is left in the deck; 53 - DrawTurn is the number of cards in the deck
  
  If DrawTurn < 4 Then
  
  For i = 1 To 13 ‘ make a work copy of the deck to pass down to the next level of the DrawCard() function.
  
  wkdeck(i) = deck(i)
  
  Next i
  
  wkdeck( c ) = wkdeck( c ) – 1 ‘ remove card from the deck
  
  drawpay = DrawCard(wkdeck(), wkprob, DrawTurn + 1)
  
  If drawpay > wkprob * c Then ' Drawing pays more
  
  Rpay = Rpay + drawpay
  
  Else ' Staying pays more, or same
  
  Rpay = Rpay + c * wkprob
  
  End If
  
  Else
  
  Rpay = Rpay + c * wkprob ‘ The last 4th draw
  
  End If
  
  Next c
  
  Return Rpay
  
  End
  
  Note, this code should find the optimal path and produce the average payoff for that path. It does not show what the optimal path is. To reveal the optimal path, you need to do some tweaking with the code.
  
  Edited by Prime
  ##### Share on other sites
  
  • 0
  
  Winning strategy is to keep the card out of the first 3 as soon as you see a 9 or higher card.
  
  Reasoning:
  The probability that you have all 4 cards below 9 is 32*31*30*29/(52*51*50*49) = 0,133
  In this case you lose from \$-2 to \$-9 with equal probability = 0,133/8 = 0,0166
  
  Now the probability that one of the 4 cards is 9 or higher is 1 - 0,133 = 0,867
  Since you stop at the first sight of a 9 or higher card, you stand to win -1,0,1,2,3 with equal probability = 0,867/5 = 0,173
  
  This gives an overall expected winning amount of 0,14 per game you play.
  
  PS: If you decide to stop at 10 higher card only, the expected amount of winning is 0,09 per game. Could be a winning strategy but not the most effective one!
  
  For any other choice of stopping, the expecting winning is negative
  
  • 0
  ##### Share on other sites
  
  • 0
  
  Winning strategy is to keep the card out of the first 3 as soon as you see a 9 or higher card.
  
  Surely your strategy is EV+, but clearly it is not optimal.
  
  For example: after discarding two Deuces your third card turns out to be an Eight. EV of discarding it approximately equals (13+1)/2 = 7, while keeping gives 8, so it's better to keep it, but your strategy says to discard. You've picked a global threshold for each decision, but to make strategy optimal three separate thresholds should be found (for each out of 3 possible decisions of keeping/discarding).
  
  Edited by witzar
  ##### Share on other sites
  
  • 0
  
  Winning strategy is to keep the card out of the first 3 as soon as you see a 9 or higher card.
  
  Surely your strategy is EV+, but clearly it is not optimal.
  
  For example: after discarding two Deuces your third card turns out to be an Eight. EV of discarding it approximately equals (13+1)/2 = 7, while keeping gives 8, so it's better to keep it, but your strategy says to discard. You've picked a global threshold for each decision, but to make strategy optimal three separate thresholds should be found (for each out of 3 possible decisions of keeping/discarding).
  
  Full disclosure: I read this a few nights ago and started thinking about it [eventually falling asleep], I have not done any detailed calculations,, but I did have some thoughts:
  
  I think there may be a strategy that changes your decision criteria as you go along in the game; a series of thresholds that diminish as the game goes along
  
  If [for example] you have drawn 3 cards:
  
  • if the 3rd card is 8 or higher - stay [your probability of drawing a lower card is more than 50%]
  • if the 3rd card is 6 or lower - draw [your probability of drawing a higher card is more than 50%]
  • if the 3rd card is a 7 - do you feel lucky?
  
  If you draw the first card, there is some value X [guessing around 9 or 10] that you are probably better off to draw another card [because out of 3 new cards, you should be able to improve your holding. So the strategy for the first card may be something like this:
  
  • If your 1st card is J, Q or K - definitely stay
  • If your 1st card is below X - draw [with 3 more cards, you can probably do better]
  • If you value is above X - stay
  
  There will be a similar value Y [guessing 7 or 8] that you should use a threshold for the 2nd card.
  
  ##### Share on other sites
  
  • 0
  
  if the first card is 9 or higher, stay.
  
  second, 8 or higher stay.
  
  third, 7 or higher stay.
  
  ev = .3846 +.1448-.4746 = 0.0548
  
  ##### Share on other sites
  
  • 0
  
  You can not beat me at this game, because after finding the best strategy, I will only play for the winning side.
  
  That said....
  
  A simple easily evaluated winning strategy is to stop when you hit "9" or higher.
  The probability of not finding "9" or higher in the first 4 cards is: (32/52)* (31/51)* (30/50)* (29/49) ~ 0.1328. Correspondingly, the probability getting one of those cards would be 1 – 0.1328 = 0.8672.
  Each "high" card value has the same probability (don’t feel like proving this formally.) The average payoff in \$\$ for the cases when hitting "9" or higher is (-1 + 0 + 1 + 2 + 3)/5 = \$1.
  All other cards have the same probability of being in the 4th position when “9” or higher was not found. (Don’t feel like proving that one either.) Thus average payoff for those cases is (-2 – 3 – 4 - 5 – 6 – 7 – 8 – 9)/8 = -\$5.50.
  Making the overall payoff: \$1*0.8672 + -\$5.50*0.1328 = +\$0.1366.
  
  You also end up ahead when you stop only if you get “10” or higher as well as “8” or higher. The entire payoff table is as following:
  
  Stop only if you get
  King or higher ...... -\$1.6718
  Queen or higher ... -\$0.7593
  Jack or higher ...... -\$0.1942
  “10” or higher ...... +\$0.0857
  “9” or higher ........ +\$0.1366
  “8” or higher ........ +\$0.0084
  “7” or higher ........ -\$0.2551
  “6” or higher ........ -\$0.6163
  “5” or higher ........ -\$1.0437
  “4” or higher ........ -\$1.5119
  “3” or higher ........ -\$2.0017
  “2” or higher ........ -\$2.50
  
  ##### Share on other sites
  
  • 0
  
  I went back and looked at the numbers a little differently.
  
  If you have 1 card, on average what card [or higher] should you expect if you draw 3 more cards?
  
  One way to look at this is to choose a card and see if it's probability is more than 0.5 for 3 more card draws.
  
  Since we are looking at a series of cards, this is similar to the problem hitting a target with a dart. If the P [hit] = 0.6, then P [miss] = 0.4. If you throw 2 darts, the P [hit 2 darts] = 1 - P[miss (1 dart)]*P[miss (1 dart)] = 1- [0.4 * 0.4] = 1 - 0.16 = 0.84
  
  For the shady game a similar calculation can be used.
  
  For the first card
  
  What is the likelihood that 10 or better will come up in the next 3 cards dealt?
  
  P[ 10 thru 13 (1 card)] = 4/13 = 1 - P[1 thru 9 (1 card)]
  
  thus P[1 thru 9 (1 card)] = 9/13
  
  P[10 thru 13 (3 cards)] = 1 - {P[1 thru 9 (1 card)]}3 = 1 - [9/13]3 = 1- (0.69)3 = 1-0.332 = 0.668
  
  So well more than half the time, you should expect to get a 10 or higher in the next 3 cards.
  
  P[11 thru 13 (3 cards)] = 1 - {P[1 thru 10 (1 card)]}3 = 1 - [10/13]3 = 1- (0.77)3 = 1-0.455 = 0.545
  
  So more than half the time, you should expect to get a 11 or higher in the next 3 cards [indicating that you should draw on 10]
  
  The same calculation will yield P[12 thru 13 (3 cards)] = .0394 well below .5
  
  Indicating that you should draw on 10 and hold on 11 for the first card.
  
  What value of X will reach 50%?
  
  0.5 = X3/133
  
  X3 = 0.5*[133] = 2197/2 = 1098.5 thus X = 10.318
  
  This would imply that for the first card you draw if the card showing is less than 10.3 and hold if the card is greater than 10.3. For the first card hold 11, draw 10
  
  For the second card
  
  Y2 = 0.5*[132] = 169/2 = 84.5 thus Y = 9.19
  
  Thus for the second card: hold 10 draw 9
  
  For the 3rd card
  
  Z = 13/5 = 6.5
  
  For the 3rd card hold 7 draw 6
  
  ##### Share on other sites
  
  • 0
  
  After all of those calculations, I decided to run some simulations on the 3 strategies put forward:
  
  • 9 9 9 [ stay on 9 or better for each of the first 3 cards
  • 9 8 7 [stay for 9 on the first card, 8 on the second and 7 on the third]; and
  • 11 10 7 [described above]
  
  When I ginned this up on the spread sheet, I entered the limits incorrectly for " 11 10 7" and actually entered "10 9 6".
  
  Imagine my surprise when I found that "10 9 6" out performed all 3 of the other strategies.
  
  I ran 100k trials and captured the cumulative results at 50k and 100k.
  
  The column below the strategy name is the average pay off for that strategy
  
  "Best" is the number of trials in which this strategy out performed the other.
  
  Results
  
  "9 9 9 " Best "9 8 7" Best "10 9 6" Best "11 10 7 " Best Trials 0.058 1,205 0.054 655 0.097 509 0.071 3,082 50k 0.069 2,422 0.070 1,435 0.103 1,015 0.080 6,153 100k
  
  It is interesting that "11 10 7" had a lot more bests that any others, but did not have the highest payoff.
  
  I will be glad to share the spread sheet with you, if you want to look it over or dabble with it.
  
  ##### Share on other sites
  
  • 0
  
  I'd like to see the spreadsheet. Thx.
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  2). On the second card draw always stay on 9.
  3). On the third card draw:
  a) if the first two cards add up to 14 or more – stay on 7;
  b) if the first two cards add up to less than 14 – stay on 8
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  The first two cards didn't seem to have that much effect in simulations.
  
  For 20 million simulations of four different cases: All values +/- 0.0003:
  
  Cards 1+2 < 14 Cards 1+2 >= 14 Average
  
  10 9 7 10.2047 10.2048 10.2048
  
  10 9 8 10.2069 10.2063 10.2066
  
  10 9 8 seems always preferable to 10 9 7.
  
  ##### Share on other sites
  
  • 0
  
  I'd like to see the spreadsheet. Thx.
  
  I will happily share the spread sheet. I am sure how I can post it or send it to you?? There does not seem to be a way to attach a file to a post or a msg.
  
  pls send me a note.
  
  ##### Share on other sites
  
  • 0
  
  I did, I think, last night... check your mail.
  
  ##### Share on other sites
  
  • 0
  
  I did, I think, last night... check your mail.
  
  I just looked, nothing there.
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  Since we have such a small portion of the total deck in play, do you really think that the values of the first 2 cards really significantly impact the values of the remaining cards [enough to influence the strategy]?
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path...
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  Since we have such a small portion of the total deck in play, do you really think that the values of the first 2 cards really significantly impact the values of the remaining cards [enough to influence the strategy]?
  
  Cards leaving the deck must be accounted for. Whether the difference between the exact and an approximate strategy is significant depends on how you view extra few \$\$ gained after thousands of games played. (See my next post.)
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  The first two cards didn't seem to have that much effect in simulations.
  
  For 20 million simulations of four different cases: All values +/- 0.0003:
  
  Cards 1+2 < 14 Cards 1+2 >= 14 Average
  
  10 9 7 10.2047 10.2048 10.2048
  
  10 9 8 10.2069 10.2063 10.2066
  
  10 9 8 seems always preferable to 10 9 7.
  
  The code calculates the exact probability for the average payoff with the best strategy (unless I messed up.)
  
  Both simulation and code must take into account the cards leaving the deck. Also, must discard invalid (in terms of strategy) variations. E.g., a draw like (13, 13, 8).
  
  The criteria for the staying card on the third turn can be established analytically (see the spoiler.)
  
  The criteria for the staying card on the third turn can be established analytically:
  
  Initially all cards in the deck add up to 364 for the average draw of 364/52 = 7. Let’s say we drew (1, 1, 7). Now the average draw for the fourth turn becomes: (364-1-1-7)/49 ~ 7.24, which is better than 7, meaning we must draw. If we drew (9, 8, 7), the average of the fourth draw would be (364-9-8-7)/49 ~ 6.94, meaning we should stay on 7 and not go for the fourth draw.
  
  Whereas to find the second and first turn staying criteria and corresponding average payoff, I resort to writing a program.
  
  The code essentially relies on a recursive (one that invokes itself) function DrawCard(Deck(), Probability, DrawTurn) and looks somewhat like the following:
  
  ' Initialize deck with 4 cards of each value.
  
  For i = 1 To 13 Step 1
  
  deck(i) = 4
  
  Next i
  
  AvgPayoff = DrawCard(deck(), 1, 1)
  
  End
  
  '****************************
  
  ' The recursive function**
  
  '****************************
  
  DrawCard(deck(), Probability, DrawTrun)
  
  Rpay = 0 ‘ Accumulator for the average pay in this routine instance.
  
  ' Go through the cards from King=13 down to Ace=1,
  
  ' while finding stay/draw strategy and accumulating the average payoff.
  
  For c = 13 To 1 Step -1
  
  wkprob = Probability * deck( c ) / (53 - DrawTurn) ' deck( c ) is how many of this card is left in the deck; 53 - DrawTurn is the number of cards in the deck
  
  If DrawTurn < 4 Then
  
  For i = 1 To 13 ‘ make a work copy of the deck to pass down to the next level of the DrawCard() function.
  
  wkdeck(i) = deck(i)
  
  Next i
  
  wkdeck( c ) = wkdeck( c ) – 1 ‘ remove card from the deck
  
  drawpay = DrawCard(wkdeck(), wkprob, DrawTurn + 1)
  
  If drawpay > wkprob * c Then ' Drawing pays more
  
  Rpay = Rpay + drawpay
  
  Else ' Staying pays more, or same
  
  Rpay = Rpay + c * wkprob
  
  End If
  
  Else
  
  Rpay = Rpay + c * wkprob ‘ The last 4th draw
  
  End If
  
  Next c
  
  Return Rpay
  
  End
  
  Note, this code should find the optimal path and produce the average payoff for that path. It does not show what the optimal path is. To reveal the optimal path, you need to do some tweaking with the code.
  
  Very nice Prime, as usual.
  
  And no, I don't think anything is messed up - nothing I see suggests that 10.2070 is incorrect.
  
  It would be interesting to see your code's four payoff values for 10 9 7 and 10 9 8 when the first two cards are above and below 14. The code would have to be modified from "search" mode to where 10 9 are given, and results sorted into two categories with respect to 14. I think I see how to calculate it directly, at least the EV for 10 9. The EV contribution for the third draw, in the two cases is a little complicated, and I didn't finish it last night.
  
  ##### Share on other sites
  
  • 0
  
  ...
  
  Very nice Prime, as usual.
  
  And no, I don't think anything is messed up - nothing I see suggests that 10.2070 is incorrect.
  
  It would be interesting to see your code's four payoff values for 10 9 7 and 10 9 8 when the first two cards are above and below 14. The code would have to be modified from "search" mode to where 10 9 are given, and results sorted into two categories with respect to 14. I think I see how to calculate it directly, at least the EV for 10 9. The EV contribution for the third draw, in the two cases is a little complicated, and I didn't finish it last night.
  
  Thanks.
  
  I am not clear on the calculation you've requested. In the case of (10,9,7) the first two cards add up to 19. We don't need an aid of a computer to calculate the average payoff of the 4th draw in case of (10,9,7). It is (364-10-9-7)/49 ~ 6.9, meaning we must stay on (10,9,7) and even more so -- on (10,9,8).
  
  However, that's a moot point, since the recursive function comes back to the case of (10,9) with the value of the draw of ~8.5653, whereupon it "decides" it is better to stay on (10,9) and discards the value of the draw. Later on the function comes back to the case of (10) with the value of the draw of ~9.5431 and again discards it in favor of 10 in hand.
  
  Conversely, in the case of the first card of (9), the function returns the average payoff for the draw with the best strategy of ~9.5818, meaning that drawing is better.
  
  Actual program that I ran spills out into Excel spreadsheet optimal payoffs for all first two card combinations, all first card draws, and the final result. Also showing best staying card in each case.
  
  ##### Share on other sites
  
  • 0
  
  ....
  
  ...
  
  It would be interesting to see your code's four payoff values for 10 9 7 and 10 9 8 when the first two cards are above and below 14. The code would have to be modified from "search" mode to where 10 9 are given, and results sorted into two categories with respect to 14. I think I see how to calculate it directly, at least the EV for 10 9. The EV contribution for the third draw, in the two cases is a little complicated, and I didn't finish it last night.
  
  It suddenly downed on me, what you meant. The (10, 9, 8) and (10, 9, 7) are not the actual cards drawn, but rather representations of two different strategies. So, (10, 9, 8) means: stay on 10 and up on the first card, on 9 and up – on the second, and on 8 - on the third.
  
  In this game, there are only 6 actual valid combinations where it is preferable to stay on 7 on the third turn, rather than draw a fourth card.
  
  E.g., (9,8,7) occurring at the probability of (4/52)*(4/51)*(4/50) with the 4th draw value: 350/49 ~ 6.979591837.
  The table of all six cases is as following:
  1ST CARD 2ND CARD 3RD CARD 4TH DRAW AVG PROBABILITY
  9 6 7 6.979591837 0.000482655
  9 7 7 6.959183673 0.000361991
  9 8 7 6.93877551 0.000482655
  8 7 7 6.979591837 0.000361991
  8 8 7 6.959183673 0.000361991
  7 8 7 6.979591837 0.000361991
  
  Multiplying the probability of each case by the difference between 7 and the 4th draw average, and adding the six results together, yields approximately 0.0000837258.
  If you subtract that from the analytical result of the average payoff of 10.2070305 that I got, it agrees with your computer simulation result of 10.2069.
  So the strategy S(10,9,8) has a disadvantage of approximately 0.008 of a cent compared to the strategy where you stop on you third turn on 7 or up if the first two cards add up to 15 or more, and stop on 8 and up otherwise.
  And of course, the strategy S(10,9,7), where you stay on 7 and up on your third turn regardless of the cards drawn in previous two turns, is even worse.
  Edited by Prime
  
  ## Join the conversation
  
  You can post now and register later. If you have an account, sign in now to post with your account.
  
  ×   Pasted as rich text.   Paste as plain text instead
  
  Only 75 emoji are allowed.
  
  ×   Your previous content has been restored.   Clear editor
  
  ×   You cannot paste images directly. Upload or insert images from URL.
explanation: The provided text is a discussion from a brain teaser website, specifically about a card game strategy. The text contains a question about the optimal strategy for a card game, and it also includes answers and discussions about the strategy, including simulations and calculations.
distilabel_metadata.content: Evaluate the user given text extract and determine if it contains a math question and optionally and answer to this question.
  
  Output rules:
  
  1. Briefly describe the document and mention if it contains a question or a question and answer.
  2. Finalize the output with: Label: no-question,question,question-and-answer,multiple-question,multiple-question-and-answer
distilabel_metadata.role: system
distilabel_metadata.content: BrainDen.com - Brain Teasers
  • 0
  
  ## Question
  
  "Here's the deal. You give me \$10. Then I will deal four cards (from a regular 52 card deck), chosen randomly, face down. You get to look at #1 first and decide whether to keep it. If not, look at #2 and decide whether to keep that one. If not look at #3, and decide. If you don't take that, then #4 is your choice. If your chosen value is n, I will pay you \$n. Then we can reshuffle the entire deck, you give me another \$10, and we can play again, and again, and again."
  "Hmmm....I need a good strategy to beat you at this game, but I think I can do it."
  Help the second player out with a strategy that will win.
  Note that the cards all have face value with the following exceptions: Ace=1, Jack = 11, Queen = 12, and King = 13.
  
  ## Recommended Posts
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  The first two cards didn't seem to have that much effect in simulations.
  
  For 20 million simulations of four different cases: All values +/- 0.0003:
  
  Cards 1+2 < 14 Cards 1+2 >= 14 Average
  
  10 9 7 10.2047 10.2048 10.2048
  
  10 9 8 10.2069 10.2063 10.2066
  
  10 9 8 seems always preferable to 10 9 7.
  
  The code calculates the exact probability for the average payoff with the best strategy (unless I messed up.)
  
  Both simulation and code must take into account the cards leaving the deck. Also, must discard invalid (in terms of strategy) variations. E.g., a draw like (13, 13, 8).
  
  The criteria for the staying card on the third turn can be established analytically (see the spoiler.)
  
  The criteria for the staying card on the third turn can be established analytically:
  
  Initially all cards in the deck add up to 364 for the average draw of 364/52 = 7. Let’s say we drew (1, 1, 7). Now the average draw for the fourth turn becomes: (364-1-1-7)/49 ~ 7.24, which is better than 7, meaning we must draw. If we drew (9, 8, 7), the average of the fourth draw would be (364-9-8-7)/49 ~ 6.94, meaning we should stay on 7 and not go for the fourth draw.
  
  Whereas to find the second and first turn staying criteria and corresponding average payoff, I resort to writing a program.
  
  The code essentially relies on a recursive (one that invokes itself) function DrawCard(Deck(), Probability, DrawTurn) and looks somewhat like the following:
  
  ' Initialize deck with 4 cards of each value.
  
  For i = 1 To 13 Step 1
  
  deck(i) = 4
  
  Next i
  
  AvgPayoff = DrawCard(deck(), 1, 1)
  
  End
  
  '****************************
  
  ' The recursive function**
  
  '****************************
  
  DrawCard(deck(), Probability, DrawTrun)
  
  Rpay = 0 ‘ Accumulator for the average pay in this routine instance.
  
  ' Go through the cards from King=13 down to Ace=1,
  
  ' while finding stay/draw strategy and accumulating the average payoff.
  
  For c = 13 To 1 Step -1
  
  wkprob = Probability * deck( c ) / (53 - DrawTurn) ' deck( c ) is how many of this card is left in the deck; 53 - DrawTurn is the number of cards in the deck
  
  If DrawTurn < 4 Then
  
  For i = 1 To 13 ‘ make a work copy of the deck to pass down to the next level of the DrawCard() function.
  
  wkdeck(i) = deck(i)
  
  Next i
  
  wkdeck( c ) = wkdeck( c ) – 1 ‘ remove card from the deck
  
  drawpay = DrawCard(wkdeck(), wkprob, DrawTurn + 1)
  
  If drawpay > wkprob * c Then ' Drawing pays more
  
  Rpay = Rpay + drawpay
  
  Else ' Staying pays more, or same
  
  Rpay = Rpay + c * wkprob
  
  End If
  
  Else
  
  Rpay = Rpay + c * wkprob ‘ The last 4th draw
  
  End If
  
  Next c
  
  Return Rpay
  
  End
  
  Note, this code should find the optimal path and produce the average payoff for that path. It does not show what the optimal path is. To reveal the optimal path, you need to do some tweaking with the code.
  
  Edited by Prime
  ##### Share on other sites
  
  • 0
  
  Winning strategy is to keep the card out of the first 3 as soon as you see a 9 or higher card.
  
  Reasoning:
  The probability that you have all 4 cards below 9 is 32*31*30*29/(52*51*50*49) = 0,133
  In this case you lose from \$-2 to \$-9 with equal probability = 0,133/8 = 0,0166
  
  Now the probability that one of the 4 cards is 9 or higher is 1 - 0,133 = 0,867
  Since you stop at the first sight of a 9 or higher card, you stand to win -1,0,1,2,3 with equal probability = 0,867/5 = 0,173
  
  This gives an overall expected winning amount of 0,14 per game you play.
  
  PS: If you decide to stop at 10 higher card only, the expected amount of winning is 0,09 per game. Could be a winning strategy but not the most effective one!
  
  For any other choice of stopping, the expecting winning is negative
  
  • 0
  ##### Share on other sites
  
  • 0
  
  Winning strategy is to keep the card out of the first 3 as soon as you see a 9 or higher card.
  
  Surely your strategy is EV+, but clearly it is not optimal.
  
  For example: after discarding two Deuces your third card turns out to be an Eight. EV of discarding it approximately equals (13+1)/2 = 7, while keeping gives 8, so it's better to keep it, but your strategy says to discard. You've picked a global threshold for each decision, but to make strategy optimal three separate thresholds should be found (for each out of 3 possible decisions of keeping/discarding).
  
  Edited by witzar
  ##### Share on other sites
  
  • 0
  
  Winning strategy is to keep the card out of the first 3 as soon as you see a 9 or higher card.
  
  Surely your strategy is EV+, but clearly it is not optimal.
  
  For example: after discarding two Deuces your third card turns out to be an Eight. EV of discarding it approximately equals (13+1)/2 = 7, while keeping gives 8, so it's better to keep it, but your strategy says to discard. You've picked a global threshold for each decision, but to make strategy optimal three separate thresholds should be found (for each out of 3 possible decisions of keeping/discarding).
  
  Full disclosure: I read this a few nights ago and started thinking about it [eventually falling asleep], I have not done any detailed calculations,, but I did have some thoughts:
  
  I think there may be a strategy that changes your decision criteria as you go along in the game; a series of thresholds that diminish as the game goes along
  
  If [for example] you have drawn 3 cards:
  
  • if the 3rd card is 8 or higher - stay [your probability of drawing a lower card is more than 50%]
  • if the 3rd card is 6 or lower - draw [your probability of drawing a higher card is more than 50%]
  • if the 3rd card is a 7 - do you feel lucky?
  
  If you draw the first card, there is some value X [guessing around 9 or 10] that you are probably better off to draw another card [because out of 3 new cards, you should be able to improve your holding. So the strategy for the first card may be something like this:
  
  • If your 1st card is J, Q or K - definitely stay
  • If your 1st card is below X - draw [with 3 more cards, you can probably do better]
  • If you value is above X - stay
  
  There will be a similar value Y [guessing 7 or 8] that you should use a threshold for the 2nd card.
  
  ##### Share on other sites
  
  • 0
  
  if the first card is 9 or higher, stay.
  
  second, 8 or higher stay.
  
  third, 7 or higher stay.
  
  ev = .3846 +.1448-.4746 = 0.0548
  
  ##### Share on other sites
  
  • 0
  
  You can not beat me at this game, because after finding the best strategy, I will only play for the winning side.
  
  That said....
  
  A simple easily evaluated winning strategy is to stop when you hit "9" or higher.
  The probability of not finding "9" or higher in the first 4 cards is: (32/52)* (31/51)* (30/50)* (29/49) ~ 0.1328. Correspondingly, the probability getting one of those cards would be 1 – 0.1328 = 0.8672.
  Each "high" card value has the same probability (don’t feel like proving this formally.) The average payoff in \$\$ for the cases when hitting "9" or higher is (-1 + 0 + 1 + 2 + 3)/5 = \$1.
  All other cards have the same probability of being in the 4th position when “9” or higher was not found. (Don’t feel like proving that one either.) Thus average payoff for those cases is (-2 – 3 – 4 - 5 – 6 – 7 – 8 – 9)/8 = -\$5.50.
  Making the overall payoff: \$1*0.8672 + -\$5.50*0.1328 = +\$0.1366.
  
  You also end up ahead when you stop only if you get “10” or higher as well as “8” or higher. The entire payoff table is as following:
  
  Stop only if you get
  King or higher ...... -\$1.6718
  Queen or higher ... -\$0.7593
  Jack or higher ...... -\$0.1942
  “10” or higher ...... +\$0.0857
  “9” or higher ........ +\$0.1366
  “8” or higher ........ +\$0.0084
  “7” or higher ........ -\$0.2551
  “6” or higher ........ -\$0.6163
  “5” or higher ........ -\$1.0437
  “4” or higher ........ -\$1.5119
  “3” or higher ........ -\$2.0017
  “2” or higher ........ -\$2.50
  
  ##### Share on other sites
  
  • 0
  
  I went back and looked at the numbers a little differently.
  
  If you have 1 card, on average what card [or higher] should you expect if you draw 3 more cards?
  
  One way to look at this is to choose a card and see if it's probability is more than 0.5 for 3 more card draws.
  
  Since we are looking at a series of cards, this is similar to the problem hitting a target with a dart. If the P [hit] = 0.6, then P [miss] = 0.4. If you throw 2 darts, the P [hit 2 darts] = 1 - P[miss (1 dart)]*P[miss (1 dart)] = 1- [0.4 * 0.4] = 1 - 0.16 = 0.84
  
  For the shady game a similar calculation can be used.
  
  For the first card
  
  What is the likelihood that 10 or better will come up in the next 3 cards dealt?
  
  P[ 10 thru 13 (1 card)] = 4/13 = 1 - P[1 thru 9 (1 card)]
  
  thus P[1 thru 9 (1 card)] = 9/13
  
  P[10 thru 13 (3 cards)] = 1 - {P[1 thru 9 (1 card)]}3 = 1 - [9/13]3 = 1- (0.69)3 = 1-0.332 = 0.668
  
  So well more than half the time, you should expect to get a 10 or higher in the next 3 cards.
  
  P[11 thru 13 (3 cards)] = 1 - {P[1 thru 10 (1 card)]}3 = 1 - [10/13]3 = 1- (0.77)3 = 1-0.455 = 0.545
  
  So more than half the time, you should expect to get a 11 or higher in the next 3 cards [indicating that you should draw on 10]
  
  The same calculation will yield P[12 thru 13 (3 cards)] = .0394 well below .5
  
  Indicating that you should draw on 10 and hold on 11 for the first card.
  
  What value of X will reach 50%?
  
  0.5 = X3/133
  
  X3 = 0.5*[133] = 2197/2 = 1098.5 thus X = 10.318
  
  This would imply that for the first card you draw if the card showing is less than 10.3 and hold if the card is greater than 10.3. For the first card hold 11, draw 10
  
  For the second card
  
  Y2 = 0.5*[132] = 169/2 = 84.5 thus Y = 9.19
  
  Thus for the second card: hold 10 draw 9
  
  For the 3rd card
  
  Z = 13/5 = 6.5
  
  For the 3rd card hold 7 draw 6
  
  ##### Share on other sites
  
  • 0
  
  After all of those calculations, I decided to run some simulations on the 3 strategies put forward:
  
  • 9 9 9 [ stay on 9 or better for each of the first 3 cards
  • 9 8 7 [stay for 9 on the first card, 8 on the second and 7 on the third]; and
  • 11 10 7 [described above]
  
  When I ginned this up on the spread sheet, I entered the limits incorrectly for " 11 10 7" and actually entered "10 9 6".
  
  Imagine my surprise when I found that "10 9 6" out performed all 3 of the other strategies.
  
  I ran 100k trials and captured the cumulative results at 50k and 100k.
  
  The column below the strategy name is the average pay off for that strategy
  
  "Best" is the number of trials in which this strategy out performed the other.
  
  Results
  
  "9 9 9 " Best "9 8 7" Best "10 9 6" Best "11 10 7 " Best Trials 0.058 1,205 0.054 655 0.097 509 0.071 3,082 50k 0.069 2,422 0.070 1,435 0.103 1,015 0.080 6,153 100k
  
  It is interesting that "11 10 7" had a lot more bests that any others, but did not have the highest payoff.
  
  I will be glad to share the spread sheet with you, if you want to look it over or dabble with it.
  
  ##### Share on other sites
  
  • 0
  
  I'd like to see the spreadsheet. Thx.
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  2). On the second card draw always stay on 9.
  3). On the third card draw:
  a) if the first two cards add up to 14 or more – stay on 7;
  b) if the first two cards add up to less than 14 – stay on 8
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  The first two cards didn't seem to have that much effect in simulations.
  
  For 20 million simulations of four different cases: All values +/- 0.0003:
  
  Cards 1+2 < 14 Cards 1+2 >= 14 Average
  
  10 9 7 10.2047 10.2048 10.2048
  
  10 9 8 10.2069 10.2063 10.2066
  
  10 9 8 seems always preferable to 10 9 7.
  
  ##### Share on other sites
  
  • 0
  
  I'd like to see the spreadsheet. Thx.
  
  I will happily share the spread sheet. I am sure how I can post it or send it to you?? There does not seem to be a way to attach a file to a post or a msg.
  
  pls send me a note.
  
  ##### Share on other sites
  
  • 0
  
  I did, I think, last night... check your mail.
  
  ##### Share on other sites
  
  • 0
  
  I did, I think, last night... check your mail.
  
  I just looked, nothing there.
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  Since we have such a small portion of the total deck in play, do you really think that the values of the first 2 cards really significantly impact the values of the remaining cards [enough to influence the strategy]?
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path...
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  Since we have such a small portion of the total deck in play, do you really think that the values of the first 2 cards really significantly impact the values of the remaining cards [enough to influence the strategy]?
  
  Cards leaving the deck must be accounted for. Whether the difference between the exact and an approximate strategy is significant depends on how you view extra few \$\$ gained after thousands of games played. (See my next post.)
  
  ##### Share on other sites
  
  • 0
  
  To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path.
  
  In this case such program is relatively simple, while variations aren’t that many. Thus the payoff for the best strategy is found. To produce a formulation of the strategy complicates matters a little bit. However, in this case with the maximum of only 4 card draws, the best strategy can be expressed in simple terms as well.
  
  The average draw with the best strategy is 10.2070. With the given game set up that translates into a payoff of \$10.2070 - \$10 = +\$0.2070 (or less than 21 cent per each shuffle on average.)
  
  The best strategy is like so:
  
  1). On the first card draw always stay on 10 or higher and draw otherwise.
  
  2). On the second card draw always stay on 9.
  
  3). On the third card draw:
  
  a) if the first two cards add up to 14 or more – stay on 7;
  
  b) if the first two cards add up to less than 14 – stay on 8
  
  The first two cards didn't seem to have that much effect in simulations.
  
  For 20 million simulations of four different cases: All values +/- 0.0003:
  
  Cards 1+2 < 14 Cards 1+2 >= 14 Average
  
  10 9 7 10.2047 10.2048 10.2048
  
  10 9 8 10.2069 10.2063 10.2066
  
  10 9 8 seems always preferable to 10 9 7.
  
  The code calculates the exact probability for the average payoff with the best strategy (unless I messed up.)
  
  Both simulation and code must take into account the cards leaving the deck. Also, must discard invalid (in terms of strategy) variations. E.g., a draw like (13, 13, 8).
  
  The criteria for the staying card on the third turn can be established analytically (see the spoiler.)
  
  The criteria for the staying card on the third turn can be established analytically:
  
  Initially all cards in the deck add up to 364 for the average draw of 364/52 = 7. Let’s say we drew (1, 1, 7). Now the average draw for the fourth turn becomes: (364-1-1-7)/49 ~ 7.24, which is better than 7, meaning we must draw. If we drew (9, 8, 7), the average of the fourth draw would be (364-9-8-7)/49 ~ 6.94, meaning we should stay on 7 and not go for the fourth draw.
  
  Whereas to find the second and first turn staying criteria and corresponding average payoff, I resort to writing a program.
  
  The code essentially relies on a recursive (one that invokes itself) function DrawCard(Deck(), Probability, DrawTurn) and looks somewhat like the following:
  
  ' Initialize deck with 4 cards of each value.
  
  For i = 1 To 13 Step 1
  
  deck(i) = 4
  
  Next i
  
  AvgPayoff = DrawCard(deck(), 1, 1)
  
  End
  
  '****************************
  
  ' The recursive function**
  
  '****************************
  
  DrawCard(deck(), Probability, DrawTrun)
  
  Rpay = 0 ‘ Accumulator for the average pay in this routine instance.
  
  ' Go through the cards from King=13 down to Ace=1,
  
  ' while finding stay/draw strategy and accumulating the average payoff.
  
  For c = 13 To 1 Step -1
  
  wkprob = Probability * deck( c ) / (53 - DrawTurn) ' deck( c ) is how many of this card is left in the deck; 53 - DrawTurn is the number of cards in the deck
  
  If DrawTurn < 4 Then
  
  For i = 1 To 13 ‘ make a work copy of the deck to pass down to the next level of the DrawCard() function.
  
  wkdeck(i) = deck(i)
  
  Next i
  
  wkdeck( c ) = wkdeck( c ) – 1 ‘ remove card from the deck
  
  drawpay = DrawCard(wkdeck(), wkprob, DrawTurn + 1)
  
  If drawpay > wkprob * c Then ' Drawing pays more
  
  Rpay = Rpay + drawpay
  
  Else ' Staying pays more, or same
  
  Rpay = Rpay + c * wkprob
  
  End If
  
  Else
  
  Rpay = Rpay + c * wkprob ‘ The last 4th draw
  
  End If
  
  Next c
  
  Return Rpay
  
  End
  
  Note, this code should find the optimal path and produce the average payoff for that path. It does not show what the optimal path is. To reveal the optimal path, you need to do some tweaking with the code.
  
  Very nice Prime, as usual.
  
  And no, I don't think anything is messed up - nothing I see suggests that 10.2070 is incorrect.
  
  It would be interesting to see your code's four payoff values for 10 9 7 and 10 9 8 when the first two cards are above and below 14. The code would have to be modified from "search" mode to where 10 9 are given, and results sorted into two categories with respect to 14. I think I see how to calculate it directly, at least the EV for 10 9. The EV contribution for the third draw, in the two cases is a little complicated, and I didn't finish it last night.
  
  ##### Share on other sites
  
  • 0
  
  ...
  
  Very nice Prime, as usual.
  
  And no, I don't think anything is messed up - nothing I see suggests that 10.2070 is incorrect.
  
  It would be interesting to see your code's four payoff values for 10 9 7 and 10 9 8 when the first two cards are above and below 14. The code would have to be modified from "search" mode to where 10 9 are given, and results sorted into two categories with respect to 14. I think I see how to calculate it directly, at least the EV for 10 9. The EV contribution for the third draw, in the two cases is a little complicated, and I didn't finish it last night.
  
  Thanks.
  
  I am not clear on the calculation you've requested. In the case of (10,9,7) the first two cards add up to 19. We don't need an aid of a computer to calculate the average payoff of the 4th draw in case of (10,9,7). It is (364-10-9-7)/49 ~ 6.9, meaning we must stay on (10,9,7) and even more so -- on (10,9,8).
  
  However, that's a moot point, since the recursive function comes back to the case of (10,9) with the value of the draw of ~8.5653, whereupon it "decides" it is better to stay on (10,9) and discards the value of the draw. Later on the function comes back to the case of (10) with the value of the draw of ~9.5431 and again discards it in favor of 10 in hand.
  
  Conversely, in the case of the first card of (9), the function returns the average payoff for the draw with the best strategy of ~9.5818, meaning that drawing is better.
  
  Actual program that I ran spills out into Excel spreadsheet optimal payoffs for all first two card combinations, all first card draws, and the final result. Also showing best staying card in each case.
  
  ##### Share on other sites
  
  • 0
  
  ....
  
  ...
  
  It would be interesting to see your code's four payoff values for 10 9 7 and 10 9 8 when the first two cards are above and below 14. The code would have to be modified from "search" mode to where 10 9 are given, and results sorted into two categories with respect to 14. I think I see how to calculate it directly, at least the EV for 10 9. The EV contribution for the third draw, in the two cases is a little complicated, and I didn't finish it last night.
  
  It suddenly downed on me, what you meant. The (10, 9, 8) and (10, 9, 7) are not the actual cards drawn, but rather representations of two different strategies. So, (10, 9, 8) means: stay on 10 and up on the first card, on 9 and up – on the second, and on 8 - on the third.
  
  In this game, there are only 6 actual valid combinations where it is preferable to stay on 7 on the third turn, rather than draw a fourth card.
  
  E.g., (9,8,7) occurring at the probability of (4/52)*(4/51)*(4/50) with the 4th draw value: 350/49 ~ 6.979591837.
  The table of all six cases is as following:
  1ST CARD 2ND CARD 3RD CARD 4TH DRAW AVG PROBABILITY
  9 6 7 6.979591837 0.000482655
  9 7 7 6.959183673 0.000361991
  9 8 7 6.93877551 0.000482655
  8 7 7 6.979591837 0.000361991
  8 8 7 6.959183673 0.000361991
  7 8 7 6.979591837 0.000361991
  
  Multiplying the probability of each case by the difference between 7 and the 4th draw average, and adding the six results together, yields approximately 0.0000837258.
  If you subtract that from the analytical result of the average payoff of 10.2070305 that I got, it agrees with your computer simulation result of 10.2069.
  So the strategy S(10,9,8) has a disadvantage of approximately 0.008 of a cent compared to the strategy where you stop on you third turn on 7 or up if the first two cards add up to 15 or more, and stop on 8 and up otherwise.
  And of course, the strategy S(10,9,7), where you stay on 7 and up on your third turn regardless of the cards drawn in previous two turns, is even worse.
  Edited by Prime
  
  ## Join the conversation
  
  You can post now and register later. If you have an account, sign in now to post with your account.
  
  ×   Pasted as rich text.   Paste as plain text instead
  
  Only 75 emoji are allowed.
  
  ×   Your previous content has been restored.   Clear editor
  
  ×   You cannot paste images directly. Upload or insert images from URL.
distilabel_metadata.role: user
distilabel_metadata.raw_output_q_a_detector_0: The provided text is a discussion from a brain teaser website, specifically about a card game strategy. The text contains a question about the optimal strategy for a card game, and it also includes answers and discussions about the strategy, including simulations and calculations.
  
  Label: question-and-answer