View Single Post
Old 11-28-2003, 03:51 PM   #17 (permalink)
Tirian
Addict
 
Tirian's Avatar
 
Location: Canada
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
Tirian is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73