From: kstock@isfrance.encore.fr (Kevin Stock)
Newsgroups: alt.folklore.science
Subject: Re: Monty Hall / Shell Game / Dixie Cups
Date: 15 Dec 1992 10:21:24 -0600
Organization: UTexas Mail-to-News Gateway
NNTP-Posting-Host: cs.utexas.edu

checkett@dbsun.uucp asks:
>
> Here's the questions:
> Should the player switch to the other cup or stay pat?
> What are the odds?

Stephen M. Lacy" <sl31+@andrew.cmu.edu> replies:
>
> HAVE YOU NOT HEARD OF THIS PROBLEM BEFORE!  Gawd, there was an entire
> multi-million television game show based exactly on this proposiiton!
> (The Monty Hall show, if you couldn't remember)  The correct answer (I
> believe) is that you definately want to switch no matter what.  The odds
> are in your favor to some non-significant amount.  I think its something
> like 66% win if you switch, but I forget the numbers.  

Henry Melton offers the following source code (line numbers added):
>
>  1    main()
>  2    {
>  3        int winning_door;
>  4        int first_guess;
>  5    
>  6        int swap_win = 0;
>  7        int stay_win = 0;
>  8    
>  9        float    swap;
> 10        float    stay;
> 11    
> 12        while(1)
> 13        {
> 14            /* Monty Hall shows 3 doors, one of which is the winner */
> 15            winning_door = (rand() % 3 ) + 1;
> 16    
> 17            /* The contestant guesses a door */
> 18            first_guess = (rand() % 3 ) + 1;
> 19    
> 20            /* Monty Hall shows one of the bad doors and allows
> 21                offers the chance to swap */
> 22    
> 23    
> 24            if (winning_door == first_guess)
> 25                stay_win++;
> 26            else
> 27                swap_win++;
> 28    
> 29            stay = (100.0 * stay_win) / ( stay_win + swap_win);
> 30            swap = (100.0 * swap_win) / ( stay_win + swap_win);
> 31    
> 32            printf ("%d %d -- Swap wins %7.4f    Stay wins %7.4f\n",
> 33                winning_door,
> 34                first_guess,
> 35                swap,
> 36                stay);
> 37        }
> 38    }
>
> [Output from a run of the program, showing 2/3 in favour of changing.]

Unfortunately, the program doesn't measure what it claims. Lines 24-27
just test to see whether the player chose the right door originally.
As he has one chance in three of doing so, it's not surprising that the
output shows odds od 2/3. It doesn't take into account the fact that
the problem has been reduced to two doors, of which one hides the car,
and the other hides a goat. (Monty Hall case; I leave it to the reader
to apply it to the Dixie cups.)

Since there are only three doors, we can enumerate the possibilities.

There are three doors, one of which hides a car, the other two hide
goats.  So, there are three possibilities:

	1	car	goat	goat
	2	goat	car	goat
	3	goat	goat	car

The player chooses one of the doors. We now have 9 possibilities
(** = selected by player)

	1.1	*car*	goat	goat
	1.2	car	*goat*	goat
	1.3	car	goat	*goat*
	2.1	*goat*	car	goat
	2.2	goat	*car*	goat
	2.3	goat	car	*goat*
	3.1	*goat*	goat	car
	3.2	goat	*goat*	car
	3.3	goat	goat	*car*

Monty Hall now opens one of the doors which was not selected, revealing
a goat. If the player has selected the car at his first attempt, MH can
open either of the remaining doors. Otherwise, he has to open the door
hiding the other goat. Now we have 12 possibilities (open door
removed).

	1.1.1	*car*	goat			STAY
	1.1.2	*car*		goat		STAY
	1.2	car	*goat*				CHANGE
	1.3	car		*goat*			CHANGE
	2.1	*goat*	car				CHANGE
	2.2.1		*car*	goat		STAY
	2.2.2	goat	*car*			STAY
	2.3		car	*goat*			CHANGE
	3.1	*goat*		car			CHANGE
	3.2		*goat*	car			CHANGE
	3.3.1		goat	*car*		STAY
	3.3.2	goat		*car*		STAY

In six cases, the player should change, in six he should stay where
he it.

I leave it as an exercise to the reader to rewrite the program
correctly.  (Yes, I _have_ done it, but the actual results output
depend dramatically on the random number generator. Depending on the
RNG algorithm, I've seen ratios such as 82% stay.) HINT: decide which
door MH opens, and hence which the player could change to, and count
the number of cases where it is the winning door.

	Kevin Stock
	kstock@encore.fr
Newsgroups: alt.folklore.science