Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
montyHall[nGames_] :=
|
||||
Module[{r, winningDoors, firstChoices, nStayWins, nSwitchWins, s},
|
||||
r := RandomInteger[{1, 3}, nGames];
|
||||
winningDoors = r;
|
||||
firstChoices = r;
|
||||
nStayWins = Count[Transpose[{winningDoors, firstChoices}], {d_, d_}];
|
||||
nSwitchWins = nGames - nStayWins;
|
||||
|
||||
Grid[{{"Strategy", "Wins", "Win %"}, {"Stay", Row[{nStayWins, "/", nGames}], s=N[100 nStayWins/nGames]},
|
||||
{"Switch", Row[{nSwitchWins, "/", nGames}], 100 - s}}, Frame -> All]]
|
||||
|
|
@ -0,0 +1 @@
|
|||
montyHall[100000]
|
||||
Loading…
Add table
Add a link
Reference in a new issue