'In this version of the Monty Hall problem,
'Monty acts randomly. He does not know where
'the prize is located. After the contestant
'picks a door randomly, Monty picks one of the
'remaining two door randomly (i.e., he cannot
'pick the same door as the contestant.)
'If Monty picks the prize door, the contestant
'automatically loses.
'If Monty does not pick the prize door, the
'program determines whether the contestant wins
'by staying or switching.
COPY 1 2 3 doors
COPY 100000 rptCount
REPEAT rptCount
SAMPLE 1 doors prizeDoor
SHUFFLE doors RandomPicks
TAKE RandomPicks 1 guessDoor
TAKE RandomPicks 2 montyDoor
IF montyDoor = prizeDoor
SCORE 1 Lose
END
IF guessDoor = prizeDoor
SCORE 1 stayingWinsScore
END
IF guessDoor <> prizeDoor AND montyDoor <> prizeDoor
SCORE 1 switchingWinsScore
END
END
SUM switchingWinsScore switchingWinsCount
SUM stayingWinsScore stayingWinsCount
SUM Lose LoseCount
DIVIDE switchingWinsCount rptCount switchingWinProbability
DIVIDE stayingWinsCount rptCount stayingWinProbability
DIVide LoseCount rptCount LoseProbability
PRINT stayingWinProbability switchingWinProbability LoseProbability