RosettaCodeData/Task/Monty-Hall-problem/Tcl/monty-hall-problem-1.tcl
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

10 lines
295 B
Tcl

set stay 0; set change 0; set total 10000
for {set i 0} {$i<$total} {incr i} {
if {int(rand()*3) == int(rand()*3)} {
incr stay
} else {
incr change
}
}
puts "Estimate: $stay/$total wins for staying strategy"
puts "Estimate: $change/$total wins for changing strategy"