Pages: 1 [2] 3 4   Go Down
 Author Topic: Urgent help needed with bar puzzle  (Read 4770 times) 0 Members and 1 Guest are viewing this topic.
Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #15 on: August 12, 2013, 01:00:28 pm » Bigger Smaller Reset

Quote
you have 2 ashtrays, there is a coin under one of the ashtrays.  You have one ashtray under your hand and the other is not.  The location of the ashtrays has no bearing on the odds.  They are still 50:50.  The current odds are not dependent on previous odds.

Wrong @flyboy - want to bet on it  ?

If we started with 2 ashtrays the odds of the coin being under the ashtray under my hand are 50:50.
However we started with 3 ashtrays so the odds of the coin being under the other ashtray are 2:3, I have twice as much chance of winning if I change.

There is no trick here just maths, but it is very counter intuitive.
 Logged

Global Moderator
Netherlands
Online
Shannon Member
Karma: 223
Posts: 13900
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #16 on: August 12, 2013, 01:19:08 pm » Bigger Smaller Reset

Think you must view it from the barman point of view.

scenario 1: the coin is under the ashtray selected.
=> the barman has two trays to choose from to turn
=> which leaves you with a 50% chance

scenario 2: the coin is not under the ashtray selected.
=> The barman must turn the other ashtray without the coin. He has no choice left (this is essential!)
=> in this scenario you must select the other ashtray. 100% sure

The chance of scenario 1 to happen is 1 in 3
The chance of scenario 2 to happen is 2 in 3

so by selecting the other ashtray your total chance becomes 1/3 * 50% + 2/3 * 100% => 83.3 %

( no math expert, as my final number differs from the wikipedia? )
 « Last Edit: August 12, 2013, 01:29:00 pm by robtillaart » Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #17 on: August 12, 2013, 02:03:33 pm » Bigger Smaller Reset

@robtillart - nope!

The odds that the krugerrand is under the ashtray I chose first is always 1:3 or 33.333%.
The odds that the krugerrand is under the other ashtray is always 2:3 or 66.666%.

Try and think of this way;

Before any ashtrays are turned over the odds of the krugerrand being under each ashtray is 1:3.
Therefore when I choose an ashtray the chance of the krugerrand being under my chosen ashtray is 1:3.
The chance that it is under the other two ashtrays is 2:3.

Everybody must agree on the above - yes?

Now the barman knows which ashtray the krugerrand is under (which may be the one I have chosen it may not, it does not matter).
The barman always turns over an ashtray which does not have the krugerrand under it.

Here is the difficult bit; For me the barman turning one of the pair over has not changed the probability that the krugerrand is under one of that pair, that probability remains 2:3. However, clearly, I can see that the kruggerand is not under the ashtray he turned. As a result the entire 2:3 probability now resides in the unturned ashtray which I have not chosen.

The barman always gives me the chance to change my choice.
I should always accept because I always double my odds of getting the coin.

 Logged

Maine
Offline
Sr. Member
Karma: 14
Posts: 418
Caution: Explosives in use.
 « Reply #18 on: August 12, 2013, 05:11:33 pm » Bigger Smaller Reset

Here's a video explanation: http://testtube.com/scamschool/scamschool-108/
 Logged

"Anyone who isn't confused really doesn't understand the situation."

Electronic props for Airsoft, paintball, and laser tag -> www.nightscapetech.com

Global Moderator
Dallas
Online
Shannon Member
Karma: 210
Posts: 13036
 « Reply #19 on: August 12, 2013, 08:39:19 pm » Bigger Smaller Reset

The odds that the krugerrand is under the ashtray I chose first is always 1:3 or 33.333%.

Unless I made a coding mistake, Monte Carlo says you have that backwards correct...

State.h
Code:
#ifndef States_h
#define States_h

typedef enum
{
sStart            = 0b00000000,
sKrugerrand       = 0b00000001,
sBarmanFlipped    = 0b00000010,
sFirstGuess       = 0b00000100,
sSecondGuess      = 0b00001000,
sChangedMind      = 0b00010000,
}
state_t;

#endif

Krugerrand.ino
Code:
#include "States.h"

void setup( void )
{
Serial.begin( 115200 );
}

static void SetState( state_t & set, state_t element )
{
set = (state_t)(set | element);
}

