In the
"Not-always-lying politician" problem, what's the probability that a particular sentence is true?
(In reply to
Solution by Bob)
It's true that the probability of a sentence being true is 70.8333... percent if the politician is equally likely to have followed any one of the 144 possible ways he could make ten statements. That's verified by this program:
DECLARE SUB addon (s$)
DIM SHARED tCount, fCount, s$
OPEN "truefals.txt" FOR OUTPUT AS #2
addon s$
PRINT tCount, fCount
PRINT #2, tCount, fCount
CLOSE
SUB addon (s$)
s$ = s$ + "t"
IF LEN(s$) < 10 THEN
addon s$
ELSE
PRINT #2, s$
FOR i = 1 TO LEN(s$)
IF MID$(s$, i, 1) = "t" THEN tCount = tCount + 1: ELSE fCount = fCount + 1
NEXT
END IF
s$ = LEFT$(s$, LEN(s$) - 1)
IF RIGHT$(s$, 1) <> "f" THEN
s$ = s$ + "f"
IF LEN(s$) < 10 THEN
addon s$
ELSE
PRINT #2, s$
FOR i = 1 TO LEN(s$)
IF MID$(s$, i, 1) = "t" THEN tCount = tCount + 1: ELSE fCount = fCount + 1
NEXT
END IF
s$ = LEFT$(s$, LEN(s$) - 1)
END IF
END SUB
which prints out the ways and tabulates the total true and total false:
tttttttttt
tttttttttf
ttttttttft
tttttttftt
tttttttftf
ttttttfttt
ttttttfttf
ttttttftft
tttttftttt
tttttftttf
tttttfttft
tttttftftt
tttttftftf
ttttfttttt
ttttfttttf
ttttftttft
ttttfttftt
ttttfttftf
ttttftfttt
ttttftfttf
ttttftftft
tttftttttt
tttftttttf
tttfttttft
tttftttftt
tttftttftf
tttfttfttt
tttfttfttf
tttfttftft
tttftftttt
tttftftttf
tttftfttft
tttftftftt
tttftftftf
ttfttttttt
ttfttttttf
ttftttttft
ttfttttftt
ttfttttftf
ttftttfttt
ttftttfttf
ttftttftft
ttfttftttt
ttfttftttf
ttfttfttft
ttfttftftt
ttfttftftf
ttftfttttt
ttftfttttf
ttftftttft
ttftfttftt
ttftfttftf
ttftftfttt
ttftftfttf
ttftftftft
tftttttttt
tftttttttf
tfttttttft
tftttttftt
tftttttftf
tfttttfttt
tfttttfttf
tfttttftft
tftttftttt
tftttftttf
tftttfttft
tftttftftt
tftttftftf
tfttfttttt
tfttfttttf
tfttftttft
tfttfttftt
tfttfttftf
tfttftfttt
tfttftfttf
tfttftftft
tftftttttt
tftftttttf
tftfttttft
tftftttftt
tftftttftf
tftfttfttt
tftfttfttf
tftfttftft
tftftftttt
tftftftttf
tftftfttft
tftftftftt
tftftftftf
fttttttttt
fttttttttf
ftttttttft
fttttttftt
fttttttftf
ftttttfttt
ftttttfttf
ftttttftft
fttttftttt
fttttftttf
fttttfttft
fttttftftt
fttttftftf
ftttfttttt
ftttfttttf
ftttftttft
ftttfttftt
ftttfttftf
ftttftfttt
ftttftfttf
ftttftftft
fttftttttt
fttftttttf
fttfttttft
fttftttftt
fttftttftf
fttfttfttt
fttfttfttf
fttfttftft
fttftftttt
fttftftttf
fttftfttft
fttftftftt
fttftftftf
ftfttttttt
ftfttttttf
ftftttttft
ftfttttftt
ftfttttftf
ftftttfttt
ftftttfttf
ftftttftft
ftfttftttt
ftfttftttf
ftfttfttft
ftfttftftt
ftfttftftf
ftftfttttt
ftftfttttf
ftftftttft
ftftfttftt
ftftfttftf
ftftftfttt
ftftftfttf
ftftftftft
1020 420
However, if the politician wants to lie as much as he can he will just alternate truths and lies without regard for the other possibilities, and each statement will have a 50% chance of being true.
|
Posted by Charlie
on 2004-07-02 15:15:02 |