Monty Hall problem: Difference between revisions
Content added Content deleted
m (→{{header|JavaScript}}: whitespace) |
m (→{{header|UNIX Shell}}: whitespace) |
||
Line 2,042: | Line 2,042: | ||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
{{works with|bash|2.x| and most bash-compatible unix shells}} |
{{works with|bash|2.x| and most bash-compatible unix shells}} |
||
<lang bash> |
<lang bash>#!/bin/bash |
||
#!/bin/bash |
|||
# Simulates the "monty hall" probability paradox and shows results. |
# Simulates the "monty hall" probability paradox and shows results. |
||
# http://en.wikipedia.org/wiki/Monty_Hall_problem |
# http://en.wikipedia.org/wiki/Monty_Hall_problem |
||
Line 2,114: | Line 2,113: | ||
echo "Wins (switch to remaining door): $num_win" |
echo "Wins (switch to remaining door): $num_win" |
||
echo "Losses (first guess was correct): $num_lose" |
echo "Losses (first guess was correct): $num_lose" |
||
exit 0 |
exit 0</lang> |
||
</lang> |
|||
Output of a few runs: |
Output of a few runs: |
||
<pre> |
<pre> |