This is the talk page for discussing changes to the Monty Hall problem article itself. Please place discussions on the underlying mathematical issues on the Arguments page. If you just have a question, try Wikipedia:Reference desk/Mathematics instead. |
Monty Hall problem is a former featured article. Please see the links under Article milestones below for its original nomination page (for older articles, check the nomination archive) and why it was removed. | |||||||||||||||||||||||||
This article appeared on Wikipedia's Main Page as Today's featured article on July 23, 2005. | |||||||||||||||||||||||||
|
This level-5 vital article is rated B-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||||||||||||||||||
|
This article is written in American English, which has its own spelling conventions (color, defense, traveled) and some terms that are used in it may be different or absent from other varieties of English. According to the relevant style guide, this should not be changed without broad consensus. |
|
This page has archives. Sections older than 30 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
50/50
editAddition to the 'Solutions by simulation' section?
editCan I propose an addition to the 'Solutions by simulation' section - a simplified Python script to give the following result (approximately)
Overall success rate given a stick or switch strategy win_rate(monty_knows=True, will_switch=True, give_overall_result=True) = 0.6641 win_rate(monty_knows=True, will_switch=False, give_overall_result=True) = 0.3349 win_rate(monty_knows=False, will_switch=True, give_overall_result=True) = 0.3359 win_rate(monty_knows=False, will_switch=False, give_overall_result=True) = 0.3254 Success rate at the point where the contestant has a choice to stick/switch win_rate(monty_knows=True, will_switch=True, give_overall_result=False) = 0.6685 win_rate(monty_knows=True, will_switch=False, give_overall_result=False) = 0.3337 win_rate(monty_knows=False, will_switch=True, give_overall_result=False) = 0.5004 win_rate(monty_knows=False, will_switch=False, give_overall_result=False) = 0.5002
The Python code is as close to pseudo code as I could make it.
""" Monty Hall probability calculator. """ import random # Random number generator module def random_door(except_doors): """ Return a random door number which in not in the list given. """ while True: n_doors = 3 door = random.randrange(1, n_doors + 1) # Return 1, 2 or 3 if door not in except_doors: return door def win_rate( monty_knows: bool, will_switch: bool, give_overall_result: bool) -> float: """ monty_knows: True if Monty knows which door has the prize, False otherwise. will_switch: True if, given a choice, the contestant will switch doors. give_overall_result: True if we want the probability of winning with a given strategy False to give the probability of winning from the point when a stick or switch choice is made. Returns: Probability of contestant winning given the test criteria above. """ # Note: Doors are numbered 1, 2, 3... runs = 0 # The number of valid games wins = 0 # The number of times the contestant has won so far while runs < 10000: runs = runs + 1 # Increment the run count (may get decremented later) prize_door = random_door(except_doors=[]) # Door with the prize choose_door = random_door(except_doors=[]) # Door chosen by the contestant if monty_knows: # Monty knows which door has the prize. # He chooses to open the door without a prize second_door = random_door(except_doors=[choose_door, prize_door]) # The contestant must choose to switch or stick if will_switch: choose_door = random_door(except_doors=[choose_door, second_door]) else: # Monty does not know which door has the prize # He chooses one of the other doors to open second_door = random_door(except_doors=[choose_door]) if second_door == prize_door: # Monty has opened the second door and revealed the prize, so # the contestant loses. if not give_overall_result: # We want to give the probability of winning from the point # of being given a choice, so we discard this scenario from # the results. runs = runs - 1 else: # The second door does not have the prize. # The contestant must choose to switch or stick if will_switch: choose_door = random_door(except_doors=[choose_door, second_door]) # Has the contestant won? if choose_door == prize_door: wins = wins + 1 return wins / runs if __name__ == '__main__': print("Overall success rate given a stick or switch strategy") print(f"{win_rate(monty_knows=True, will_switch=True, give_overall_result=True) = }") print(f"{win_rate(monty_knows=True, will_switch=False, give_overall_result=True) = }") print(f"{win_rate(monty_knows=False, will_switch=True, give_overall_result=True) = }") print(f"{win_rate(monty_knows=False, will_switch=False, give_overall_result=True) = }") print("Success rate at the point where the contestant has a choice to stick/switch") print(f"{win_rate(monty_knows=True, will_switch=True, give_overall_result=False) = }") print(f"{win_rate(monty_knows=True, will_switch=False, give_overall_result=False) = }") print(f"{win_rate(monty_knows=False, will_switch=True, give_overall_result=False) = }") print(f"{win_rate(monty_knows=False, will_switch=False, give_overall_result=False) = }")
92.239.201.60 (talk) 09:02, 7 June 2024 (UTC)
- This article, like most articles, is better off without code samples, which are meaningless to many readers. The procedure for simulating with cards is sufficient to make the point and can be understood and implemented by anyone. MrOllie (talk) 13:07, 7 June 2024 (UTC)
Ignorant Monty / Monty Fall - current explanation is incomplete
editThe table currently describes "Ignorant Monty" solution as "switching wins 50%". However, in this variant, switching and staying are indifferent (when a goat has been revealed by chance by Ignorant Monty) and both in fact win 50%. Suggest that table be updated to state that "switching or staying both win 50%". This is given already in the citation for that Variant, if you read the second page of https://en.wikipedia.org/wiki/Monty_Hall_problem#CITEREFRosenthal2005a 2600:8801:17E2:0:30D0:6149:CBE5:D00B (talk) 17:15, 19 November 2024 (UTC)
The completely unnecessary long-winded discussion mainly confuses readers
editThis article is much more confusing than enlightening.
Instead of straighforwardly explaining the problem and its correct solution, it goes into all manner of alternative theories.
Furthermore, the illustrated explanation contains statements "Probability = 1/6", "Probability = 1/3", "Probability = 1/3", "Probability = 1/6",
without ever stating what these numbers are the probabilities of.
That is very unclear writing.
I hope someone familiar with this subject will fix this.