Anonymous user
Monty Hall problem: Difference between revisions
→{{header|Mathematica}}: layout
(→{{header|Mathematica}}: layout) |
|||
Line 1,700:
=={{header|Mathematica}}==
<lang Mathematica> montyHall[g_] :=
Module[{r, winningDoors, firstChoices, nStayWins, stayWinPercent, nSwitchWins},
r := RandomInteger[{1, 3}, nGames];
Line 1,712 ⟶ 1,710:
Grid[{{"Strategy", "Wins", "Win %"}, {"Stay", Row[{nStayWins, "/", nGames}], stayWinPercent},
{"Switch", Row[{nSwitchWins, "/", nGames}], 100 - stayWinPercent}}, Frame -> All]]</lang>
Usage▼
=={{header|MATLAB}}==
|