Settings

Theme

My take on the Monty Hall problem

1 points by nikola_virtual 2 years ago · 3 comments · 2 min read


When I first encountered the Monty Hall problem, my initial reaction was to understand the host's strategy and motivation. However, I noticed that this aspect is often overlooked in discussions, with most people focusing solely on the mathematical probabilities.

To delve deeper into the problem, I decided to write a code implementation that reflects my perspective. By simulating the scenario, I aimed to gain a clearer understanding of the host's role and its impact on the outcome.

Here's the code I developed to explore this perspective:

```

import random

def monty_hall_simulation():

    doors = [0, 0, 1]  # 0 represents a goat, 1 represents a car

    random.shuffle(doors)  # Shuffle the doors randomly

    # Player makes the initial choice

    initial_choice = random.randint(0, 2)

    # Host reveals a door when the guest is right

    if doors[initial_choice] == 1:

        revealed_door = next(i for i in range(3) if i != initial_choice and doors[i] == 0)

        final_choice_switch = next(i for i in range(3) if i != initial_choice and i != revealed_door)

    else:

        # The host does not give the guest a chance to switch

        final_choice_switch = initial_choice

    return doors[final_choice_switch] == 1, doors[initial_choice] == 1
num_trials = 1000

switch_win_count = 0

stick_win_count = 0

for _ in range(num_trials):

    switch_win, stick_win = monty_hall_simulation()

    if switch_win:
        switch_win_count += 1

    if stick_win:
        stick_win_count += 1
print(f"Switching wins: {switch_win_count}")

print(f"Sticking wins: {stick_win_count}")

```

In my implementation, the host understands the math and only opens another door with a goat when the guest is right. As the audience decodes the host's strategy and uses it to their advantage, the host adapts and changes their strategy. Eventually, the probability becomes just random.

Previous HN discussion: https://hn.algolia.com/?q=Monty+Hall+problem

nikola_virtualOP 2 years ago

This approach highlights the human element in the Monty Hall problem and emphasizes the importance of considering the psychological aspects alongside the mathematical analysis.

dave4420 2 years ago

Are you saying that the host wants the contestant to lose? This does not seem to be how game show hosts behave in reality.

  • nikola_virtualOP 2 years ago

    That's a possible point!

    In the context of the final game, where there is no shadow of the future, it's possible to speculate that if the host is personally invested in the economic return of the show, their motivations might align with wanting the contestant to lose.

    Additionally, in some TV shows and certain regions of the world, hosts have aimed to confuse the audience and maintain control over the show for their own advantages.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection