Monty Hall problem: Difference between revisions
Content added Content deleted
m (→{{header|APL}}: whitespace) |
(→{{header|Euphoria}}: Euphoria example added) |
||
Line 684: | Line 684: | ||
Output: |
Output: |
||
<pre>Switching/Staying wins: 66609 33391</pre> |
<pre>Switching/Staying wins: 66609 33391</pre> |
||
=={{header|Euphoria}}== |
|||
<lang euphoria>integer switchWins, stayWins |
|||
switchWins = 0 |
|||
stayWins = 0 |
|||
integer winner, choice, shown |
|||
for plays = 0 to 10000 do |
|||
winner = rand(3) |
|||
choice = rand(3) |
|||
while 1 do |
|||
shown = rand(3) |
|||
if shown != winner and shown != choice then |
|||
exit |
|||
end if |
|||
end while |
|||
stayWins += choice = winner |
|||
switchWins += 6-choice-shown = winner |
|||
end for |
|||
printf(1, "Switching wins %d times\n", switchWins) |
|||
printf(1, "Staying wins %d times\n", stayWins)</lang> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |