Go Back   Flash Flash Revolution > General Discussion > Chit Chat
Register FAQ Community Calendar Today's Posts Search

Closed Thread
 
Thread Tools Display Modes
Old 01-10-2004, 03:52 PM   #41
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,431
Send a message via AIM to aperson
Default

Here's the proof.

Code:
#include <iostream.h>
#include <stdlib.h>
#include <time.h>

/*This program is to prove the infamous door riddle,
Yes, the chances are 66% that switching will make you win.

Written by Tyler Mitchell (aperson / maphive) Jan 10, 2003*/


//For simplicity, door 1 will always be the original choice.
//Every game will be switched, the projected outcome should be 66% win, 33% loss (approx)

int main()
{
	int seed;														//Number to be rolled as a seed for choosing box
	int runs;														//How many times you want to be proven wrong
	srand(time(NULL));												//Seeds the rand to time to randomly choose a door.
	bool door1, door2, door3;										//Flags for the three doors, bool is a yes or no operand
	int choice;
	int removed;
	int wins = 0, losses = 0;
	
	cout << "Tyler Mitchell (aperson / Maphive's) 'The Door' program (c)2003\n\n";
	cout << "Every run switches doors\n ...A projected 66% wins to 33% losses should be observed\n";
	cout << "For best results try numbers over 1,000\n\n\n";
	cout << "How many runs would you like to play (larger number = more accuracy): ";
	cin >> runs;

	for(int i = 0; i < runs; i++)									//Loop until 'runs' runs have been done
	{
		door1 = false, door2 = false, door3 = false;				//Reset values each run
		seed = rand() % 3;											//Roll a random seed to choose which door is a winner
		switch(seed)												//Assign value from seed to the lucky door.
		{															//This does NOT make all doors true, only one.
		case 0:														//Number discrepancies come from the modulus (%) command
			door1 = true;
			break;
		case 1:
			door2 = true;
			break;
		case 2:
			door3 = true;
			break;
		default:
			cout << "Sanity check failed, door seed error!\n";
			return 0;
			break;
		}

		if(rand()%2 == 0)											//More randomization for further proof
		{
			if(door2 == false)
				removed = 2;
			else
				removed = 3;
		}
		else
		{
			if(door3 == false)
				removed = 3;
			else
				removed = 2;
		}

		if(removed == 3)											//Switch to the door that wasn't removed
			choice = 2;
		if(removed == 2)
			choice = 3;

		if((choice == 2 && door2 == true) || (choice == 3 && door3 == true)) //If the choice made is the correct door
			wins++;													//Increment wins by one
		else														//If the choice made is the incorrect door
			losses++;												//Increment losses by one
	}
	system("CLS");
	cout << "After executing " << runs << " runs the following was observed:\n";
	cout << "Wins: " << wins << " or " << double(wins)/runs*100 << "%\n";
	cout << "Losses: " << losses << " or " <<  double(losses)/runs*100 << "%\n";
	
	return 0;
}
Sample runs:

After executing 1000 runs the following was observed:
Wins: 666 or 66.6%
Losses: 334 or 33.4%

After executing 10000 runs the following was observed:
Wins: 6697 or 66.97%
Losses: 3303 or 33.03%

After executing 100000 runs the following was observed:
Wins: 66685 or 66.685%
Losses: 33315 or 33.315%

After executing 1000000 runs the following was observed:
Wins: 666185 or 66.6185%
Losses: 333815 or 33.3815%

After executing 1337 runs the following was observed:
Wins: 883 or 66.0434%
Losses: 454 or 33.9566%



In conclusion, I win.
__________________

aperson is offline  
Old 01-10-2004, 08:33 PM   #42
VxDx
FFR Player
 
VxDx's Avatar
 
Join Date: May 2003
Posts: 1,871
Send a message via AIM to VxDx
Default

I'm really lazy, but your algorithm must be flawed because you are wrong. That or you explained the problem wrong. Quite probably the latter.

