All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 How often does he lie? (Posted on 2004-07-02)
In the "Not-always-lying politician" problem, what's the probability that a particular sentence is true?

 See The Solution Submitted by Federico Kereki Rating: 2.5000 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: Solution | Comment 2 of 6 |
(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

PRINT tCount, fCount
PRINT #2, tCount, fCount

CLOSE

s\$ = s\$ + "t"
IF LEN(s\$) < 10 THEN
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
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:

`tttttttttttttttttttfttttttttfttttttttftttttttttftfttttttftttttttttfttfttttttftfttttttftttttttttftttftttttfttfttttttftftttttttftftfttttftttttttttfttttfttttftttftttttfttfttttttfttftfttttftftttttttftfttfttttftftfttttftttttttttftttttftttfttttfttttftttftttttftttftftttfttfttttttfttfttftttfttftfttttftftttttttftftttftttftfttfttttftftftttttftftftfttftttttttttfttttttfttftttttftttfttttfttttfttttftfttftttftttttftttfttfttftttftftttfttfttttttfttftttfttfttfttftttfttftfttttfttftftfttftftttttttftfttttfttftftttftttftfttfttttftfttftfttftftftttttftftfttfttftftftfttftttttttttftttttttftfttttttfttftttttftttftttttftftfttttfttttfttttfttftfttttftfttftttftttttftttftttftftttfttfttftttftftttftttftftftfttfttttttfttfttttftfttftttfttfttfttftttfttfttftftfttftfttttfttftfttftfttftftfttftftttttttftftttttftftfttttfttftftttftttftftttftftftfttfttttftfttfttftftfttftfttftftftttttftftftttftftftfttfttftftftftttftftftftfftttttttttfttttttttfftttttttftfttttttfttfttttttftfftttttftttftttttfttfftttttftftfttttfttttfttttftttffttttfttftfttttftfttfttttftftfftttftttttftttfttttfftttftttftftttfttfttftttfttftfftttftftttftttftfttfftttftftftfttfttttttfttftttttffttfttttftfttftttfttfttftttftffttfttftttfttfttfttffttfttftftfttftfttttfttftftttffttftfttftfttftftfttfttftftftfftftttttttftfttttttfftftttttftftfttttfttftfttttftfftftttftttftftttfttfftftttftftftfttfttttftfttftttfftfttfttftftfttftfttftfttftftfftftftttttftftfttttfftftftttftftftfttfttftftfttftfftftftftttftftftfttfftftftftft 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

 Search: Search body:
Forums (0)