1000 REM Probable.bas
1020 ' MJR 15-03-98
1030 ' To test the theory of CARGOAT
1040 ' Theory: There are three boxes and you can choose to open any one box.
1050 ' One box contains a new car, and each other box an old goat.
1060 ' The probability of selecting a new car is approximately 33%
1070 ' After you have chosen, you are shown the contents of one of the
1072 ' two remaining boxes. It is a goat.
1074 ' You are offered the opportunity of abandoning your first
1076 ' choice and taking the unopened remaining box. Ought you to
1078 ' change your mind and take this opportunity?
1080 ' It is claimed via statistical theory that the probability that
1082 ' this other box contains the car is approx 66%, not the 50%
1084 ' you might assume if there is now only a choice of two boxes.
1090 ' In other words, if you change your selection then the chance
1092 ' of your winning is 66% instead of 33% if you do not change.
1094 ' You might be forgiven in thinking that your chances are 50%
1096 ' on either box.
1200 ' Comments: It is claimed that, having already made the first choice,
1202 ' the event has passed and the probability cannot be altered,
1204 ' so it remains a 33% probability that the car is in the
1206 ' first-chosen box, and 66% that it is in the unopened
1208 ' remaining box.
1220 ' Try to formulate a common sense explanation of this result
1230 ' and illustrate it with a Basic program not involving
1232 ' formal Statistical Theory.
1300 ' Argument: A: I have chosen Box X, leaving Box Y and Box Z
1302 ' B: Box X has been shifted into a Green Area
1304 ' C: Boxes Y and Z have been shifted to a Red Area
1306 ' D: All the boxes have an equal chance of containing the car
1308 ' E: So the car is more likely to be in the Red Area
1310 ' F: If I could choose an area it would be the Red Area because
1312 ' it contains two boxes.
1314 ' G: The car can only be in one box so one of the boxes in the
1316 ' Red Area must contain a goat, and if that box is removed
1318 ' then my prospects cannot be affected.
1320 ' H: The box most likely to contain the car is the remaining
1322 ' box in the Red Area.
1324 ' I: The probability that the car is in the red area is 2 in 3
1326 ' J: If the car is in the Red Area then it is in the remaining
1328 ' box.
1330 ' K: So, the probability that the car is in the remaining box
1332 ' in the Red Area is 2 in 3.
1334 ' L: The probability that the car is in Box in the Green Area
1336 ' is 1 in 3.
1338 ' M: So, if I am given the opportunity I should change my
1340 ' selection to the remaining box in the Red Area.
1350 '
2000 PRINT "Program name: Probable.bas"
2010 RANDOMIZE
2020 INPUT "Enter reqd number of trials: ", AA%
2030 FOR IA% = 1 TO AA%
2032 PRINT IA%;
2040 BA% = INT(RND * 3) + 1' Set winning box number
2050 PRINT BA%;
2100 BB% = INT(RND * 3) + 1' Punter's original choice (from 3 boxes)
2110 PRINT BB%;
2112 BE% = BC%
2120 IF BB% = BA% THEN BC% = BC% + 1' Accum score
2122 IF BC% = BE% THEN BF% = 0 ELSE BF% = 1' 1 indicates win
2124 PRINT BF%;
2130 PRINT BC%;
2200 BD% = INT(BC% / IA% * 100)' Percent
2210 PRINT BD%;
2310 IF BB% = 1 THEN CA% = 2: CB% = 3' If choice = 1 then residue are 2 & 3
2312 IF BB% = 2 THEN CA% = 1: CB% = 3
2314 IF BB% = 3 THEN CA% = 1: CB% = 2
2320 CC% = 0' Reset number of the box to be eliminated.
2330 IF CA% <> BA% THEN CC% = CB%' If residue #1 is goat then choice = #2
2332 IF CB% <> BA% THEN CC% = CA%' If #2 is goat then choice = #1
2333 PRINT CC%; ' Box number of residual (non-eliminated) box being offered.
2334 CE% = CD%
2340 IF CC% = BA% THEN CD% = CD% + 1
2341 IF CD% = CE% THEN CG% = 0 ELSE CG% = 1' 1 indicates win
2342 PRINT CG%; ' Win / Lose
2343 PRINT CD%; ' Accum score
2344 CF% = INT(CD% / IA% * 100)' Percent
2346 PRINT CF%
2900 NEXT IA%
3000 PRINT "Trial #; Goal; Try_1; Y/N; Wins; Percent; Try_2; Y/N; Wins; Percent"
3010 INPUT "Repeat ? Y/N :", DA$
3020 IF DA$ = "N" OR DA$ = "n" THEN 9900 ELSE RUN
9900 PRINT "Done"
9999 END