Monty Hall problem: Difference between revisions

Content added Content deleted
No edit summary
Line 728: Line 728:
<lang haskell>The switch strategy succeeds 67% of the time.
<lang haskell>The switch strategy succeeds 67% of the time.
The stay strategy succeeds 34% of the time.</lang>
The stay strategy succeeds 34% of the time.</lang>

=={{header|HicEst}}==
<lang hicest>DLG(NameEdit = plays, DNum=1, Button='Go')

switchWins = 0
stayWins = 0

DO play = 1, plays
car_is_behind_door = 1 + INT(RAN(3))
guessed_cars_door = 1 + INT(RAN(3))
stayWins = stayWins + (guessed_cars_door == car_is_behind_door)
switchWins = switchWins + (guessed_cars_door /= car_is_behind_door)
ENDDO

WRITE(ClipBoard, Name) plays, switchWins, stayWins</lang>
<lang hicest>plays=1E3; switchWins=641; stayWins=359;
plays=1E4; switchWins=6668; stayWins=3332;
plays=1E5; switchWins=66859; stayWins=33141;
plays=1E6; switchWins=666403; stayWins=333597;</lang>


=={{header|J}}==
=={{header|J}}==