>The problem with your code is you don't take into account the information gained by opening the wrong door. Once the door is opened it's a whole new problem. In your code the door that is opened could have the boat behind it but we have already established that that's not true. The answer is 50/50 chance so it doesn't matter. Any math/statistics majors out there that can settle this ;)
I already did, both answers are correct to different problems :)
Christof (and others) are treating it as a "conditional" probablity problem, that is, "how do the odds change if something occurs?" That is what the original problem (as I've seen it posed) was. There is also an "independent" problem in which the past is irrelevant, as others interpreted it. So, the answer depends on a very exact statement of the problem, otherwise the solution can vary...
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.