Monty Hall problem: Difference between revisions
Content added Content deleted
(Added a solution in Ruby) |
|||
Line 1,027:
#random guess
#random door shown, but it is neither the guess nor the car
begin shown = rand(3) end while shown == guess || doors[shown] == :car
#staying with the initial guess wins if the initial guess is the car
Line 1,040:
end
Sample Output:
<pre>Staying wins 33.84% of the time.
|