It's this simple. There are 3 door. You pick one, and one incorrect one is eliminated. These events are NOT RELATED IN YOUR PROBLEM. there is no relevance in your problem as to which door is chosen to be eliminated, and it really doesn't matter. All that matters is that after an inherantly incorrect door is removed there are two possibilities. Either you chose correctly or incorrectly. The chances are 50-50 that you will win, so which door you pick doesn't matter.

Your logic is flawed nevertheless. If you choose correctly there are two doors that can be opened, if you choose incorrectly, only one. I'll list all the equally likely possibilities in prize, choice, door opened - win if you stay format
112 y
113 y
123 n
132 n
213 n
221 y
223 y
231 n
312 n
321 n
331 y
332 y

that gives even chances of winning at 6/12 or 50-50
VxDx is offline  
Old 01-10-2004, 08:37 PM   #43
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 35
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default

I believe it is a 50-50 percent chance.

Like the lottery thing- 10 million tickets are bought. Assume each person gets one. All the sudden, we know that 9,999,998 people dont have the winning ticket. You are not one of these people. You could win.

Its a 50-50 chance.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline  
Old 01-10-2004, 08:42 PM   #44
VxDx
FFR Player
 
VxDx's Avatar
 
Join Date: May 2003
Posts: 1,871
Send a message via AIM to VxDx
Default

the lottery doesn't work like that because there is no assurance that there is any winner at all.
VxDx is offline  
Old 01-10-2004, 08:44 PM   #45
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,431
Send a message via AIM to aperson
Default

Quote:
Originally Posted by VxDx
I'm really lazy, but your algorithm must be flawed because you are wrong. That or you explained the problem wrong. Quite probably the latter.

It's this simple. There are 3 door. You pick one, and one incorrect one is eliminated. These events are NOT RELATED IN YOUR PROBLEM. there is no relevance in your problem as to which door is chosen to be eliminated, and it really doesn't matter. All that matters is that after an inherantly incorrect door is removed there are two possibilities. Either you chose correctly or incorrectly. The chances are 50-50 that you will win, so which door you pick doesn't matter.

Your logic is flawed nevertheless. If you choose correctly there are two doors that can be opened, if you choose incorrectly, only one. I'll list all the equally likely possibilities in prize, choice, door opened - win if you stay format
112 y
113 y
123 n
132 n
213 n
221 y
223 y
231 n
312 n
321 n
331 y
332 y

that gives even chances of winning at 6/12 or 50-50
Wrong, look at the post I have with the exhaustive proof. See the split in the third list of code? It's amazing.

And you're a programmer, look at my code and tell me where there is something wrong. What's that, it's all correct.

Nice try.
__________________

aperson is offline  
Old 01-10-2004, 08:44 PM   #46
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 35
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default

Quote:
Originally Posted by VxDx
the lottery doesn't work like that because there is no assurance that there is any winner at all.
Assume one was the winning ticket >_<.

Oops.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline  
Old 01-10-2004, 08:50 PM   #47
flipmaster99
FFR Player
 
Join Date: Feb 2003
Posts: 79
Default

I find the easiest way to think about this question is as follows, the answer being you should switch your choice of doors.

When you pick your first door, you are probably wrong (2/3 chance of being wrong).
The host opens an empty door.
You know that your first guess was probably wrong...
By switching to the other door, your chances of winning are better because your first choice was probably wrong.
flipmaster99 is offline  
Old 01-10-2004, 08:52 PM   #48
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,431
Send a message via AIM to aperson
Default

Furthermore, why don't you SHOW THE PROBABILITY OF EACH. What you wrote proves nothing, let me fix it for you.
Quote:
Originally Posted by VxDx
112 y 1/18
113 y 1/18
123 n 1/9
132 n 1/9
213 n 1/9
221 y 1/18
223 y 1/18
231 n 1/9
312 n 1/9
321 n 1/9
331 y 1/18
332 y 1/18
Hmm, 1/18 * 6 = 1/3
1/9 * 6 = 2/3

INTERESTING...
__________________

aperson is offline  
Old 01-10-2004, 09:03 PM   #49
banditcom
FFR Player
 
banditcom's Avatar
 
Join Date: Mar 2003
Location: Willimantic, CT
Age: 43
Posts: 6,243
Send a message via ICQ to banditcom Send a message via AIM to banditcom Send a message via Yahoo to banditcom Send a message via Skype™ to banditcom
Default

