[Jprogramming] The Monty Hall Problem

Oleg Kobchenko olegykj at yahoo.com
Sun Sep 3 11:25:53 HKT 2006


Initially, I fell into the same trap as others
reasoning that if gamemaster always shows a goat
and a goat is always available for him, then the
third door could be eliminated, giving chance of 0.5.
Then I made and ran a simulation (without looking),
and when it gave 0.33/0.66 I thought I had bug.
Then I compared it with Roger's solution and was surprised.

The adujsted reasoning is by simple probability
operations:
  1st choice :   1/3 car;        2/3 goat
  keep/switch: 0 car;1 goat;   1 car; 0 goat

So probability for car:
  keep  : 1/3 (just 1st choice)
  switch: 1/3 * 0 + 2/3 * 1 = 2/3

This is similar to "The Curious Incident of the Dog ..."
in the wiki.


--- Roger Hui <rhui000 at shaw.ca> wrote:

> I did not intend that a simulation be the only or
> the main means of determining the answer.  The
> task is to write the simulation because it is an 
> interesting exercise in itself.
> 
> There are several (unstated) requirements:
> 
> - The logic has to be clear and convincing.
> - It has to be efficient enough to run in seconds
> for a large number of iterations.  I had read in 
> Vector 21.1 Devon McCormick's article that an 
> APL program ran overnight on a 20 Mhz 286 for
> 5e5 simulations, and I thought, "should be faster
> than this."
> - It should avoid looping and illustrate use of
> arrays.
> 
> See
> http://www.jsoftware.com/jwiki/Essays/The_Monty_Hall_Problem
> 
> 
> 
> 
> ----- Original Message -----
> From: John Randall <randall at andromeda.rutgers.edu>
> Date: Saturday, September 2, 2006 3:30 pm
> Subject: Re: [Jprogramming] The Monty Hall Problem
>  
> > Perhaps rather than doing a simulation, it suffices to list 18
> > equiprobable outcomes, assuming that Monty Hall selects a goat door
> > with equal probability when he has a choice.
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Programming mailing list