## Welcome to BrainDen.com - Brain Teasers Forum

 Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account. As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends. Of course, you can also enjoy our collection of amazing optical illusions and cool math games. If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top. If you have a website, we would appreciate a little link to BrainDen. Thanks and enjoy the Den :-)
Guest Message by DevFuse

Best Answer Prime, 25 October 2013 - 07:42 PM

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.

Spoiler for Optimal game

The first two cards didn't seem to have that much effect in simulations.

Spoiler for My simulation

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.)

Spoiler for programming code

Go to the full post

20 replies to this topic

### #11 Prime

Prime

Senior Member

• Members
• 872 posts
• Gender:Male
• Location:Illinois, US

Posted 25 October 2013 - 03:31 AM

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.

Spoiler for Optimal game

• 0

Past prime, actually.

### #12 bonanova

bonanova

bonanova

• Moderator
• 5895 posts
• Gender:Male
• Location:New York

Posted 25 October 2013 - 02:19 PM

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.

Spoiler for Optimal game

The first two cards didn't seem to have that much effect in simulations.

Spoiler for My simulation

• 0
The greatest challenge to any thinker is stating the problem in a way that will allow a solution.
- Bertrand Russell

### #13 dgreening

dgreening

Junior Member

• Members
• 74 posts
• Gender:Male
• Location:Maryland [DC area]

Posted 25 October 2013 - 02:36 PM

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.

• 0

### #14 bonanova

bonanova

bonanova

• Moderator
• 5895 posts
• Gender:Male
• Location:New York

Posted 25 October 2013 - 02:42 PM

I did, I think, last night... check your mail.

• 0
The greatest challenge to any thinker is stating the problem in a way that will allow a solution.
- Bertrand Russell

### #15 dgreening

dgreening

Junior Member

• Members
• 74 posts
• Gender:Male
• Location:Maryland [DC area]

Posted 25 October 2013 - 03:35 PM

I did, I think, last night... check your mail.

I just looked, nothing there.

• 0

### #16 dgreening

dgreening

Junior Member

• Members
• 74 posts
• Gender:Male
• Location:Maryland [DC area]

Posted 25 October 2013 - 04:15 PM

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.

Spoiler for Optimal game

• 0

### #17 Prime

Prime

Senior Member

• Members
• 872 posts
• Gender:Male
• Location:Illinois, US

Posted 25 October 2013 - 07:13 PM

To calculate the payoff for the best dynamic strategy, we need a computer program, which traverses all variations choosing optimal path...

Spoiler for Optimal game

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.)

• 0

Past prime, actually.

### #18 Prime

Prime

Senior Member

• Members
• 872 posts
• Gender:Male
• Location:Illinois, US

Posted 25 October 2013 - 07:42 PM   Best Answer

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.

Spoiler for Optimal game

The first two cards didn't seem to have that much effect in simulations.

Spoiler for My simulation

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.)

Spoiler for programming code

Edited by Prime, 25 October 2013 - 07:49 PM.

• 0

Past prime, actually.

### #19 bonanova

bonanova

bonanova

• Moderator
• 5895 posts
• Gender:Male
• Location:New York

Posted 26 October 2013 - 04:28 AM

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.

Spoiler for Optimal game

The first two cards didn't seem to have that much effect in simulations.

Spoiler for My simulation

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.)

Spoiler for programming 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.

• 0
The greatest challenge to any thinker is stating the problem in a way that will allow a solution.
- Bertrand Russell

### #20 Prime

Prime

Senior Member

• Members
• 872 posts
• Gender:Male
• Location:Illinois, US

Posted 26 October 2013 - 08:31 AM

...

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.

• 0

Past prime, actually.

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users