Monty Hall problem: Difference between revisions

Line 797:
my $stay = 0;
my $switch = 0;
 
my $show;
 
foreach (1 .. $trials)
Line 808 ⟶ 806:
if ( $prize == $chosen )
{
my $show;
# a "further" optimization would strip the next
1do while({ ($show = int(rand 3) )} while $show == $chosen );
# line since it basically does nothing
1 while( ($show = int(rand 3) ) == $chosen );
# ^ monty opens a door which is not the one with the
# prize, that he knows it is the one the player chosen
Anonymous user