CoCalc Public FilesRace to The Finish.ipynbOpen with one click!
Author: Johann Thiel
Views : 104
Compute Environment: Ubuntu 18.04 (Deprecated)

Race to the Finish

In this game on Let's Make a Deal, contestants can win one of three prizes or lose by "winning" the zonk. Cards are drawn from a standard deck without replacement until one of four scenarios occurs:

  1. 5 hearts are drawn before 4 spades, 3 diamonds, or 3 clubs are drawn.
  2. 4 spades are drawn before 5 hearts, 3 diamonds, or 3 clubs are drawn.
  3. 3 diamonds are drawn before 5 hearts, 4 spades, or 3 clubs are drawn.
  4. 3 clubs are drawn before 5 hearts, 4 spades, or 3 diamonds are drawn.

Scenarios 1, 2, and 3 correspond to winning prizes (in decreasing value), while scenario 4 corresponds to losing the game by earning the zonk.

What is the probability of winning a prize? What is the probability of each outcome?

Computing this probability is not easy. Let's simulate a playthrough 10,000 times and see what happens.

First we import the numpy Python library to help with our simulations.

In [1]:
import numpy as np

Now we create a standard deck of cards cards.

In [2]:
values = ['2','3','4','5','6','7','8','9','10','J','Q','K','A'] suits = ['H','S','D','C'] cards = np.array([(v,s) for s in suits for v in values])

The following variables will keep track of the number of outcomes in each scenario.

In [3]:
win_heart = 0 win_spade = 0 win_diamond = 0 lose = 0

We are now ready for the main loop. We will conduct 10,000 trials of shuffling a deck and picking cards from the top in order until one of the 4 scenarios occurs. When a win or loss is detected, we stop drawing cards, reset our counters and loop through another game.

In [4]:
for n in range(10000): heart_count = 0 spade_count = 0 diamond_count = 0 club_count = 0 np.random.shuffle(cards) for card in cards: if card[1] == 'H': heart_count += 1 if heart_count >= 5: win_heart += 1 break elif card[1] == 'S': spade_count += 1 if spade_count >= 4: win_spade += 1 break elif card[1] == 'D': diamond_count += 1 if diamond_count >= 3: win_diamond += 1 break else: club_count += 1 if club_count >= 3: lose += 1 break

Lastly, we print out our results.

In [5]:
print(win_heart/10000, win_spade/10000, win_diamond/10000, lose/10000)
0.0617 0.1553 0.3894 0.3936

Our simulation suggests that we win the big prize about 5.8% of the time, the medium prize about 15.7% of the time, the small prize about 39.3% of the time, and we lose about 39.1% of the time. This is just a simulation, since scenarios 3 and 4 are identical, we should expect that those probabilities are equal. This also supports the idea that the odds of winning any prize are better than 50%. In fact, our computations suggest that the odds of winning at all about about 61%.