Monty program......
I have devised a test to help us all......
This program simulates the setting with 100 doors to begin with. My results have been that I NEVER loose if I switch doors.
It is just a simple basic program with no error checking so please only enter numbers when you try it etc.
I'm posting the source because I'm not sure if I can attach an EXE in a post or not. Give me a MP and I can e-mail you an EXE to play with if you want. You may wants to mess with the logic a bit or the number of possible doors....
This is for MS Quick Basic, so adapt if needed.
Maybe someone will make a web interface for us.
COLOR 7, 1
CLS
RANDOMIZE TIMER
FOR c = 1 TO 10
door = INT(RND * 100) + 1
PRINT
PRINT
INPUT "Hello I am Monty - please type in a door number between 1 and 100:"; an
PRINT
PRINT "Thank you - you have chosen door #"; an
PRINT
PRINT "I will now elimante 98 doors leaving you with a choice of 2"
PRINT
IF an = door THEN
DO
kept = INT(RND * 99) + 1
LOOP UNTIL kept <> an
ELSE
kept = door
END IF
PRINT "I have removed 98 doors - remaining are "; kept; " and "; an; ""
PRINT
INPUT "Do you wish to switch ? [Y/N]"; yn$
IF yn$ = "Y" OR yn$ = "y" THEN
an1 = kept
kept1 = an
ELSE
an1 = an
kept1 = kept
END IF
PRINT
IF an1 = kept THEN
PRINT "CONGRADS! - you have won !!"
ELSE
PRINT "SORRY - try again :-("
END IF
NEXT c
|