HP Forums

Full Version: Little math problem(s) April 2019
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There is a deck of 52 cards. 26 red and 26 black. Shuffled.
The host is going to turn one card at time.

You get 1 dollar/euro/pound/<equivalent unit of money> each time you correctly predict the color of the card turned. You get nothing if you fail.

What is the best strategy for the game, to maximize the expected value of the money got from the game?
I think I'd call whichever colour has most cards remaining in the pack (if they are different).
(04-23-2019 10:10 PM)ijabbott Wrote: [ -> ]I think I'd call whichever colour has most cards remaining in the pack (if they are different).

This gives you about $4 more Smile

Code:
from random import randrange, shuffle
       
def pick_less_seen(win=0, deck=[0,1]*26):
    seen = [0,0]
    shuffle(deck)
    for card in deck:
        pick = randrange(2) if seen[0]==seen[1] else (seen[0] > seen[1])
        win += pick == card
        seen[card] += 1
    return win

>>> n = 10000
>>> print sum(pick_less_seen() for i in range(n)) / n - 26
4.0425
I guess red every time and win $26.
(04-24-2019 07:39 PM)David Hayden Wrote: [ -> ]I guess red every time and win $26.

That's a safe bet as it guarantees winning (at least) 26 hands. However, once 26 reds have been revealed, it would make sense to switch to black!
Reference URL's