13 lines
318 B
Text
13 lines
318 B
Text
test(trials)={
|
|
my(stay=0,change=0);
|
|
for(i=1,trials,
|
|
my(prize=random(3),initial=random(3),opened);
|
|
while((opened=random(3))==prize | opened==initial,);
|
|
if(prize == initial, stay++, change++)
|
|
);
|
|
print("Wins when staying: "stay);
|
|
print("Wins when changing: "change);
|
|
[stay, change]
|
|
};
|
|
|
|
test(1e4)
|