The Monty Hall Problem
There’s an interesting mathematical teaser known as the Monty Hall problem.??
Imagine you’re on a game show.?There are three doors, behind one of which is a car.?You pick a door.?The host (Monty Hall) who knows where the car is, opens a different door, showing you there is nothing behind it.?Now the host asks if you’d like to choose the other unopened door.?Should you do it?
When I first encountered this problem several years ago, I was firmly in the “no” camp.?There are two doors left, it’s a 50/50 chance.?A work colleague explained to me in great detail why there was 2/3 chance of winning if I switched.?I understood the logic, but intuitively I didn’t want to let go of it being 50/50.?It just felt right in my gut.
What if we could play the gameshow hundreds of times and see the results??Well, I don’t know what you do with your spare time, but I wrote a rudimentary Monty Hall Simulator.?The source code is available here:
领英推荐
The code simply selects a random door for the car, a random door for the player, excludes a door that wasn’t chosen and doesn’t have a car behind it, and then determines if you would have won if you switched.?It then loops round and plays a hundred times.
The first result??69% success rate with switching.?Then 72%.?Then 58%.?I ran the simulator again and again.?I saw results range from a high of 84% to a low of 54%.?But always, the odds were in your favour if you switched doors.?
The lesson? – my gut instinct was wrong.?After now playing thousands of simulated games I have clear evidence you are more likely to win if you switch doors.
Whilst I would never suggest ignoring instinct, it can be put to the test.? A job candidate may feel like a good fit, but is that enough? ?Can they pair up with another developer and solve a problem??Can they write unit tests? ?Are they able to walk you through some code refactoring??
If you want candidates who have been put through a suitable suite of tests, feel free to contact me.?The principle behind my company, Dev By Dev Recruitment, is that developers recruit developers.?Then once tested, you can safely rely on your gut for the final decision. Don't settle for a 50/50, opt for 2/3.