[net.math] Monty Hall simulation by kobold.UUCP

leo@ihuxl.UUCP (10/11/83)

The problem with the simulation is that Monty Hall NEVER EVER shows you the
door with the good prize.  The simulation presented assumes that he
might randomly pick the good door.  He knows which is the good door,
and he only picks randomly if you picked the good door. He has no choice
if you picked a loser; he must pick the other loser.

I did a quick and dirty modification to the program to take this
into account, and below is the result.
===============================================================================
int wins;	/* number of times I win by switching doors */
int losses;	/* number of times I lose after switching */
int monty;	/* number of times Monty shows me the good door */
int doors[3];	/* count how often each doors is a winner */
		/* to verify the random number generator */

main()
{
	register int i, door, mydoor, montysdoor;
	for (i = 0; i < 10000; i++) {
		/* pick a winning door at random */
		door = rand() % 3;
		doors[door]++;
		/* I pick a door at random */
		mydoor = rand() % 3;
		/* Monty picks a door, but not mine! */
		while (((montysdoor = rand() % 3) == mydoor)
			|| (montysdoor == door));
		if (mydoor != door)
			wins++;	/* I win by switching */
		else
			losses++;/* I feel like a sap! */
	}
	printf("monty %d wins %d losses %d\n", monty, wins, losses);
	printf("door #1 %d #2 %d #3 %d\n", doors[0], doors[1], doors[2]);
}
===============================================================================
monty 0 wins 6598 losses 3402
door #1 3275 #2 3382 #3 3343

As anyone can see, if Monty never picks the right door, the odds change
drastically from the original simulation.

					Leo R.
					ihnp4!ihuxl!leo

stephen@alberta (10/15/83)

The obvious conclusio from all these benchmarks is that If monty
always choses an empty door, then switching increases your chances
by a factor of 2-1.  If he picks randomly, then your chances are
the same with either door.

  conclusion: YOU CAN'T LOOSE by switching. 

"I'd rather switch than fight"

	Stephen Samuel
	  (alberta!stephen)