Mainly Tech projects on Python and Electronic Design Automation.

Sunday, August 10, 2008

Monty Hall Problem Simulations

I
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:
  • The
    contestant in in front of three  doors that he cannot see
    behind.. 
  • The three doors conceal one
    prize and the rest being booby prizes, arranged randomly.
  • The
    Host asks the contestant to choose a door.
  • The host
    then goes behind the doors where only he can see what is concealed,
    then always
    opens one
    door, out of the other s not chosen  by the contestant, that
    must reveal a booby prize to the contestant.
  • The
    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.
It
turns out that if the contestant follows a strategy of always switching
when asked, then he will maximise his chances of winning..

I
then re-wrote the simulator in AWK  (gawk), so there are now
at least two implementations of the simulator on Rosetta Code.,

The
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.
  • A
    strategy of always switching wins 2/3rds of the time.
style="margin-left: 40px;">

1 comment:

  1. I posted my R-project code to Rosetta Stone as well, as well as at my blog http://writeonly.wordpress.com/2008/09/13/monty-hall-in-r/. Thanks for the challenge!

    ReplyDelete

About Me

Followers

Subscribe Now: google

Add to Google Reader or Homepage

Go deh too!

whos.amung.us

Blog Archive