RosettaCodeData/Task/Monty-Hall-problem/Ursala/monty-hall-problem.ursala
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

17 lines
427 B
Text

#import std
#import nat
#import flo
rounds = 10000
car_locations = arc{1,2,3}* iota rounds
initial_choices = arc{1,2,3}* iota rounds
staying_wins = length (filter ==) zip(car_locations,initial_choices)
switching_wins = length (filter ~=) zip(car_locations,initial_choices)
format = printf/'%0.2f'+ (times\100.+ div+ float~~)\rounds
#show+
main = ~&plrTS/<'stay: ','switch: '> format* <staying_wins,switching_wins>