in reply to Re^9: Marilyn Vos Savant's Monty Hall problem
in thread Marilyn Vos Savant's Monty Hall problem
How about ?
my $MontysChoice; if( $doors[ choice ] ne 'car' ) { $MontysChoice = grep{ $doors[ $_ ] eq 'car' } 0 .. 2; } else { $MontysChoice = ( grep{ $_ != $choice } 0 .. 2 )[ rand 2 ]; }
|
|---|