Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Monty-Hall-problem/Icon/monty-hall-problem.icon
Normal file
19
Task/Monty-Hall-problem/Icon/monty-hall-problem.icon
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
procedure main(arglist)
|
||||
|
||||
rounds := integer(arglist[1]) | 10000
|
||||
doors := '123'
|
||||
strategy1 := strategy2 := 0
|
||||
|
||||
every 1 to rounds do {
|
||||
goats := doors -- ( car := ?doors )
|
||||
guess1 := ?doors
|
||||
show := goats -- guess1
|
||||
if guess1 == car then strategy1 +:= 1
|
||||
else strategy2 +:= 1
|
||||
}
|
||||
|
||||
write("Monty Hall simulation for ", rounds, " rounds.")
|
||||
write("Strategy 1 'Staying' won ", real(strategy1) / rounds )
|
||||
write("Strategy 2 'Switching' won ", real(strategy2) / rounds )
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue