RosettaCodeData/Task/Monty-Hall-problem/Quackery/monty-hall-problem.quackery
2023-07-01 13:44:08 -04:00

18 lines
984 B
Text

[ $ "bigrat.qky" loadfile ] now!
[ 0 ( number of cars when not changing choice )
0 ( number of cars when changing choice )
rot times
[ 3 random ( door with goat )
3 random ( contestant's choice )
= ( If the two numbers are equal then the contestant
wins a car if they change their mind, and they win
a goat if they don't change their mind. The wins
are reversed if the numbers are not equal. )
if dip 1+ ] ( increment the relevant count )
say "Strategy A is that the contestant changes their mind." cr
say "Strategy B is that the contestant does not their mind." cr
say "Approximate ratio of car wins with strategy A over strategy B: "
swap 100 round
vulgar$ echo$ cr ] is trials ( n --> )