Anonymous user
Monty Hall problem: Difference between revisions
m
→{{header|Dyalect}}
(Added Quackery.) |
|||
Line 1,278:
<lang dyalect>var switchWins = 0
var stayWins = 0
for plays in 0..1000000 {
var doors = [0 ,0, 0]
var winner = rnd(max: 3)
doors[winner] = 1
var choice = rnd(max: 3)
var shown = rnd(max: 3)
while doors[shown] == 1 || shown == choice {
shown = rnd(max: 3)
}
stayWins += doors[choice]
switchWins += doors[3 - choice - shown]
}
print("Staying wins \(stayWins) times.")
print("Switching wins \(switchWins) times.")</lang>
Line 1,299:
{{out}}
<pre>Staying wins
Switching wins
=={{header|Eiffel}}==
|