For the benefit of people who (like me) didn't believe a word of this, but can't bear to look at
Visual Basic, here's a quick
perl experiment I conducted:
#! /usr/bin/perl
while ($i++ < 10000) { # try 10,000 times
@doors = ('goat', 'goat', 'goat');
$car = int(rand(3));
$doors[$car] = 'car';
$guess = int(rand(3));
for (0..2) {
if (($_ != $guess) and ($doors[$_] eq 'goat')) {
$open = $_;
last;
}
}
if ($j = !$j) { # every other time.
for (0..2) {
if (($_ != $guess) and ($_ != $open)) {
$finalguess = $_;
last;
}
}
$switchwin++ if ($finalguess == $car);
$switched++;
} else {
$unswitchwin++ if ($guess == $car);
$unswitched++;
}
}
print "switched wins: $switchwin/$switched\n";
print "unswitched wins: $unswitchwin/$unswitched\n\n";
Astoundingly, this consistently gives results like:
switched wins: 3298/5000
unswitched wins: 1555/5000