2013-01-22, 12:54 AM
Sardines Wrote:It is when both of you are stoned.
It hurts. It really hurts.
I even coded the Monty Hall Problem in Python and it still didn't convince him when the odds came out 0.66 in favor of switching every time. He chalked it up to, "I don't know enough about programming to say whether that's right or not."
I even went through great pains to make it as simple as I could.

Code:
import random
import copy
car_win_rate = 0
total_number_games = 0
possibilities = ['car', 'goat', 'goat']
random.shuffle(possibilities)
for i in xrange(1000):
#Playing a new game of Monty Hall!
total_number_games += 1
print("Number games: %d" % (total_number_games))
#Copy possibilities into the doors
doors = copy.copy(possibilities)
print("Doors begin: %s" % (doors))
#Pick a number such that 0 <= x <= 2
choice = random.randint(0, 2)
print("Choice: %d" % (choice))
#Remember the kind of choice we got
choiceType = doors[choice]
print("choiceType: %s" % (choiceType))
#Remove a goat
doors.remove('goat')
print("Doors after removing goat: %s" % (doors))
#Just in case the index gets screwed up...
#(i.e. we choose 2 and remove a goat, making the length of the array 2,
#which would cause out of bounds)
choice = doors.index(choiceType)
print("New choice: %d" % (choice))
#Always switch my choice regardless of what happens
if choice == 1:
choice = 0
elif choice == 0:
choice = 1
print("Flipped choice: %d" % (choice))
print("Choice result: %s" % (doors[choice]))
#Did I get a car?
if doors[choice] == 'car':
#I win!
car_win_rate += 1
print("Car win rate: %d" % (car_win_rate))
print("")
print(car_win_rate)
print("Win Rate: %0.2f" % (float(car_win_rate) / float(total_number_games)))He said, "It should be 50% chance to get a goat. No matter what you choose in your first choice, you will always come out with a car and a goat. So your first choice doesn't matter. So since you only have a car and a goat left, that means 50/50 to get a car or a goat."
I tried to explain to him that you have a 2/3 chance of picking a goat your first try, and if you pick a goat and switch you will always get the car. He wouldn't hear it.
