• No products in the cart.

Birthdays

python1

A few weeks ago
a buddy of mine
busted out the MHP on me. For those not familiar, it’s a now-famous
mathematics puzzle named after the talk show host who hosted the show it’s
associated with.

The idea is simple, and is
covered in depth at Wikipedia, but for those looking for a simple rundown it’s basic concept is this:
you’re given three doors and told one has a car behind it while the other
two have goats. You are asked to pick a door. After your choice is made
you’re then showed a goat behind one of the other two doors.

You are then asked if you want to switch to the remaining door or keep
the one you chose initially
.

The natural inclination is to think that since there are only two open doors
remaining, and you already have one of them, that it’s precisely equal odds
between them — and therefore not beneficial (or detremental) to your odds to
change your choice.

That logic, however, is flawed.

It is, in fact, beneficial to change your choice. In reality, it takes you
from a 33% chance to a 66% chance when you switch, or from 1/3 to
2/3.

If you doubt this go spend some time at Wikipedia. Anyway, I was so
intrigued with the puzzle that I decided to write a bit of code to
illustrate how this plays out in reality. There are many such programs out
there already; I just wanted to do it for myself.

This code is rather crude, which it turns out is something of a signature of
my little wannabe coding projects, but it was fun to write. I don’t have the
time right now to write the decision process portion of the puzzle, and
currently it just models the staying and leaving dynamic, but you get the
idea.

Here’s the code that uses psuedorandom placement of both the car and the
contestant’s choice.

Very interesting indeed. It is, in fact, better to switch.

May 23, 2025

0 responses on "Birthdays"

Leave a Message

Your email address will not be published. Required fields are marked *


We make great apps
top
An Ultimate Multimedia Consult © Ultimate Multimedia Consult. All rights reserved.