Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Here's the question. It's quite difficult:

David is given a deck of 40 cards. There are 3 gold cards in the deck, 3 silver cards in the deck, 3 bronze cards in the deck and 3 black cards in the deck. If David draws the gold card on his first turn, he will win $50. (The object is to get at least one gold card). The other colored cards are used to help him get the gold card, while the remaining 28 do nothing.

David initially draws a hand of 6 cards, and will now try to draw a gold card, if he did not already already draw one. He may now use the other cards to help him. All of the differently colored cards may be used in the first turn.

David can use a silver card to draw 1 more card.

David can use a bronze card to draw 1 more card. However, he can only use 1 of these per turn.

David can use a black card to look at the top 3 cards of the deck, and add one of them to his hand. He then sends the rest back to the deck and shuffles. He can only use 1 of these cards per turn.

What are the odds David draws the gold card on his first turn?

share|improve this question
    
What's a turn? And what's the source? –  mixedmath May 28 '12 at 12:07
    
I got it from a friend of mine. –  David May 28 '12 at 12:09
    
This is what he put: I believe the odds of him just drawing a gold card in the initial 6 cards 39.5%. The odds of him not drawing any colored cards in the first 6 cards is 9.8%. The remaining 50.7% is a mystery to me. –  David May 28 '12 at 12:10
    
I think a turn clearly means a draw of 6 cards which ends when all six cards are drawn with the moves described in the rules for what he can do when silver, bronze and black cards are drawn. –  Michael Chernick May 28 '12 at 12:15
1  
It also depends on what he does. Does he use the black card first, or the bronze card, and which cards does he pick when looking at the top three? Once you have a clear deterministic strategy, then I think the best approach is to simulate the game, and see what the probability is. –  utdiscant May 28 '12 at 12:21

2 Answers 2

up vote 3 down vote accepted

I have implemented the game in Python using the following strategy:

  1. Look for the golden card
  2. Use black card first. When using the black card, we take cards with the following preference: gold > silver > bronze
  3. Use bronze card
  4. Use silver card

I then simulated the game by running it 1.000.000 times. The result is, that the game was won in 588152 of the simulations. So this indicates, that you have roughly a 58.8% chance of getting the gold card.

My implementation is here:

import random

# Card Game
def playGame():
    deck = []

    for i in range(3):
        deck.append("gold")
        deck.append("silver")
        deck.append("bronze")
        deck.append("black")

    for i in range(24):
        deck.append("blank")

    random.shuffle(deck)

    hand = []

    for i in range(6):
        hand.append(deck.pop())

    # Let the game begin
    bronze_used = False
    black_used = False

    print "\nStarting hand"

    while True:
        print hand

        # Check if he has the gold Card
        if "gold" in hand:
            print "Won!"
            return 1

        # Use black card
        if "black" in hand:
            black_used = True
            hand.remove("black")

            print "Used black"

            # Look for the golden card
            if "gold" in deck[0:3]:
                hand.append("gold")
                deck.remove("gold")
                continue

            if "silver" in deck[0:3]:
                hand.append("silver")
                deck.remove("silver")
                random.shuffle(deck)
                continue

            if "bronze" in deck[0:3] and bronze_used == False:
                hand.append("bronze")
                deck.remove("bronze")
                random.shuffle(deck)
                continue

            continue

        # Use bronze card
        if "bronze" in hand and bronze_used == False:
            bronze_used = True
            print "Used bronze"

            hand.remove("bronze")
            hand.append(deck.pop())
            continue

        # Use silver card
        if "silver" in hand:
            print "Used silver"

            hand.remove("silver")
            hand.append(deck.pop())
            continue

        if "gold" not in hand:
            if "silver" not in hand:
                if "black" not in hand or black_used:
                    if "bronze" not in hand or bronze_used:
                        return 0

win = 0
N = 10000

for i in range(N):
    win = win + playGame()

print win, "wins of a total of", N

Edit: I changed the simulation to use silver cards before bronze, but this did not change the result. Still 58.8% chance of winning. This also makes fine sense - to me at least.

share|improve this answer
    
Wow, this is great. Thanks :) –  David May 28 '12 at 12:46
    
There are some small errors in the script, I will fix them, and update the answer. –  utdiscant May 28 '12 at 12:49
    
I had a small error, which made it possible to use multiple bronze cards. –  utdiscant May 28 '12 at 12:53
    
If it wouldn't be too much trouble, I'd really like to see the same bit run, but with silvers used before bronzes used before black. For some reason, my intuition tells me this might lead to a different (better?) result. But +1 - great work. –  mixedmath May 28 '12 at 14:26
1  
Seem to me that there is an error in your simulator: you must shuffle the deck even if you don't pick any card (after using black card), otherwise you continue the game with "blank-blank-blank", and you fail every time, instead of drawing a new card with a silver/bronze and having a chanche of it being gold/silver/bronze. So the probability should be a little higher. –  carlop Nov 11 '12 at 18:40

We can ignore the silver cards-each should be replaced whenever we see it with another. Similarly, if you have a bronze, you should draw immediately (but subsequent bronzes don't let you replace them). So the deck is really $36$ cards, $3$ gold, $3$ black, and $30$ other (including the 2 bronzes after the first). You win if there is a gold in the first $6$, or a black in the first six, no gold in 1-6 and a gold in 7-9, or a black in 1-6, another in 1-9, no gold in 1-9 and a gold in 10-12, or a black in 1-6, another in 1-9, another in 1-12, no gold in 1-12 and a gold in 13-15. All these possibilities are disjoint, so you can just add them up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.