- #1
SixNein
Gold Member
- 122
- 20
Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?
The solution is said to be yes, because you have 1/3 probability to stay and 2/3 probability to switch.
The answer to this problem has annoyed me to an extent. Why is the host completely ignored as a variable to calculate the probability? I think there is an error in this solution due to the fact that the host and his actions are completely ignored.
Example:
' does not switch
For c = 1 To 10000
car = Rand(0, 2)
If car = 0 Then
x = x + 1
End If
Next c
'always switches
For c = 1 To 10000
car = Rand(0, 2)
If car = 2 Then
y = y + 1
ElseIf car = 1 Then
y = y + 1
End If
Next c
This algorithm will create the same result, 1/3 does not switch, 2/3's switch.
Now if I introduce the host as a variable:
For c = 1 To 10000
car = Rand(0, 2)
If car Xor 1 = 0 Then
host = 2
ElseIf car Xor 2 = 0 Then
host = 1
End If
If host = 1 Then
If car = 0 Then
n = n + 1
End If
ElseIf host = 2 Then
If car = 0 Then
n = n + 1
End If
End If
Next c
'my version - switch is always made
For c = 1 To 10000
car = Rand(0, 2)
' host must decide which door to open based on the location of car. Since he always opens a losing door...
If car Xor 1 = 0 Then 'if car is in door 1
host = 2 'host will open door 2
ElseIf car Xor 2 = 0 Then
host = 1
End If
If host = 1 Then ' if host opens door 1
If car = 2 Then 'switch is made to door 2, is there a car?
z = z + 1 ' win
End If
ElseIf host = 2 Then
If car = 1 Then
z = z + 1
End If
End If
Next c
With this algorithm, the probability changes to 1/3 and 1/3 and shows that you have equal chance to win, if you do or do not switch doors.