static void PrintState( state_t set )
{
if ( set & sKrugerrand ) Serial.write('K'); else Serial.write(' ');
if ( set & sBarmanFlipped ) Serial.write('B'); else Serial.write(' ');
if ( set & sFirstGuess ) Serial.write('1'); else Serial.write(' ');
if ( set & sSecondGuess ) Serial.write('2'); else Serial.write(' ');
if ( set & sChangedMind ) Serial.write('C'); else Serial.write(' ');
}

static uint32_t Same;
static uint32_t Change;
static uint32_t Total;
static uint32_t Paydirt;

void loop( void )
{
state_t Ashtray[3];
uint8_t FirstGuess;
uint8_t SecondGuess;
uint8_t i;

Ashtray[0] = sStart;
Ashtray[1] = sStart;
Ashtray[2] = sStart;

SetState( Ashtray[random(0,3)], sKrugerrand );
FirstGuess = random(0,3);
SetState( Ashtray[FirstGuess], sFirstGuess );

do
{
i = random(0,3);
}
while ( Ashtray[i] != sStart );

SetState( Ashtray[i], sBarmanFlipped );

/*
if ( random(0,2) == 0 )
{
++Same;
SecondGuess = FirstGuess;
SetState( Ashtray[SecondGuess], sSecondGuess );
}
else
*/
{
++Change;
for ( int8_t i=0; i < 3; ++i )
{
if ( (Ashtray[i] & (sBarmanFlipped | sFirstGuess)) == 0 )
{
SecondGuess = i;
SetState( Ashtray[SecondGuess], sSecondGuess );
SetState( Ashtray[SecondGuess], sChangedMind );
break;
}
}
}

for ( int8_t i=0; i < 3; ++i )
{
if ( (Ashtray[i] & (sKrugerrand | sSecondGuess | sChangedMind)) == (sKrugerrand | sSecondGuess | sChangedMind) )
{
++Paydirt;
break;
}
}

++Total;

/*
for ( int8_t i=0; i < 3; ++i )
{
PrintState( Ashtray[i] );
Serial.write( '\t' );
}
*/

if ( (Total & 0x000000FF) == 0 )
{
/*
Serial.print( (Same * 1000) / Total );
Serial.write( '\t' );
*/
Serial.print( (Paydirt * 1000) / Total );
Serial.println();
}
}
 « Last Edit: August 14, 2013, 11:07:58 am by Coding Badly » Logged

Central Indiana, USA
Offline
Full Member
Karma: 0
Posts: 203
So many projects, so little time...and money!
 « Reply #20 on: August 13, 2013, 11:15:42 am » Bigger Smaller Reset

I still have to disagree.  The previous conditions have no bearing on the new odds.  The odds are 50:50 because you now only have 2 ashtrays and only 1 of them has the coin under it.  The fact that the bar man will always offer for you to change your selection means that he has no bearing on the odds.  Yes, in the previous test, you had a 1 in 3 chance.  In the current test, you have a 1 in 2 chance.  The removal of the ashtray changes the conditions and starts a new test.  The current test is not dependent on previous odds, unless the bar man turned over an ashtray with the coin.  Since he did not, the odds are now 50:50.  There is nothing counter-intuitive here.  The doubt in your own mind is the problem, not the odds of finding the coin.
 Logged

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #21 on: August 13, 2013, 01:00:24 pm » Bigger Smaller Reset

@flyboy

Try an alternative way of looking at the same thing;

From a pack of playing cards take 9 face cards and 1 ace.
Shuffle the 10 cards and spread them randomly, face down, on a table.

Chose 1 card without looking at and push it to one side.

You now have two piles of cards on the table.
One pile has just 1 card in it, the other has 9.

It is quite obvious that every individual card has a 1:10 chance of being the ace.
It is equally obvious that the ace is far more likely to be in the big pile, in fact a 9:10 chance.

Now start picking cards from the big pile one at a time and turn them over.
With every card you turn which is a face card, the odds of the next card you turn being the ace grow they don't diminish.

It took me ages to get my head round this. I book I am reading reminded me of the problem so I threw it into Bar Sport to provoke a brawl because it goes so against common sense that people find it hard to accept. Consider that even if you turn the last card over and it is not the ace the probability of it being in that pile was still 9:10 and on average will prove to be so.

This is not like tossing a coin. As soon as you decide on the total number of cards the odds become fixed. Probability is a weird thing.

 Logged

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #22 on: August 13, 2013, 01:16:01 pm » Bigger Smaller Reset

@wizdum your video explains things quite well and they are in a bar!
I was able to fast forward through the ads.

