From: rhca80@melton.sps.mot.com (Henry Melton)
Subject: Re: Shell Game (Dixie cups work too)
Organization: /etc/organization
Date: Mon, 14 Dec 1992 22:50:09 GMT

In article <Mf_daCm00WBN43v2El@andrew.cmu.edu> "Stephen M. Lacy" <sl31+@andrew.cmu.edu> writes:
>Excerpts from netnews.alt.folklore.science: 11-Dec-92 Shell Game (Dixie
>cups work.. by checkett@dbsun.uucp 
>> Here's the questions:
>> Should the player switch to the other cup or stay pat?
>> What are the odds?
>
>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.  
>
>Steve

main()
{
	int winning_door;
	int first_guess;

	int swap_win = 0;
	int stay_win = 0;

	float	swap;
	float	stay;

	while(1)
	{
		/* Monty Hall shows 3 doors, one of which is the winner */
		winning_door = (rand() % 3 ) + 1;

		/* The contestant guesses a door */
		first_guess = (rand() % 3 ) + 1;

		/* Monty Hall shows one of the bad doors and allows
			offers the chance to swap */


		if (winning_door == first_guess)
			stay_win++;
		else
			swap_win++;

		stay = (100.0 * stay_win) / ( stay_win + swap_win);
		swap = (100.0 * swap_win) / ( stay_win + swap_win);

		printf ("%d %d -- Swap wins %7.4f    Stay wins %7.4f\n",
			winning_door,
			first_guess,
			swap,
			stay);
	}
}
		
3 2 -- Swap wins 100.0000    Stay wins  0.0000
1 2 -- Swap wins 100.0000    Stay wins  0.0000
2 3 -- Swap wins 100.0000    Stay wins  0.0000
1 1 -- Swap wins 75.0000    Stay wins 25.0000
1 1 -- Swap wins 60.0000    Stay wins 40.0000
2 3 -- Swap wins 66.6667    Stay wins 33.3333
1 1 -- Swap wins 57.1429    Stay wins 42.8571
3 3 -- Swap wins 50.0000    Stay wins 50.0000
1 1 -- Swap wins 44.4444    Stay wins 55.5556
1 1 -- Swap wins 40.0000    Stay wins 60.0000
3 2 -- Swap wins 45.4545    Stay wins 54.5455
3 1 -- Swap wins 50.0000    Stay wins 50.0000
1 1 -- Swap wins 46.1538    Stay wins 53.8462
1 3 -- Swap wins 50.0000    Stay wins 50.0000
2 3 -- Swap wins 53.3333    Stay wins 46.6667
3 3 -- Swap wins 50.0000    Stay wins 50.0000
3 2 -- Swap wins 52.9412    Stay wins 47.0588
3 3 -- Swap wins 50.0000    Stay wins 50.0000
2 2 -- Swap wins 47.3684    Stay wins 52.6316
1 1 -- Swap wins 45.0000    Stay wins 55.0000
3 3 -- Swap wins 42.8571    Stay wins 57.1429
1 1 -- Swap wins 40.9091    Stay wins 59.0909
2 3 -- Swap wins 43.4783    Stay wins 56.5217
1 3 -- Swap wins 45.8333    Stay wins 54.1667
3 1 -- Swap wins 48.0000    Stay wins 52.0000
1 3 -- Swap wins 50.0000    Stay wins 50.0000
2 3 -- Swap wins 51.8519    Stay wins 48.1481
1 2 -- Swap wins 53.5714    Stay wins 46.4286
1 2 -- Swap wins 55.1724    Stay wins 44.8276
3 2 -- Swap wins 56.6667    Stay wins 43.3333
2 2 -- Swap wins 54.8387    Stay wins 45.1613
2 1 -- Swap wins 56.2500    Stay wins 43.7500
2 1 -- Swap wins 57.5758    Stay wins 42.4242
1 3 -- Swap wins 58.8235    Stay wins 41.1765
3 2 -- Swap wins 60.0000    Stay wins 40.0000
2 2 -- Swap wins 58.3333    Stay wins 41.6667
3 1 -- Swap wins 59.4595    Stay wins 40.5405
2 1 -- Swap wins 60.5263    Stay wins 39.4737
2 2 -- Swap wins 58.9744    Stay wins 41.0256
2 1 -- Swap wins 60.0000    Stay wins 40.0000
3 1 -- Swap wins 60.9756    Stay wins 39.0244
2 1 -- Swap wins 61.9048    Stay wins 38.0952
2 2 -- Swap wins 60.4651    Stay wins 39.5349
2 2 -- Swap wins 59.0909    Stay wins 40.9091
1 3 -- Swap wins 60.0000    Stay wins 40.0000
3 3 -- Swap wins 58.6957    Stay wins 41.3043
1 1 -- Swap wins 57.4468    Stay wins 42.5532
2 2 -- Swap wins 56.2500    Stay wins 43.7500
3 1 -- Swap wins 57.1429    Stay wins 42.8571
3 2 -- Swap wins 58.0000    Stay wins 42.0000
1 1 -- Swap wins 56.8627    Stay wins 43.1373
1 1 -- Swap wins 55.7692    Stay wins 44.2308
1 3 -- Swap wins 56.6038    Stay wins 43.3962
3 3 -- Swap wins 55.5556    Stay wins 44.4444
3 2 -- Swap wins 56.3636    Stay wins 43.6364
2 1 -- Swap wins 57.1429    Stay wins 42.8571
3 2 -- Swap wins 57.8947    Stay wins 42.1053
1 2 -- Swap wins 58.6207    Stay wins 41.3793
2 2 -- Swap wins 57.6271    Stay wins 42.3729
2 1 -- Swap wins 58.3333    Stay wins 41.6667
3 3 -- Swap wins 57.3770    Stay wins 42.6230
3 1 -- Swap wins 58.0645    Stay wins 41.9355
3 1 -- Swap wins 58.7302    Stay wins 41.2698
2 3 -- Swap wins 59.3750    Stay wins 40.6250
1 2 -- Swap wins 60.0000    Stay wins 40.0000
2 3 -- Swap wins 60.6061    Stay wins 39.3939
2 3 -- Swap wins 61.1940    Stay wins 38.8060
1 3 -- Swap wins 61.7647    Stay wins 38.2353
3 2 -- Swap wins 62.3188    Stay wins 37.6812
1 3 -- Swap wins 62.8571    Stay wins 37.1429
2 2 -- Swap wins 61.9718    Stay wins 38.0282
3 1 -- Swap wins 62.5000    Stay wins 37.5000
2 2 -- Swap wins 61.6438    Stay wins 38.3562
1 3 -- Swap wins 62.1622    Stay wins 37.8378
2 3 -- Swap wins 62.6667    Stay wins 37.3333
1 3 -- Swap wins 63.1579    Stay wins 36.8421
1 2 -- Swap wins 63.6364    Stay wins 36.3636
3 2 -- Swap wins 64.1026    Stay wins 35.8974
2 1 -- Swap wins 64.5570    Stay wins 35.4430
3 2 -- Swap wins 65.0000    Stay wins 35.0000
3 1 -- Swap wins 65.4321    Stay wins 34.5679
1 2 -- Swap wins 65.8537    Stay wins 34.1463
2 2 -- Swap wins 65.0602    Stay wins 34.9398
3 2 -- Swap wins 65.4762    Stay wins 34.5238
3 2 -- Swap wins 65.8824    Stay wins 34.1176
1 1 -- Swap wins 65.1163    Stay wins 34.8837
2 3 -- Swap wins 65.5172    Stay wins 34.4828
2 2 -- Swap wins 64.7727    Stay wins 35.2273
3 2 -- Swap wins 65.1685    Stay wins 34.8315
3 3 -- Swap wins 64.4444    Stay wins 35.5556
3 3 -- Swap wins 63.7363    Stay wins 36.2637
1 1 -- Swap wins 63.0435    Stay wins 36.9565
3 3 -- Swap wins 62.3656    Stay wins 37.6344
2 3 -- Swap wins 62.7660    Stay wins 37.2340
3 1 -- Swap wins 63.1579    Stay wins 36.8421
1 2 -- Swap wins 63.5417    Stay wins 36.4583
2 2 -- Swap wins 62.8866    Stay wins 37.1134
2 1 -- Swap wins 63.2653    Stay wins 36.7347
3 1 -- Swap wins 63.6364    Stay wins 36.3636
3 2 -- Swap wins 64.0000    Stay wins 36.0000
Newsgroups: alt.folklore.science