Aperson is right. So everyone shut up. It makes perfectly good sense.

And yes, I know what I'm talking about because I'm in Calculus 3.
banditcom is offline  
Old 01-10-2004, 09:09 PM   #50
VxDx
FFR Player
 
VxDx's Avatar
 
Join Date: May 2003
Posts: 1,871
Send a message via AIM to VxDx
Default

I knew you would say that, but as I said, equal probability. the problem with you code comes with the randomizing of which door is picked when you choose correctly, ie the code...
if(rand()%2 == 0) //More randomization for further proof

you're assigning a win half the chance of a loss.

Since your decision comes after the door is opened, what occurred before that is irrelevant.
Let's say the winner is door 1, thus the host cannot open door one. Let's assume that you stay with your initial choice.
The host opens door 2, so you either chose 1 or 3. that's a 50% chance of you being right
The host opens door 3, so you either chose 1 or 2. That as well is a 50% chance of winning.

I'll admit, you had me second guessing myself, and this was a very good topic and discussion and really got me thinking, but I'm pretty confident now that I'm right.

banditcom-calculus 3 has no relevance to the matter at hand, maybe if you were in a class based around probablility and statistics...
VxDx is offline  
Old 01-10-2004, 09:13 PM   #51
banditcom
FFR Player
 
banditcom's Avatar
 
Join Date: Mar 2003
Location: Willimantic, CT
Age: 43
Posts: 6,243
Send a message via ICQ to banditcom Send a message via AIM to banditcom Send a message via Yahoo to banditcom Send a message via Skype™ to banditcom
Default

You're wrong VxDX... take statistics, then you'll see. There was a 33% chance in the beginning and there will always be that that first door had a 33% chance of being the right one. The other two doors combined are 66% of being right. Host removes a wrong one. The door you had picked was still a 33% chance of being right. Now that the one of the doors that shared that 66% chance is gone, the single door remaining is 66%.

The lotto is a great example actually. You pick the numbers. The lottery removes ALL the remaining possibilities but one. The chances you had to picking the right answer is like 1 in 14 billion, lets say. What's the chance of that one being right that is remaining? It's the remaining, 13,999,999,999 in 14 billion.

EDIT: I took AP stats in highschool as well as Stats 251 here in college.
banditcom is offline  
Old 01-10-2004, 09:14 PM   #52
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,431
Send a message via AIM to aperson
Default

Quote:
Originally Posted by VxDx
I knew you would say that, but as I said, equal probability. the problem with you code comes with the randomizing of which door is picked when you choose correctly, ie the code...
if(rand()%2 == 0) //More randomization for further proof

you're assigning a win half the chance of a loss.
Wrong, if you want cout the chances for each part of that code. It should function just as intended.

Quote:
Since your decision comes after the door is opened, what occurred before that is irrelevant.
WRONG WRONG WRONG WRONG WRONG.

Look. If the original door you chose was the correct one. There are TWO DOORS HE COULD OPEN.

If the original door you chose was wrong, there was only one door he could open, AND HE CHOSE THE LOSING DOOR. That is very relevant to what will happen in the future. That is why you see those cute 1/18ths popping up where I edited your quote for the truth above.

Quote:
Let's say the winner is door 1, thus the host cannot open door one. Let's assume that you stay with your initial choice.
The host opens door 2, so you either chose 1 or 3. that's a 50% chance of you being right
The host opens door 3, so you either chose 1 or 2. That as well is a 50% chance of winning.
Yes, and that's for each subset case when the winner is door one. THAT CUTS YOUR CHANCES IN HALF IF DOOR ONE IS THE CORRECT DOOR, SEE ABOVE ABOUT 1/18THS.

Quote:
I'll admit, you had me second guessing myself, and this was a very good topic and discussion and really got me thinking, but I'm pretty confident now that I'm right.
You're wrong.


Quote:
Originally Posted by banditcom
The truth
You win.
__________________

aperson is offline  
Old 01-10-2004, 09:16 PM   #53
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 35
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default

Quote:
Originally Posted by aperson

