sheep door

1. Answer according to your first feeling, do you think that you have a higher chance of getting a car if you don’t change the choice, or do you think that you can get a car with a choice? Or the odds haven't changed?

 

Answer: The first impression is that changing the choice will have a higher chance of getting a car. The host's behavior may indirectly be equivalent to eliminating the wrong choice or directly announcing the end of the game, so the probability has changed.

 

2. Please carefully analyze "Is there a higher chance of getting a car if I don't change the choice, or is there a higher chance of getting a car if I change the choice? Or the probability has not changed? " Write down your analysis ideas and results.

 

Answer: The analysis is as follows: If there is no host to open a door, the chance of the contestants guessing the car is 1/3. When the host chooses to open a door, there are two situations:

a. There is a sheep behind the door opened by the host. At this time, after eliminating a wrong option, the winning rate of the contestant is 1/2, which is higher than before, and the rest is up to the contestant to play.

       b. There is a car behind the door opened by the host, so there is no need for the contestants to change. But at the same time, it proves that the player did not choose the right one from the beginning, so it has no effect on the result.

       At this time, you can follow the situation of b and look at the situation a: (1) If the contestant chooses a car at the beginning, the host has only sheep to choose. The contestant will naturally know that he has selected a car, so he will Choose not to change, but the moderator still influences the results. (2) If the contestant did not choose a car at the beginning, the host will open the door with the car behind in order to avoid losses, so that the contestant will understand that there is no difference between changing his result or not, the result has not changed, but the host has influenced Player's choice.

       In summary, the results have nothing to do with the choice of the host, only the choice of the players for the first time.

      ( Ps: If in reality, the host will consider his own work related to the program ratings and the meaning of the existence of the program, so even if there is a player who did not choose a car for the first time, the host may still choose to exclude him. Behind the other door is the wrong choice of the sheep. At this time, the probability of the contestant will still change from 1/3 to 1/2, showing an increase. Of course, this is just a random selection of the host, and the winner depends on yourself and the host The psychological game between people or the mood of the host.)

 

3. Please try to write a program to verify your ideas. The verification results support your analysis results, or do not support your analysis results. Please write the program running results and whether they support your analysis. (Hint: This procedure can be done with the help of the random number function)

        The running result is: 1/2. does not support my analysis.

 

4. Please attach your code. (Hint: Use the Insert Code feature in the editor to display the code in Python style)

#The code assumes that the host will randomly open the door behind the car
import random
i=0
x=0
y=1000
for z in range (y):
    a=random.uniform(0,3)
    if a>=2: #At this time, it means that the player selected the car for the first time
        a=a+0.5#The host can only exclude the door of the sheep
        if a>=3: #The player does not change the choice
            i=i+1
            x=x+1
        else:
            i=i+0
            x=x+1
    elif a<2: #At this time, it means that the player selected the sheep for the first time
        a=a+1 #The moderator's operation has a 1/2 chance of helping the contestant to eliminate the wrong answer
             #Players still don't know if they're right
        if a>2: #The player chooses after the host's operation
            i=i+1 #Indicates that the player has selected a car
            x=x+1
        else:
            i=i+0
            x=x+1 #The player chose the wrong one
print ("i={}".format(i))
print ("x={}".format(x))
result=i/x
print ("The probability of a player selecting a car is: {:.2f}.".format(result))

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325035133&siteId=291194637