[dba-Tech] The Three Doors Problem

Andy Lacey andy at minstersystems.co.uk
Fri Aug 26 01:55:19 CDT 2005


There is a wonderful novel called "The Curious Incident Of The Dog In The
Night-Time" by Mark Haddon. It's about a young boy with Asperger's Syndrome.
I tell you this because one chapter comprises his musings on the Monty Hall
problem, with a great explantion that even I can understand.

And yes you should change.

And do read that book. It's brilliant.

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: dba-tech-bounces at databaseadvisors.com 
> [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of 
> Erwin Craps - IT Helps
> Sent: 26 August 2005 07:06
> To: Discussion of Hardware and Software issues
> Subject: RE: [dba-Tech] The Three Doors Problem
> 
> 
> Ok found it.
> Its called the Monty Hall rule.
> I programmed it in the boxes version (there are many version 
> of this rule). My code was programmed in VB6 but its pretty 
> simple and will probably work straigt away in VBA to.
> 
> Run the MontyHall sub adding the number of iterations.
> As usual statistics are more accurate with larger numbers.
> But you alreay see it with 10 iterations.
> 
> 
> Here's the code. 
> ###BEGIN OF CODE###
> Sub MontyHall(Iterations As Long)
> Dim Success As Integer
> Dim Boxes(3) As Boolean
> Dim Choosen As Integer
> Dim Unvealed As Integer
> Dim NoChangeSuccess As Long
> Dim ChangeSuccess As Long
> Dim NoChangeTotal As Long
> Dim ChangeTotal As Long
> Dim NotChoosen As Integer
> 
> Dim I As Integer, Iteration As Long
> 
> For Iteration = 1 To Iterations
> NoChangeSuccess = 0
> ChangeSuccess = 0
> 
>     For I = 1 To 100
>         Erase Boxes
>         
>         'Set money in box
>         Randomize
>         Boxes(Int((3 * Rnd) + 1)) = True
>     
>         'I'm Choosing a box
>         Randomize
>         Choosen = Int((3 * Rnd) + 1)
>         
>         
>         'Unveale 1 empty box
>         Unvealed = Int((3 * Rnd) + 1)
>         Do Until Unvealed <> Choosen
>             Randomize
>             Unvealed = Int((3 * Rnd) + 1)
>         Loop
>         If Boxes(Unvealed) = True Then Unvealed = 6 - Choosen 
> - Unvealed
>         
>         
>         'Check for values
>         NotChoosen = 6 - Choosen - Unvealed
>         If Boxes(Choosen) = True Then NoChangeSuccess = 
> NoChangeSuccess
> + 1
>         If Boxes(NotChoosen) = True Then ChangeSuccess = 
> ChangeSuccess + 1
>     
>     Next I
>     
>     'Remove Remark on folowing line for detailed results
>     'Debug.Print "Iteration:" & Format(Iteration, "00#") & " 
> Result Choosen Box:" & NoChangeSuccess & " Other box:" & ChangeSuccess
>     
>     'Set totals
>     NoChangeTotal = NoChangeTotal + NoChangeSuccess
>     ChangeTotal = ChangeTotal + ChangeSuccess
>     
>     
> Next Iteration
> 
> Debug.Print "Iterationtotals:" & " Result Choosen Box:" & 
> NoChangeTotal / Iterations & "% Other box:" & ChangeTotal / 
> Iterations & "%"
> 
> End Sub
> ###END OF CODE###
> 
> 
> 
> 
> 
>  
> 
> -----Original Message-----
> From: dba-tech-bounces at databaseadvisors.com
> [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of 
> Erwin Craps
> - IT Helps
> Sent: Friday, August 26, 2005 7:54 AM
> To: Discussion of Hardware and Software issues
> Subject: RE: [dba-Tech] The Three Doors Problem
> 
> Ha, seen this a couple of years ago but with dead row 
> prisoners... I written an VBA program to take this 
> statistical weirdness to the test AND IT IS TRUE
> 
> I try if I can find the program...
> 
> 
> -----Original Message-----
> From: dba-tech-bounces at databaseadvisors.com
> [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of 
> Josh McFarlane
> Sent: Friday, August 26, 2005 7:22 AM
> To: Discussion of Hardware and Software issues
> Subject: Re: [dba-Tech] The Three Doors Problem
> 
> Well, that one is a little bit more simple.
> 
> Barrel A, Barrel B, and Barrel C
> Fruit - Apples -- Oranges
> 
> If he pulls Apples out of Barrel A, you apply Apples to 
> Barrel A, Oranges to Barrel B and Fruit to Barrel C, just a 
> matter of making sure the same label doesn't end up on the same spot.
> 
> In the case of the game show problem however, you start out 
> with 3 choices to resolve the situation:
> 
> 2 Losses
> 1 Win
> 
> No matter what you choose, the situation is simplified to two choices:
> 
> 1 Loss
> 1 Win
> 
> The other properties of the choice don't change, as there 
> will always be 1 win and 1 loss. Nothing says either or will 
> be more probable than the other, so you should end up with a 
> 50/50 chance.
> 
> On 8/25/05, MartyConnelly <martyconnelly at shaw.ca> wrote:
> > Well this is a microsoft interview question You have three barrels
> > labelled oranges, apples and mixed fruit The barrels have all  been 
> > mislabelled, Someone pulls out a fruit from a barrel and 
> tells you it 
> > is an apple your job is to relabel the barrels correctly.
> > 
> > Stuart McLachlan wrote:
> > 
> > >On 25 Aug 2005 at 19:52, Kathryn Bassett wrote:
> > >
> > >
> > >
> > >>I know the answer is to stick with original choice, but I can't
> remember the logistics of why.
> > >>
> > >>--
> > >>
> > >>
> > >Bzzzt!
> > >
> > >Next?
> > >
> > ><g>
> > >
> > >
> > >
> > 
> > --
> > Marty Connelly
> > Victoria, B.C.
> > Canada
> > 
> > 
> > _______________________________________________
> > dba-Tech mailing list
> > dba-Tech at databaseadvisors.com 
> > http://databaseadvisors.com/mailman/listinfo/dba-tech
> > Website: http://www.databaseadvisors.com
> > 
> 
> 
> --
> Darsant Silverstring 
> 
> "Peace cannot be kept by force. It can only be achieved by 
> understanding." -Albert Einstein 
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com 
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com 
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com
> 
> 




More information about the dba-Tech mailing list