Talk:Monty Hall problem: Difference between revisions

Line 39:
:It seems like it actually just puts the winner in the same place every time(?) The call <tt>play 1</tt> means "play the switch strategy", while <tt>play 0</tt> means "play the stay strategy". Then it picks a door (<tt>my $door1 = !int(rand 3);</tt>) then asks "are we switching?" (<tt>$_[0] ?</tt>). If we are, return not the door we picked (<tt>!$door1</tt>), otherwise return the door we did pick (<tt>$door1</tt>). I think it's right, but I'm not sure where it places the winning door. --[[User:Mwn3d|Mwn3d]] 14:42, 12 November 2008 (UTC)
::AFAIK the symbol '!' means "Not". Thus, variable door1 is set to boolean value True if the random number was not 0 (2/3 probability). There is no code for player selecting a door, host opening one of remaining door and player switching to the remaining door. Wasn't the original idea to make a program to simulate the game in order to see what is the probability, instead of using the known probability as starting point? --[[User:PauliKL|PauliKL]] 11:51, 13 November 2008 (UTC)
:It seems like it "fixes" the winning door to be the number 0. The user chooses a door in rand 3; if it choose the 0, !int(rand 3) gives true, so that the stay strategy wins, the leave strategy looses, and this is encoded in the next line. I suppose there's nothing wrong in fixing the prize behind the door labelled as 0; we could think of it as if we "move" the doors all together with prize or goats, so that the "player" index changes (it changes the order of the doors), but the judge of the game (Monty) will address the winner door always with 0, since that is the label he (and only he of course) can see. It is a sort of "mapping". To me it's ok.