I like the statistic that 10,000 people wrote to a magazine, including 1,000 PhDs, incorrectly saying the saying the answer was wrong.
So, if somebody thinks the odds are 50:50, don't worry you are in good company.
 Logged

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #23 on: August 13, 2013, 02:36:32 pm » Bigger Smaller Reset

Thinking about the video one point it makes is very good.

When you choose your ashtray you know that the the probability is that you have not chosen the coin.
You know mathematically that the chances are the coin is under the other ashtrays.

When you are shown that one of the other ashtrays does not have the coin under it, if you were completely logical and rational, then it should be clear that the ashtray you have not chosen is now twice as likely to cover the coin as the one you have chosen - but the human mind is not wired like a Vulcan. Mr Spock would not make this error.

 Logged

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #24 on: August 14, 2013, 03:59:23 am » Bigger Smaller Reset

Below are three Truth Tables which I hope will convince any remaining sceptics that you are always better change from your first choice.

If you stick with your first choice then to win you must select the coin first time and you have only a 1:3 chance of doing that. Changing position takes advantage of information provided after the first choice was made and doubles your chance of winning.

 OO\$ One of three places the coin could be hidden F?? ?F? ??F All possible first choices FO? OF? O?F Reveal an empty location FOS OFS OSF Show second choice S S F WINNER - Second choice wins 2 out of 3 times

 O\$O Two of three places the coin could be hidden F?? ?F? ??F All possible first choices F?O OF? O?F Reveal an empty location FSO OFS OSF Show second choice S F S WINNER - Second choice wins 2 out of 3 times

 \$OO Three of three places the coin could be hidden F?? ?F? ??F All possible first choices F?O ?FO ?OF Reveal an empty location FSO SFO SOF Show second choice F S S WINNER - Second choice wins 2 out of 3 times
 Logged

Global Moderator
Dallas
Online
Shannon Member
Karma: 210
Posts: 13036
 « Reply #25 on: August 14, 2013, 04:04:28 am » Bigger Smaller Reset

"Reveal an empty location" is incomplete.  There is one other possibility for each table.
 Logged

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #26 on: August 14, 2013, 04:38:33 am » Bigger Smaller Reset

Quote
"Reveal an empty location" is incomplete.  There is one other possibility for each table.
Well spotted @CodingBadly. That annoyed me but I could not figure an easy and tidy way of representing that in the tables. However it does not affect the outcome.

If the person correctly guesses the location of the coin first time and does not change his choice then he will win, but if he changes his choice he will lose. Only one of the empty locations is revealed and, whichever it is, the outcome is always the same.

Below are a couple of sub-tables showing that which empty location is revealed has no impact.

 O\$O ?F? OF? Reveal one of the two possible empty locations OFS F WINNER

 O\$O ?F? ?FO Reveal the other of the two possible empty locations SFO F WINNER

 Logged

Cape Town South Africa
Offline
Edison Member
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
 « Reply #27 on: August 19, 2013, 10:35:26 am » Bigger Smaller Reset

Hmm    are they glass ashtrays ?

And anyone offering you a 50% or 33% or 66% chance of a free Kruger Rand in a bar, ain't going to play fair :-)

Having read a bit about it, I can see how it works  ( from Popular Solution on http://en.wikipedia.org/wiki/User:Rick_Block/Monty_Hall_problem_%28draft%29 ).

It is the interference of the barman in removing a choice that changes it from being a 50/50 guess.
 « Last Edit: August 19, 2013, 12:23:39 pm by Boffin1 » Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Offline
God Member
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
 « Reply #28 on: August 19, 2013, 02:36:36 pm » Bigger Smaller Reset

Quote
Having read a bit about it, I can see how it works

It is very hard to see though, and many a long argument has been had about it.
 Logged

Cape Town South Africa
Offline
Edison Member
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
 « Reply #29 on: August 19, 2013, 04:48:40 pm » Bigger Smaller Reset

It certainly goes against instinctive logic, but the table below shows it clearly ( assumes you picked door 1 )

( its doors not ashtrays, and a car for kruger rand, and goat booby prize )

Door 1     Door 2    Door 3    result if switching    result if staying
Car          Goat            Goat        Goat                     Car
Goat         Car            Goat          Car                            Goat
Goat         Goat        Car            Car                            Goat

So you win twice as often if you switch.

If your first guess was right, you will lose by switching.
Or, if your first guess is wrong, you will always win if you switch, and always lose if you don't ( see table )
 Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

 Pages: 1 [2] 3 4   Go Up