Monty Hall problem: Difference between revisions

m
→‎{{header|Sidef}}: modified the code to work with the latest version of Sidef
m (→‎{{header|Sidef}}: modified the code to work with the latest version of Sidef)
Line 3,330:
 
var show;
do {
{ show = 3.rand.int }
do while {show ~~show [chosen,= prize]};3.rand.int
} while (show ~~ [chosen, prize]);
 
given(chosen) {
when (prize) { stayWins += 1 }
when ([3 - show - prize]) { switchWins += 1 }
default { die "~ error ~" };
}
}
 
Line 3,343 ⟶ 3,345:
{{out}}
<pre>
Staying wins 3431.8020% of the time.
Switching wins 6568.2080% of the time.
</pre>
 
2,747

edits