Hmm, 1/18 * 6 = 1/3
1/9 * 6 = 2/3

INTERESTING...
6/18 = 1/3, yeah.
6/9 = 2/3, yeah.

What were you saying?

EDIT: Banditcom--Our school's Calc 3 class is advanced (senior and prolly some juniors), and its like a college class. They always take fridays off with lunch and go bowling for 2 periods. XD

I cant wait until I am in Calc 3 :O.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline  
Old 01-10-2004, 09:17 PM   #54
banditcom
FFR Player
 
banditcom's Avatar
 
Join Date: Mar 2003
Location: Willimantic, CT
Age: 43
Posts: 6,243
Send a message via ICQ to banditcom Send a message via AIM to banditcom Send a message via Yahoo to banditcom Send a message via Skype™ to banditcom
Default

Give us another aperson!
banditcom is offline  
Old 01-10-2004, 09:18 PM   #55
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,431
Send a message via AIM to aperson
Default

Quote:
Originally Posted by QreepyBORIS
Quote:
Originally Posted by aperson

Hmm, 1/18 * 6 = 1/3
1/9 * 6 = 2/3

INTERESTING...
6/18 = 1/3, yeah.
6/9 = 2/3, yeah.

What were you saying?
Oh, so now you agree that the odds of you staying are 1:3 and switching 2:3
__________________

aperson is offline  
Old 01-10-2004, 09:20 PM   #56
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 35
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default

No. I was checking the math.

I dont know where you got THAT from :P. And also check the edit.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline  
Old 01-10-2004, 09:22 PM   #57
banditcom
FFR Player
 
banditcom's Avatar
 
Join Date: Mar 2003
Location: Willimantic, CT
Age: 43
Posts: 6,243
Send a message via ICQ to banditcom Send a message via AIM to banditcom Send a message via Yahoo to banditcom Send a message via Skype™ to banditcom
Default

Quote:
Originally Posted by QreepyBORIS

EDIT: Banditcom--Our school's Calc 3 class is advanced (senior and prolly some juniors), and its like a college class. They always take fridays off with lunch and go bowling for 2 periods. XD

I cant wait until I am in Calc 3 :O.
I took Calc 2 last semester. It was a 5 credit course, meaning every morning... attendance was optional, which is a rarity here. I went only 2-3 times a week. I aced the class. heh... it was much easier than Calc 1.
banditcom is offline  
Old 01-10-2004, 09:25 PM   #58
VxDx
FFR Player
 
VxDx's Avatar
 
Join Date: May 2003
Posts: 1,871
Send a message via AIM to VxDx
Default

I'm not wrong. It doesn't matter what your initial guess is if one incorrect one is automatically eliminated and you are given a second chance. You are making your decision based on which door he opens, not which door you picked initially. Thus, you are picking from one correct door and one incorrect door. It's Ockham's razor, your complicated answer is clouding the situation.

edit: and the lottery is still a terrible example. Suppose that you have to pick 3 numbers, zeros inclusive. that's 1000 possibilities. The state then says that it's not 998 possibilies and that yours and one other are the only ones that are still left. Are you saying that you will change to the other number because you think your chances will be 999x better to win on that number?
VxDx is offline  
Old 01-10-2004, 09:28 PM   #59
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,431
Send a message via AIM to aperson
Default

Quote:
Originally Posted by VxDx
It doesn't matter what your initial guess is if one incorrect one is automatically eliminated and you are given a second chance.
Ever heard of Bayes' theorem? Obviously not. The old information IS RELEVANT. Nice try, the program proves you wrong.
__________________

aperson is offline  
Old 01-10-2004, 09:29 PM   #60
banditcom
FFR Player
 
banditcom's Avatar
 
Join Date: Mar 2003
Location: Willimantic, CT
Age: 43
Posts: 6,243
Send a message via ICQ to banditcom Send a message via AIM to banditcom Send a message via Yahoo to banditcom Send a message via Skype™ to banditcom
Default

No you ARE wrong. Stats is simple yet complicated. Read my lottery example. Tell me how the first numbers that were picked are now 50% chance of being right because there are only 2 sets now. You can't. (period)
banditcom is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:09 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution