![]() |
|
|
|
#2
|
|||
|
I wrote a program after reading a lot of mathematicians were only convinced after seeing computer simulations. In 9000 trials, switching makes you win ~6000 (2/3), not switching only ~3000 (1/3)
Code:
#include <stdio.h>
#include <stdlib.h>
#define MONTY_TRIALS 9000
bool monty_hall_problem(bool switch_doors)
{
bool doors[3] = { false, false, false };
doors[rand()%3] = true;
unsigned int choice = rand() % 3;
return (switch_doors) ? !doors[choice] : doors[choice];
}
int main(int argc, char* argv[])
{
int switch_wins = 0, no_switch_wins = 0;
for (int i = 0; i < MONTY_TRIALS; ++i)
{
if (monty_hall_problem(true)) ++switch_wins;
if (monty_hall_problem(false)) ++no_switch_wins;
}
printf("Switch: %d\tNo Switch: %d", switch_wins, no_switch_wins);
return 0;
}
| ||
|
|
|||
|
#3
|
|||
|
I forgot to seed rand there but then I did and the same shit happens anyway DUh
| ||
|
|
|||
|
#4
|
|||
|
Monty Hall question.
Variable change. Always take the switch. You get an additional 17% equity. | ||
|
|
|||
|
#5
|
|||
|
You all done fucked up my thread with your slightly higher than average level of knowledge/intelligence/age.
This works much better elsewhere on the internet. | ||
|
|
|||
|
#6
|
||||
|
Quote:
What's better, people? A 50% chance of picking the right bag, or a 33% chance of picking the right bag? When you make your first pick, you're only getting the 33% chance of being correct. After Tunare reveals an empty bag though, you can either stick with your 33% chance original choice or switch to the 50% chance bag. Derp. | |||
|
|
||||
|
#7
|
|||
|
It's amazing how many people refuse to believe that switching improves your odds.
I remember a day at work about 3-4 years ago where a co-worker (a very solid network engineer, not a dude flipping burgers) and I got into a heated discussion about it. He just wouldn't believe it so I made it easy on him and I'll do it for the retards here. Play out each scenario with the prize being in bag #2. Keep in mind that when Tunare in this case reveals a second bag, it CANNOT be the winning bag. So if you've picked bag 1, bag 3 will be revealed 100% of the time. If you pick bag 3 it will be bag one revealed 100% of the time. If you pick bag 2, it could be either. You pick bag one and keep it = lose. You pick bag two and keep it = win. You pick bag three and keep it = lose. You pick bag one and switch to bag two = win. You pick bag one and switch to bag three = cannot be done, revealed as a loser. You pick bag two and switch to bag one = lose. You pick bag two and switch to bag three = lose. You pick bag three and switch to bag one = cannot be done, revealed as a loser. You pick bag three and switch to bag two = win. So you can very simply look at this and say, if I stay I have a 1 in 3 chance (33%), if I switch I have a 2 in 4 chance (50%). Switch every time. Like was stated above, you improve your odds 17%. | ||
|
|
|||
|
#8
|
|||
|
| ||
|
|
|||
|
#9
|
|||
|
It doubles your chance of being right, actually.
If you switch, the only way you lose is if your initial choice was correct, which was a 33% chance. That means you win 66% of the time when you switch. | ||
|
|
|||
|
#10
|
|||
|
MATH HURTS MAI BRAIN LAL
__________________
![]() | ||
|
|
|||
![]() |
|
|