had started a href="http://www.rosettacode.org/wiki/Monty_Hall_simulation">new
topic on Rosetta Code on the Monty Hall problem, using an
example I had laying around that I had written in Python to simulate
the effects of different player strategies. The game goes like this:
contestant in in front of three doors that he cannot see
- The three doors conceal one
prize and the rest being booby prizes, arranged randomly.
Host asks the contestant to choose a door.
- The host
then goes behind the doors where only he can see what is concealed,
door, out of the other s not chosen by the contestant, that
must reveal a booby prize to the contestant.
host then asks the contestant if he would like either to stick with his
previous choice, or switch and choose the other remaining closed door.
turns out that if the contestant follows a strategy of always switching
when asked, then he will maximise his chances of winning..
then re-wrote the simulator in AWK (gawk), so there are now
at least two implementations of the simulator on Rosetta Code.,
simulator results show that:
- A strategy of
never switching wins 1/3rd of the time.
- A strategy
of randomly switching wins 1/2 of the time.
strategy of always switching wins 2/3rds of the time.